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:
"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);
}
GstClock *clock;
GstClockID *clockid;
GstClockReturn clockret;
+ GstMessage *message;
+ GQueue messages = G_QUEUE_INIT;
dtmfsrc = GST_RTP_DTMF_SRC (basesrc);
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;
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:
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;
}