rtpdtmfsrc: Only set the duration when starting to send
authorOlivier Crête <olivier.crete@collabora.com>
Sat, 26 Jan 2013 01:37:53 +0000 (20:37 -0500)
committerOlivier Crête <olivier.crete@collabora.com>
Sat, 26 Jan 2013 01:45:43 +0000 (20:45 -0500)
The duration depends on the clock rate, which could change due to renegotiation

gst/dtmf/gstrtpdtmfsrc.c

index 5c166e7d321f7525676fb00e4b1002e093579cc4..ccba67f6443448c254926a92676b175c72837fbb 100644 (file)
@@ -550,7 +550,6 @@ gst_rtp_dtmf_src_add_start_event (GstRTPDTMFSrc * dtmfsrc, gint event_number,
   event->payload = g_slice_new0 (GstRTPDTMFPayload);
   event->payload->event = CLAMP (event_number, MIN_EVENT, MAX_EVENT);
   event->payload->volume = CLAMP (event_volume, MIN_VOLUME, MAX_VOLUME);
-  event->payload->duration = dtmfsrc->ptime * dtmfsrc->clock_rate / 1000;
 
   g_async_queue_push (dtmfsrc->event_queue, event);
 }
@@ -711,6 +710,8 @@ gst_rtp_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset,
 
           gst_dtmf_src_post_message (dtmfsrc, "dtmf-event-processed", event);
           dtmfsrc->payload = event->payload;
+          dtmfsrc->payload->duration =
+              dtmfsrc->ptime * dtmfsrc->clock_rate / 1000;
           event->payload = NULL;
           break;