mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-23 15:48:23 +00:00
rtpdtmfsrc: Post the messages after the clock wait
This way, the messages will be closer in time to when the packets are sent out
This commit is contained in:
parent
b69f09e26f
commit
a2384408f0
1 changed files with 28 additions and 11 deletions
|
@ -642,12 +642,11 @@ gst_rtp_dtmf_src_create_next_rtp_packet (GstRTPDTMFSrc * dtmfsrc)
|
|||
return buf;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gst_dtmf_src_post_message (GstRTPDTMFSrc * dtmfsrc, const gchar * message_name,
|
||||
GstRTPDTMFSrcEvent * event)
|
||||
static GstMessage *
|
||||
gst_dtmf_src_prepare_message (GstRTPDTMFSrc * dtmfsrc,
|
||||
const gchar * message_name, GstRTPDTMFSrcEvent * event)
|
||||
{
|
||||
GstStructure *s = NULL;
|
||||
GstStructure *s;
|
||||
|
||||
switch (event->event_type) {
|
||||
case RTP_DTMF_EVENT_TYPE_START:
|
||||
|
@ -664,12 +663,21 @@ gst_dtmf_src_post_message (GstRTPDTMFSrc * dtmfsrc, const gchar * message_name,
|
|||
"start", G_TYPE_BOOLEAN, FALSE, NULL);
|
||||
break;
|
||||
case RTP_DTMF_EVENT_TYPE_PAUSE_TASK:
|
||||
return;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (s)
|
||||
gst_element_post_message (GST_ELEMENT (dtmfsrc),
|
||||
gst_message_new_element (GST_OBJECT (dtmfsrc), s));
|
||||
return gst_message_new_element (GST_OBJECT (dtmfsrc), s);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_dtmf_src_post_message (GstRTPDTMFSrc * dtmfsrc, const gchar * message_name,
|
||||
GstRTPDTMFSrcEvent * event)
|
||||
{
|
||||
GstMessage *m = gst_dtmf_src_prepare_message (dtmfsrc, message_name, event);
|
||||
|
||||
|
||||
if (m)
|
||||
gst_element_post_message (GST_ELEMENT (dtmfsrc), m);
|
||||
}
|
||||
|
||||
|
||||
|
@ -682,6 +690,8 @@ gst_rtp_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset,
|
|||
GstClock *clock;
|
||||
GstClockID *clockid;
|
||||
GstClockReturn clockret;
|
||||
GstMessage *message;
|
||||
GQueue messages = G_QUEUE_INIT;
|
||||
|
||||
dtmfsrc = GST_RTP_DTMF_SRC (basesrc);
|
||||
|
||||
|
@ -708,7 +718,9 @@ gst_rtp_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset,
|
|||
if (!gst_rtp_dtmf_prepare_timestamps (dtmfsrc))
|
||||
goto no_clock;
|
||||
|
||||
gst_dtmf_src_post_message (dtmfsrc, "dtmf-event-processed", event);
|
||||
g_queue_push_tail (&messages,
|
||||
gst_dtmf_src_prepare_message (dtmfsrc, "dtmf-event-processed",
|
||||
event));
|
||||
dtmfsrc->payload = event->payload;
|
||||
dtmfsrc->payload->duration =
|
||||
dtmfsrc->ptime * dtmfsrc->clock_rate / 1000;
|
||||
|
@ -752,7 +764,9 @@ gst_rtp_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset,
|
|||
dtmfsrc->last_packet = TRUE;
|
||||
/* Set the redundancy on the last packet */
|
||||
dtmfsrc->redundancy_count = dtmfsrc->packet_redundancy;
|
||||
gst_dtmf_src_post_message (dtmfsrc, "dtmf-event-processed", event);
|
||||
g_queue_push_tail (&messages,
|
||||
gst_dtmf_src_prepare_message (dtmfsrc, "dtmf-event-processed",
|
||||
event));
|
||||
break;
|
||||
|
||||
case RTP_DTMF_EVENT_TYPE_PAUSE_TASK:
|
||||
|
@ -801,6 +815,9 @@ gst_rtp_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset,
|
|||
dtmfsrc->clockid = NULL;
|
||||
GST_OBJECT_UNLOCK (dtmfsrc);
|
||||
|
||||
while ((message = g_queue_pop_head (&messages)) != NULL)
|
||||
gst_element_post_message (GST_ELEMENT (dtmfsrc), message);
|
||||
|
||||
if (clockret == GST_CLOCK_UNSCHEDULED) {
|
||||
goto paused;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue