summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorOlivier Crete <olivier.crete@collabora.co.uk>2007-07-12 19:57:15 +0000
committerEdward Hervey <bilboed@bilboed.com>2009-02-21 17:47:59 +0100
commit7a887a51873b86a3f459269ae48737744e3858de (patch)
treea23467f44b6dc31140172b25025950792cee68e1 /gst
parent074189363e4def66041756597462b788773762cd (diff)
downloadgst-plugins-bad-7a887a51873b86a3f459269ae48737744e3858de.tar.gz
gst-plugins-bad-7a887a51873b86a3f459269ae48737744e3858de.tar.bz2
gst-plugins-bad-7a887a51873b86a3f459269ae48737744e3858de.zip
[MOVED FROM GST-P-FARSIGHT] Send all packet from the streaming thread, including the last one
20070712195715-3e2dc-6848c70a7f0137c91fa882a8efb6dbf83891ae13.gz
Diffstat (limited to 'gst')
-rw-r--r--gst/rtpdtmf/gstrtpdtmfsrc.c39
-rw-r--r--gst/rtpdtmf/gstrtpdtmfsrc.h1
2 files changed, 25 insertions, 15 deletions
diff --git a/gst/rtpdtmf/gstrtpdtmfsrc.c b/gst/rtpdtmf/gstrtpdtmfsrc.c
index b20254ea..8e4f31b5 100644
--- a/gst/rtpdtmf/gstrtpdtmfsrc.c
+++ b/gst/rtpdtmf/gstrtpdtmfsrc.c
@@ -578,6 +578,7 @@ gst_rtp_dtmf_src_start (GstRTPDTMFSrc *dtmfsrc,
dtmfsrc->payload->event = CLAMP (event_number, MIN_EVENT, MAX_EVENT);
dtmfsrc->payload->volume = CLAMP (event_volume, MIN_VOLUME, MAX_VOLUME);
dtmfsrc->first_packet = TRUE;
+ dtmfsrc->last_packet = FALSE;
gst_rtp_dtmf_prepare_timestamps (dtmfsrc);
gst_rtp_dtmf_src_set_caps (dtmfsrc);
@@ -596,20 +597,10 @@ gst_rtp_dtmf_src_stop (GstRTPDTMFSrc *dtmfsrc)
{
g_return_if_fail (dtmfsrc->payload != NULL);
- if (!gst_pad_pause_task (dtmfsrc->srcpad)) {
- GST_ERROR_OBJECT (dtmfsrc, "Failed to pause task on src pad");
- return;
- }
-
/* Push the last packet with e-bit set */
- dtmfsrc->payload->e = 1;
- gst_rtp_dtmf_src_push_next_rtp_packet (dtmfsrc);
+ /* Next packet sent will be the last */
+ dtmfsrc->last_packet = TRUE;
- /* Don't forget to release the stream lock */
- gst_rtp_dtmf_src_set_stream_lock (dtmfsrc, FALSE);
-
- g_free (dtmfsrc->payload);
- dtmfsrc->payload = NULL;
}
static void
@@ -645,7 +636,11 @@ gst_rtp_dtmf_prepare_rtp_headers (GstRTPDTMFSrc *dtmfsrc, GstBuffer *buf)
if (dtmfsrc->first_packet) {
gst_rtp_buffer_set_marker (buf, TRUE);
dtmfsrc->first_packet = FALSE;
+ } else if (dtmfsrc->last_packet) {
+ dtmfsrc->payload->e = 1;
+ dtmfsrc->last_packet = FALSE;
}
+
dtmfsrc->seqnum++;
gst_rtp_buffer_set_seq (buf, dtmfsrc->seqnum);
@@ -709,15 +704,14 @@ gst_rtp_dtmf_src_push_next_rtp_packet (GstRTPDTMFSrc *dtmfsrc)
GstFlowReturn ret;
gint redundancy_count = 1;
- if (dtmfsrc->first_packet == TRUE || dtmfsrc->payload->e) {
+ if (dtmfsrc->first_packet == TRUE || dtmfsrc->last_packet == TRUE) {
redundancy_count = dtmfsrc->packet_redundancy;
if(dtmfsrc->first_packet == TRUE) {
GST_DEBUG_OBJECT (dtmfsrc,
"redundancy count set to %d due to dtmf start",
redundancy_count);
- }
- if(dtmfsrc->payload->e) {
+ } else if(dtmfsrc->last_packet == TRUE) {
GST_DEBUG_OBJECT (dtmfsrc,
"redundancy count set to %d due to dtmf stop",
redundancy_count);
@@ -746,6 +740,21 @@ gst_rtp_dtmf_src_push_next_rtp_packet (GstRTPDTMFSrc *dtmfsrc)
gst_buffer_unref(buf);
GST_DEBUG_OBJECT (dtmfsrc,
"pushed DTMF event '%d' on src pad", dtmfsrc->payload->event);
+
+ if (dtmfsrc->payload->e) {
+ /* Don't forget to release the stream lock */
+ gst_rtp_dtmf_src_set_stream_lock (dtmfsrc, FALSE);
+
+ g_free (dtmfsrc->payload);
+ dtmfsrc->payload = NULL;
+
+ if (!gst_pad_pause_task (dtmfsrc->srcpad)) {
+ GST_ERROR_OBJECT (dtmfsrc, "Failed to pause task on src pad");
+ return;
+ }
+
+ }
+
}
static void
diff --git a/gst/rtpdtmf/gstrtpdtmfsrc.h b/gst/rtpdtmf/gstrtpdtmfsrc.h
index 81187665..797526ea 100644
--- a/gst/rtpdtmf/gstrtpdtmfsrc.h
+++ b/gst/rtpdtmf/gstrtpdtmfsrc.h
@@ -81,6 +81,7 @@ struct _GstRTPDTMFSrc {
guint ssrc;
guint current_ssrc;
gboolean first_packet;
+ gboolean last_packet;
GstClockTime timestamp;
GstSegment segment;