static gboolean gst_rtp_dtmf_src_query (GstBaseSrc * basesrc, GstQuery * query) { GstRTPDTMFSrc *dtmfsrc = GST_RTP_DTMF_SRC (basesrc); gboolean res = FALSE; switch (GST_QUERY_TYPE (query)) { case GST_QUERY_LATENCY: { GstClockTime latency; latency = dtmfsrc->ptime * GST_MSECOND; gst_query_set_latency (query, gst_base_src_is_live (basesrc), latency, GST_CLOCK_TIME_NONE); GST_DEBUG_OBJECT (dtmfsrc, "Reporting latency of %" GST_TIME_FORMAT, GST_TIME_ARGS (latency)); res = TRUE; } break; default: res = GST_BASE_SRC_CLASS (gst_rtp_dtmf_src_parent_class)->query (basesrc, query); break; } return res; }
static void gst_rtp_dtmf_src_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstRTPDTMFSrc *dtmfsrc; dtmfsrc = GST_RTP_DTMF_SRC (object); switch (prop_id) { case PROP_TIMESTAMP_OFFSET: dtmfsrc->ts_offset = g_value_get_int (value); break; case PROP_SEQNUM_OFFSET: dtmfsrc->seqnum_offset = g_value_get_int (value); break; case PROP_CLOCK_RATE: dtmfsrc->clock_rate = g_value_get_uint (value); dtmfsrc->dirty = TRUE; break; case PROP_SSRC: dtmfsrc->ssrc = g_value_get_uint (value); break; case PROP_PT: dtmfsrc->pt = g_value_get_uint (value); dtmfsrc->dirty = TRUE; break; case PROP_REDUNDANCY: dtmfsrc->packet_redundancy = g_value_get_uint (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static GstStateChangeReturn gst_rtp_dtmf_src_change_state (GstElement * element, GstStateChange transition) { GstRTPDTMFSrc *dtmfsrc; GstStateChangeReturn result; gboolean no_preroll = FALSE; GstRTPDTMFSrcEvent *event = NULL; dtmfsrc = GST_RTP_DTMF_SRC (element); switch (transition) { case GST_STATE_CHANGE_READY_TO_PAUSED: gst_rtp_dtmf_src_ready_to_paused (dtmfsrc); /* Flushing the event queue */ while ((event = g_async_queue_try_pop (dtmfsrc->event_queue)) != NULL) gst_rtp_dtmf_src_event_free (event); no_preroll = TRUE; break; default: break; } if ((result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition)) == GST_STATE_CHANGE_FAILURE) goto failure; switch (transition) { case GST_STATE_CHANGE_PLAYING_TO_PAUSED: no_preroll = TRUE; break; case GST_STATE_CHANGE_PAUSED_TO_READY: /* Flushing the event queue */ while ((event = g_async_queue_try_pop (dtmfsrc->event_queue)) != NULL) gst_rtp_dtmf_src_event_free (event); /* Indicate that we don't do PRE_ROLL */ break; default: break; } if (no_preroll && result == GST_STATE_CHANGE_SUCCESS) result = GST_STATE_CHANGE_NO_PREROLL; return result; /* ERRORS */ failure: { GST_ERROR_OBJECT (dtmfsrc, "parent failed state change"); return result; } }
static gboolean gst_rtp_dtmf_src_unlock_stop (GstBaseSrc * src) { GstRTPDTMFSrc *dtmfsrc = GST_RTP_DTMF_SRC (src); GST_DEBUG_OBJECT (dtmfsrc, "Unlock stopped"); GST_OBJECT_LOCK (dtmfsrc); dtmfsrc->paused = FALSE; GST_OBJECT_UNLOCK (dtmfsrc); return TRUE; }
static gboolean gst_rtp_dtmf_src_handle_event (GstBaseSrc * basesrc, GstEvent * event) { GstRTPDTMFSrc *dtmfsrc; gboolean result = FALSE; dtmfsrc = GST_RTP_DTMF_SRC (basesrc); GST_DEBUG_OBJECT (dtmfsrc, "Received an event on the src pad"); if (GST_EVENT_TYPE (event) == GST_EVENT_CUSTOM_UPSTREAM) { result = gst_rtp_dtmf_src_handle_custom_upstream (dtmfsrc, event); } return result; }
static void gst_rtp_dtmf_src_finalize (GObject * object) { GstRTPDTMFSrc *dtmfsrc; dtmfsrc = GST_RTP_DTMF_SRC (object); if (dtmfsrc->event_queue) { g_async_queue_unref (dtmfsrc->event_queue); dtmfsrc->event_queue = NULL; } G_OBJECT_CLASS (gst_rtp_dtmf_src_parent_class)->finalize (object); }
static void gst_rtp_dtmf_src_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { GstRTPDTMFSrc *dtmfsrc; dtmfsrc = GST_RTP_DTMF_SRC (object); switch (prop_id) { case PROP_TIMESTAMP_OFFSET: g_value_set_int (value, dtmfsrc->ts_offset); break; case PROP_SEQNUM_OFFSET: g_value_set_int (value, dtmfsrc->seqnum_offset); break; case PROP_CLOCK_RATE: g_value_set_uint (value, dtmfsrc->clock_rate); break; case PROP_SSRC: g_value_set_uint (value, dtmfsrc->ssrc); break; case PROP_PT: g_value_set_uint (value, dtmfsrc->pt); break; case PROP_TIMESTAMP: g_value_set_uint (value, dtmfsrc->rtp_timestamp); break; case PROP_SEQNUM: g_value_set_uint (value, dtmfsrc->seqnum); break; case PROP_INTERVAL: g_value_set_uint (value, dtmfsrc->interval); break; case PROP_REDUNDANCY: g_value_set_uint (value, dtmfsrc->packet_redundancy); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static gboolean gst_rtp_dtmf_src_unlock (GstBaseSrc * src) { GstRTPDTMFSrc *dtmfsrc = GST_RTP_DTMF_SRC (src); GstRTPDTMFSrcEvent *event = NULL; GST_DEBUG_OBJECT (dtmfsrc, "Called unlock"); GST_OBJECT_LOCK (dtmfsrc); dtmfsrc->paused = TRUE; if (dtmfsrc->clockid) { gst_clock_id_unschedule (dtmfsrc->clockid); } GST_OBJECT_UNLOCK (dtmfsrc); GST_DEBUG_OBJECT (dtmfsrc, "Pushing the PAUSE_TASK event on unlock request"); event = g_slice_new0 (GstRTPDTMFSrcEvent); event->event_type = RTP_DTMF_EVENT_TYPE_PAUSE_TASK; g_async_queue_push (dtmfsrc->event_queue, event); return TRUE; }
static gboolean gst_rtp_dtmf_src_negotiate (GstBaseSrc * basesrc) { GstCaps *srccaps, *peercaps; GstRTPDTMFSrc *dtmfsrc = GST_RTP_DTMF_SRC (basesrc); gboolean ret; /* fill in the defaults, there properties cannot be negotiated. */ srccaps = gst_caps_new_simple ("application/x-rtp", "media", G_TYPE_STRING, "audio", "encoding-name", G_TYPE_STRING, "TELEPHONE-EVENT", NULL); /* the peer caps can override some of the defaults */ peercaps = gst_pad_peer_query_caps (GST_BASE_SRC_PAD (basesrc), NULL); if (peercaps == NULL) { /* no peer caps, just add the other properties */ gst_caps_set_simple (srccaps, "payload", G_TYPE_INT, dtmfsrc->pt, "ssrc", G_TYPE_UINT, dtmfsrc->current_ssrc, "timestamp-offset", G_TYPE_UINT, dtmfsrc->ts_base, "clock-rate", G_TYPE_INT, dtmfsrc->clock_rate, "seqnum-offset", G_TYPE_UINT, dtmfsrc->seqnum_base, NULL); GST_DEBUG_OBJECT (dtmfsrc, "no peer caps: %" GST_PTR_FORMAT, srccaps); } else { GstCaps *temp; GstStructure *s; const GValue *value; gint pt; gint clock_rate; /* peer provides caps we can use to fixate, intersect. This always returns a * writable caps. */ temp = gst_caps_intersect (srccaps, peercaps); gst_caps_unref (srccaps); gst_caps_unref (peercaps); if (!temp) { GST_DEBUG_OBJECT (dtmfsrc, "Could not get intersection with peer caps"); return FALSE; } if (gst_caps_is_empty (temp)) { GST_DEBUG_OBJECT (dtmfsrc, "Intersection with peer caps is empty"); gst_caps_unref (temp); return FALSE; } /* now fixate, start by taking the first caps */ temp = gst_caps_truncate (temp); temp = gst_caps_make_writable (temp); srccaps = temp; /* get first structure */ s = gst_caps_get_structure (srccaps, 0); if (gst_structure_get_int (s, "payload", &pt)) { /* use peer pt */ dtmfsrc->pt = pt; GST_LOG_OBJECT (dtmfsrc, "using peer pt %d", pt); } else { if (gst_structure_has_field (s, "payload")) { /* can only fixate if there is a field */ gst_structure_fixate_field_nearest_int (s, "payload", dtmfsrc->pt); gst_structure_get_int (s, "payload", &pt); GST_LOG_OBJECT (dtmfsrc, "using peer pt %d", pt); } else { /* no pt field, use the internal pt */ pt = dtmfsrc->pt; gst_structure_set (s, "payload", G_TYPE_INT, pt, NULL); GST_LOG_OBJECT (dtmfsrc, "using internal pt %d", pt); } } if (gst_structure_get_int (s, "clock-rate", &clock_rate)) { dtmfsrc->clock_rate = clock_rate; GST_LOG_OBJECT (dtmfsrc, "using clock-rate from caps %d", dtmfsrc->clock_rate); } else { GST_LOG_OBJECT (dtmfsrc, "using existing clock-rate %d", dtmfsrc->clock_rate); } gst_structure_set (s, "clock-rate", G_TYPE_INT, dtmfsrc->clock_rate, NULL); if (gst_structure_has_field_typed (s, "ssrc", G_TYPE_UINT)) { value = gst_structure_get_value (s, "ssrc"); dtmfsrc->current_ssrc = g_value_get_uint (value); GST_LOG_OBJECT (dtmfsrc, "using peer ssrc %08x", dtmfsrc->current_ssrc); } else { /* FIXME, fixate_nearest_uint would be even better */ gst_structure_set (s, "ssrc", G_TYPE_UINT, dtmfsrc->current_ssrc, NULL); GST_LOG_OBJECT (dtmfsrc, "using internal ssrc %08x", dtmfsrc->current_ssrc); } if (gst_structure_has_field_typed (s, "timestamp-offset", G_TYPE_UINT)) { value = gst_structure_get_value (s, "timestamp-offset"); dtmfsrc->ts_base = g_value_get_uint (value); GST_LOG_OBJECT (dtmfsrc, "using peer timestamp-offset %u", dtmfsrc->ts_base); } else { /* FIXME, fixate_nearest_uint would be even better */ gst_structure_set (s, "timestamp-offset", G_TYPE_UINT, dtmfsrc->ts_base, NULL); GST_LOG_OBJECT (dtmfsrc, "using internal timestamp-offset %u", dtmfsrc->ts_base); } if (gst_structure_has_field_typed (s, "seqnum-offset", G_TYPE_UINT)) { value = gst_structure_get_value (s, "seqnum-offset"); dtmfsrc->seqnum_base = g_value_get_uint (value); GST_LOG_OBJECT (dtmfsrc, "using peer seqnum-offset %u", dtmfsrc->seqnum_base); } else { /* FIXME, fixate_nearest_uint would be even better */ gst_structure_set (s, "seqnum-offset", G_TYPE_UINT, dtmfsrc->seqnum_base, NULL); GST_LOG_OBJECT (dtmfsrc, "using internal seqnum-offset %u", dtmfsrc->seqnum_base); } if (gst_structure_has_field_typed (s, "ptime", G_TYPE_UINT)) { value = gst_structure_get_value (s, "ptime"); dtmfsrc->ptime = g_value_get_uint (value); GST_LOG_OBJECT (dtmfsrc, "using peer ptime %u", dtmfsrc->ptime); } else if (gst_structure_has_field_typed (s, "maxptime", G_TYPE_UINT)) { value = gst_structure_get_value (s, "maxptime"); dtmfsrc->ptime = g_value_get_uint (value); GST_LOG_OBJECT (dtmfsrc, "using peer maxptime as ptime %u", dtmfsrc->ptime); } else { /* FIXME, fixate_nearest_uint would be even better */ gst_structure_set (s, "ptime", G_TYPE_UINT, dtmfsrc->ptime, NULL); GST_LOG_OBJECT (dtmfsrc, "using internal ptime %u", dtmfsrc->ptime); } GST_DEBUG_OBJECT (dtmfsrc, "with peer caps: %" GST_PTR_FORMAT, srccaps); } ret = gst_pad_set_caps (GST_BASE_SRC_PAD (basesrc), srccaps); gst_caps_unref (srccaps); dtmfsrc->dirty = FALSE; return ret; }
static GstFlowReturn gst_rtp_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset, guint length, GstBuffer ** buffer) { GstRTPDTMFSrcEvent *event; GstRTPDTMFSrc *dtmfsrc; GstClock *clock; GstClockID *clockid; GstClockReturn clockret; GstMessage *message; GQueue messages = G_QUEUE_INIT; dtmfsrc = GST_RTP_DTMF_SRC (basesrc); do { if (dtmfsrc->payload == NULL) { GST_DEBUG_OBJECT (dtmfsrc, "popping"); event = g_async_queue_pop (dtmfsrc->event_queue); GST_DEBUG_OBJECT (dtmfsrc, "popped %d", event->event_type); switch (event->event_type) { case RTP_DTMF_EVENT_TYPE_STOP: GST_WARNING_OBJECT (dtmfsrc, "Received a DTMF stop event when already stopped"); gst_dtmf_src_post_message (dtmfsrc, "dtmf-event-dropped", event); break; case RTP_DTMF_EVENT_TYPE_START: dtmfsrc->first_packet = TRUE; dtmfsrc->last_packet = FALSE; /* Set the redundancy on the first packet */ dtmfsrc->redundancy_count = dtmfsrc->packet_redundancy; if (!gst_rtp_dtmf_prepare_timestamps (dtmfsrc)) goto no_clock; 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; event->payload = NULL; break; case RTP_DTMF_EVENT_TYPE_PAUSE_TASK: /* * We're pushing it back because it has to stay in there until * the task is really paused (and the queue will then be flushed */ GST_OBJECT_LOCK (dtmfsrc); if (dtmfsrc->paused) { g_async_queue_push (dtmfsrc->event_queue, event); goto paused_locked; } GST_OBJECT_UNLOCK (dtmfsrc); break; } gst_rtp_dtmf_src_event_free (event); } else if (!dtmfsrc->first_packet && !dtmfsrc->last_packet && (dtmfsrc->timestamp - dtmfsrc->start_timestamp) / GST_MSECOND >= MIN_PULSE_DURATION) { GST_DEBUG_OBJECT (dtmfsrc, "try popping"); event = g_async_queue_try_pop (dtmfsrc->event_queue); if (event != NULL) { GST_DEBUG_OBJECT (dtmfsrc, "try popped %d", event->event_type); switch (event->event_type) { case RTP_DTMF_EVENT_TYPE_START: GST_WARNING_OBJECT (dtmfsrc, "Received two consecutive DTMF start events"); gst_dtmf_src_post_message (dtmfsrc, "dtmf-event-dropped", event); break; case RTP_DTMF_EVENT_TYPE_STOP: dtmfsrc->first_packet = FALSE; dtmfsrc->last_packet = TRUE; /* Set the redundancy on the last packet */ dtmfsrc->redundancy_count = dtmfsrc->packet_redundancy; g_queue_push_tail (&messages, gst_dtmf_src_prepare_message (dtmfsrc, "dtmf-event-processed", event)); break; case RTP_DTMF_EVENT_TYPE_PAUSE_TASK: /* * We're pushing it back because it has to stay in there until * the task is really paused (and the queue will then be flushed) */ GST_DEBUG_OBJECT (dtmfsrc, "pushing pause_task..."); GST_OBJECT_LOCK (dtmfsrc); if (dtmfsrc->paused) { g_async_queue_push (dtmfsrc->event_queue, event); goto paused_locked; } GST_OBJECT_UNLOCK (dtmfsrc); break; } gst_rtp_dtmf_src_event_free (event); } } } while (dtmfsrc->payload == NULL); GST_DEBUG_OBJECT (dtmfsrc, "Processed events, now lets wait on the clock"); clock = gst_element_get_clock (GST_ELEMENT (basesrc)); if (!clock) goto no_clock; clockid = gst_clock_new_single_shot_id (clock, dtmfsrc->timestamp + gst_element_get_base_time (GST_ELEMENT (dtmfsrc))); gst_object_unref (clock); GST_OBJECT_LOCK (dtmfsrc); if (!dtmfsrc->paused) { dtmfsrc->clockid = clockid; GST_OBJECT_UNLOCK (dtmfsrc); clockret = gst_clock_id_wait (clockid, NULL); GST_OBJECT_LOCK (dtmfsrc); if (dtmfsrc->paused) clockret = GST_CLOCK_UNSCHEDULED; } else { clockret = GST_CLOCK_UNSCHEDULED; } gst_clock_id_unref (clockid); 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; } send_last: if (dtmfsrc->dirty) if (!gst_rtp_dtmf_src_negotiate (basesrc)) return GST_FLOW_NOT_NEGOTIATED; /* create buffer to hold the payload */ *buffer = gst_rtp_dtmf_src_create_next_rtp_packet (dtmfsrc); if (dtmfsrc->redundancy_count) dtmfsrc->redundancy_count--; /* Only the very first one has a marker */ dtmfsrc->first_packet = FALSE; /* This is the end of the event */ if (dtmfsrc->last_packet == TRUE && dtmfsrc->redundancy_count == 0) { g_slice_free (GstRTPDTMFPayload, dtmfsrc->payload); dtmfsrc->payload = NULL; dtmfsrc->last_packet = FALSE; } return GST_FLOW_OK; paused_locked: GST_OBJECT_UNLOCK (dtmfsrc); paused: if (dtmfsrc->payload) { dtmfsrc->first_packet = FALSE; dtmfsrc->last_packet = TRUE; /* Set the redundanc on the last packet */ dtmfsrc->redundancy_count = dtmfsrc->packet_redundancy; goto send_last; } else { return GST_FLOW_FLUSHING; } no_clock: GST_ELEMENT_ERROR (dtmfsrc, STREAM, MUX, ("No available clock"), ("No available clock")); gst_pad_pause_task (GST_BASE_SRC_PAD (dtmfsrc)); return GST_FLOW_ERROR; }
static GstFlowReturn gst_rtp_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset, guint length, GstBuffer ** buffer) { GstRTPDTMFSrcEvent *event; GstRTPDTMFSrc *dtmfsrc; GstClock *clock; GstClockID *clockid; GstClockReturn clockret; dtmfsrc = GST_RTP_DTMF_SRC (basesrc); do { if (dtmfsrc->payload == NULL) { GST_DEBUG_OBJECT (dtmfsrc, "popping"); event = g_async_queue_pop (dtmfsrc->event_queue); GST_DEBUG_OBJECT (dtmfsrc, "popped %d", event->event_type); switch (event->event_type) { case RTP_DTMF_EVENT_TYPE_STOP: GST_WARNING_OBJECT (dtmfsrc, "Received a DTMF stop event when already stopped"); break; case RTP_DTMF_EVENT_TYPE_START: dtmfsrc->first_packet = TRUE; dtmfsrc->last_packet = FALSE; /* Set the redundancy on the first packet */ dtmfsrc->redundancy_count = dtmfsrc->packet_redundancy; gst_rtp_dtmf_prepare_timestamps (dtmfsrc); /* Don't forget to get exclusive access to the stream */ gst_rtp_dtmf_src_set_stream_lock (dtmfsrc, TRUE); dtmfsrc->payload = event->payload; event->payload = NULL; break; case RTP_DTMF_EVENT_TYPE_PAUSE_TASK: /* * We're pushing it back because it has to stay in there until * the task is really paused (and the queue will then be flushed */ GST_OBJECT_LOCK (dtmfsrc); if (dtmfsrc->paused) { g_async_queue_push (dtmfsrc->event_queue, event); goto paused_locked; } GST_OBJECT_UNLOCK (dtmfsrc); break; } gst_rtp_dtmf_src_event_free (event); } else if (!dtmfsrc->first_packet && !dtmfsrc->last_packet && (dtmfsrc->timestamp - dtmfsrc->start_timestamp) / GST_MSECOND >= MIN_PULSE_DURATION) { GST_DEBUG_OBJECT (dtmfsrc, "try popping"); event = g_async_queue_try_pop (dtmfsrc->event_queue); if (event != NULL) { GST_DEBUG_OBJECT (dtmfsrc, "try popped %d", event->event_type); switch (event->event_type) { case RTP_DTMF_EVENT_TYPE_START: GST_WARNING_OBJECT (dtmfsrc, "Received two consecutive DTMF start events"); break; case RTP_DTMF_EVENT_TYPE_STOP: dtmfsrc->first_packet = FALSE; dtmfsrc->last_packet = TRUE; /* Set the redundancy on the last packet */ dtmfsrc->redundancy_count = dtmfsrc->packet_redundancy; break; case RTP_DTMF_EVENT_TYPE_PAUSE_TASK: /* * We're pushing it back because it has to stay in there until * the task is really paused (and the queue will then be flushed) */ GST_DEBUG_OBJECT (dtmfsrc, "pushing pause_task..."); GST_OBJECT_LOCK (dtmfsrc); if (dtmfsrc->paused) { g_async_queue_push (dtmfsrc->event_queue, event); goto paused_locked; } GST_OBJECT_UNLOCK (dtmfsrc); break; } gst_rtp_dtmf_src_event_free (event); } } } while (dtmfsrc->payload == NULL); GST_DEBUG_OBJECT (dtmfsrc, "Processed events, now lets wait on the clock"); clock = gst_element_get_clock (GST_ELEMENT (basesrc)); #ifdef MAEMO_BROKEN clockid = gst_clock_new_single_shot_id (clock, dtmfsrc->timestamp); #else clockid = gst_clock_new_single_shot_id (clock, dtmfsrc->timestamp + gst_element_get_base_time (GST_ELEMENT (dtmfsrc))); #endif gst_object_unref (clock); GST_OBJECT_LOCK (dtmfsrc); if (!dtmfsrc->paused) { dtmfsrc->clockid = clockid; GST_OBJECT_UNLOCK (dtmfsrc); clockret = gst_clock_id_wait (clockid, NULL); GST_OBJECT_LOCK (dtmfsrc); if (dtmfsrc->paused) clockret = GST_CLOCK_UNSCHEDULED; } else { clockret = GST_CLOCK_UNSCHEDULED; } gst_clock_id_unref (clockid); dtmfsrc->clockid = NULL; GST_OBJECT_UNLOCK (dtmfsrc); if (clockret == GST_CLOCK_UNSCHEDULED) { goto paused; } send_last: if (dtmfsrc->dirty) if (!gst_rtp_dtmf_src_negotiate (basesrc)) return GST_FLOW_NOT_NEGOTIATED; /* create buffer to hold the payload */ *buffer = gst_rtp_dtmf_src_create_next_rtp_packet (dtmfsrc); if (dtmfsrc->redundancy_count) dtmfsrc->redundancy_count--; /* Only the very first one has a marker */ dtmfsrc->first_packet = FALSE; /* This is the end of the event */ if (dtmfsrc->last_packet == TRUE && dtmfsrc->redundancy_count == 0) { /* Don't forget to release the stream lock */ gst_rtp_dtmf_src_set_stream_lock (dtmfsrc, FALSE); g_slice_free (GstRTPDTMFPayload, dtmfsrc->payload); dtmfsrc->payload = NULL; dtmfsrc->last_packet = FALSE; } return GST_FLOW_OK; paused_locked: GST_OBJECT_UNLOCK (dtmfsrc); paused: if (dtmfsrc->payload) { dtmfsrc->first_packet = FALSE; dtmfsrc->last_packet = TRUE; /* Set the redundanc on the last packet */ dtmfsrc->redundancy_count = dtmfsrc->packet_redundancy; goto send_last; } else { return GST_FLOW_WRONG_STATE; } }