diff options
author | Dave Robillard <dave@drobilla.net> | 2009-08-09 00:14:27 -0400 |
---|---|---|
committer | Dave Robillard <dave@drobilla.net> | 2009-08-09 00:14:27 -0400 |
commit | dd5afbf0c6557ad89994cbfd91e4117e8503b81a (patch) | |
tree | 4f18322a717c6dbe64b8b38194e302b1668dcb3d /gst/rtpmanager | |
parent | 5d9d4a7b518c42bda88c7f6c87ce7c3c01233562 (diff) | |
parent | 6115e0cb0ef3ae85397297c7e30c2e9b4a0a181e (diff) | |
download | gst-plugins-bad-dd5afbf0c6557ad89994cbfd91e4117e8503b81a.tar.gz gst-plugins-bad-dd5afbf0c6557ad89994cbfd91e4117e8503b81a.tar.bz2 gst-plugins-bad-dd5afbf0c6557ad89994cbfd91e4117e8503b81a.zip |
Merge branch 'master' of git://anongit.freedesktop.org/gstreamer/gst-plugins-bad into fdo
Diffstat (limited to 'gst/rtpmanager')
-rw-r--r-- | gst/rtpmanager/rtpsession.c | 33 | ||||
-rw-r--r-- | gst/rtpmanager/rtpsource.c | 3 |
2 files changed, 25 insertions, 11 deletions
diff --git a/gst/rtpmanager/rtpsession.c b/gst/rtpmanager/rtpsession.c index d63d9d0e..3e17ec12 100644 --- a/gst/rtpmanager/rtpsession.c +++ b/gst/rtpmanager/rtpsession.c @@ -1577,7 +1577,7 @@ rtp_session_process_rb (RTPSession * sess, RTPSource * source, */ static void rtp_session_process_sr (RTPSession * sess, GstRTCPPacket * packet, - RTPArrivalStats * arrival) + RTPArrivalStats * arrival, gboolean * do_sync) { guint32 senderssrc, rtptime, packet_count, octet_count; guint64 ntptime; @@ -1594,6 +1594,12 @@ rtp_session_process_sr (RTPSession * sess, GstRTCPPacket * packet, if (!source) return; + /* don't try to do lip-sync for sources that sent a BYE */ + if (rtp_source_received_bye (source)) + *do_sync = FALSE; + else + *do_sync = TRUE; + prevsender = RTP_SOURCE_IS_SENDER (source); /* first update the source */ @@ -1711,6 +1717,7 @@ rtp_session_process_bye (RTPSession * sess, GstRTCPPacket * packet, { guint count, i; gchar *reason; + gboolean reconsider = FALSE; reason = gst_rtcp_packet_bye_get_reason (packet); GST_DEBUG ("got BYE packet (reason: %s)", GST_STR_NULL (reason)); @@ -1769,11 +1776,9 @@ rtp_session_process_bye (RTPSession * sess, GstRTCPPacket * packet, sess->next_rtcp_check_time += arrival->time; - RTP_SESSION_UNLOCK (sess); - /* notify app of reconsideration */ - if (sess->callbacks.reconsider) - sess->callbacks.reconsider (sess, sess->reconsider_user_data); - RTP_SESSION_LOCK (sess); + /* mark pending reconsider. We only want to signal the reconsideration + * once after we handled all the source in the bye packet */ + reconsider = TRUE; } } @@ -1784,6 +1789,13 @@ rtp_session_process_bye (RTPSession * sess, GstRTCPPacket * packet, g_object_unref (source); } + if (reconsider) { + RTP_SESSION_UNLOCK (sess); + /* notify app of reconsideration */ + if (sess->callbacks.reconsider) + sess->callbacks.reconsider (sess, sess->reconsider_user_data); + RTP_SESSION_LOCK (sess); + } g_free (reason); } @@ -1810,7 +1822,7 @@ rtp_session_process_rtcp (RTPSession * sess, GstBuffer * buffer, GstClockTime current_time) { GstRTCPPacket packet; - gboolean more, is_bye = FALSE, is_sr = FALSE; + gboolean more, is_bye = FALSE, do_sync = FALSE; RTPArrivalStats arrival; GstFlowReturn result = GST_FLOW_OK; @@ -1847,8 +1859,7 @@ rtp_session_process_rtcp (RTPSession * sess, GstBuffer * buffer, switch (type) { case GST_RTCP_TYPE_SR: - rtp_session_process_sr (sess, &packet, &arrival); - is_sr = TRUE; + rtp_session_process_sr (sess, &packet, &arrival, &do_sync); break; case GST_RTCP_TYPE_RR: rtp_session_process_rr (sess, &packet, &arrival); @@ -1858,6 +1869,8 @@ rtp_session_process_rtcp (RTPSession * sess, GstBuffer * buffer, break; case GST_RTCP_TYPE_BYE: is_bye = TRUE; + /* don't try to attempt lip-sync anymore for streams with a BYE */ + do_sync = FALSE; rtp_session_process_bye (sess, &packet, &arrival); break; case GST_RTCP_TYPE_APP: @@ -1885,7 +1898,7 @@ rtp_session_process_rtcp (RTPSession * sess, GstBuffer * buffer, RTP_SESSION_UNLOCK (sess); /* notify caller of sr packets in the callback */ - if (is_sr && sess->callbacks.sync_rtcp) + if (do_sync && sess->callbacks.sync_rtcp) result = sess->callbacks.sync_rtcp (sess, sess->source, buffer, sess->sync_rtcp_user_data); else diff --git a/gst/rtpmanager/rtpsource.c b/gst/rtpmanager/rtpsource.c index 40cdd238..28fa23ef 100644 --- a/gst/rtpmanager/rtpsource.c +++ b/gst/rtpmanager/rtpsource.c @@ -628,7 +628,7 @@ rtp_source_update_caps (RTPSource * src, GstCaps * caps) gint ival; /* nothing changed, return */ - if (src->caps == caps) + if (caps == NULL || src->caps == caps) return; s = gst_caps_get_structure (caps, 0); @@ -1074,6 +1074,7 @@ done: bad_sequence: { GST_WARNING ("unacceptable seqnum received"); + gst_buffer_unref (buffer); return GST_FLOW_OK; } } |