From a35d1dde421be0655eb36fed9f415a25f5fa00e0 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 5 Sep 2008 13:52:34 +0000 Subject: gst/rtpmanager/gstrtpbin.*: Add signal to notify listeners when a sender becomes a receiver. Original commit message from CVS: * gst/rtpmanager/gstrtpbin.c: (on_sender_timeout), (create_session), (gst_rtp_bin_associate), (gst_rtp_bin_sync_chain), (gst_rtp_bin_class_init), (gst_rtp_bin_request_new_pad): * gst/rtpmanager/gstrtpbin.h: Add signal to notify listeners when a sender becomes a receiver. Tweak lip-sync code, don't store our own copy of the ts-offset of the jitterbuffer, don't adjust sync if the change is less than 4msec. Get the RTP timestamp <-> GStreamer timestamp relation directly from the jitterbuffer instead of our inaccurate version from the source. * gst/rtpmanager/gstrtpjitterbuffer.c: (gst_rtp_jitter_buffer_chain), (gst_rtp_jitter_buffer_loop), (gst_rtp_jitter_buffer_get_sync): * gst/rtpmanager/gstrtpjitterbuffer.h: Add G_LIKELY macros, use global defines for max packet reorder and dropouts. Reset the jitterbuffer clock skew detection when packets seqnums are changed unexpectedly. * gst/rtpmanager/gstrtpsession.c: (on_sender_timeout), (gst_rtp_session_class_init), (gst_rtp_session_init): * gst/rtpmanager/gstrtpsession.h: Add sender timeout signal. * gst/rtpmanager/rtpjitterbuffer.c: (rtp_jitter_buffer_reset_skew), (calculate_skew), (rtp_jitter_buffer_insert), (rtp_jitter_buffer_get_sync): * gst/rtpmanager/rtpjitterbuffer.h: Add some G_LIKELY macros. Keep track of the extended RTP timestamp so that we can report the RTP timestamp <-> GStreamer timestamp relation for lip-sync. Remove server timestamp gap detection code, the server can sometimes make a huge gap in timestamps (talk spurts,...) see #549774. Detect timetamp weirdness instead by observing the sender/receiver timestamp relation and resync if it changes more than 1 second. Add method to report about the current rtp <-> gst timestamp relation which is needed for lip-sync. * gst/rtpmanager/rtpsession.c: (rtp_session_class_init), (on_sender_timeout), (check_collision), (rtp_session_process_sr), (session_cleanup): * gst/rtpmanager/rtpsession.h: Add sender timeout signal. Remove inaccurate rtp <-> gst timestamp relation code, the jitterbuffer can now do an accurate reporting about this. * gst/rtpmanager/rtpsource.c: (rtp_source_init), (rtp_source_update_caps), (calculate_jitter), (rtp_source_process_rtp): * gst/rtpmanager/rtpsource.h: Remove inaccurate rtp <-> gst timestamp relation code. * gst/rtpmanager/rtpstats.h: Define global max-reorder and max-dropout constants for use in various subsystems. --- gst/rtpmanager/rtpsource.c | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'gst/rtpmanager/rtpsource.c') diff --git a/gst/rtpmanager/rtpsource.c b/gst/rtpmanager/rtpsource.c index ddbf733b..8d9d6ecf 100644 --- a/gst/rtpmanager/rtpsource.c +++ b/gst/rtpmanager/rtpsource.c @@ -170,8 +170,6 @@ rtp_source_init (RTPSource * src) src->payload = 0; src->clock_rate = -1; - src->clock_base = -1; - src->clock_base_time = -1; src->packets = g_queue_new (); src->seqnum_base = -1; src->last_rtptime = -1; @@ -527,10 +525,6 @@ rtp_source_update_caps (RTPSource * src, GstCaps * caps) gst_structure_get_int (s, "clock-rate", &src->clock_rate); GST_DEBUG ("got clock-rate %d", src->clock_rate); - if (gst_structure_get_uint (s, "clock-base", &val)) - src->clock_base = val; - GST_DEBUG ("got clock-base %" G_GINT64_FORMAT, src->clock_base); - if (gst_structure_get_uint (s, "seqnum-base", &val)) src->seqnum_base = val; GST_DEBUG ("got seqnum-base %" G_GINT32_FORMAT, src->seqnum_base); @@ -771,13 +765,6 @@ calculate_jitter (RTPSource * src, GstBuffer * buffer, rtptime = gst_rtp_buffer_get_timestamp (buffer); - /* no clock-base, take first rtptime as base */ - if (src->clock_base == -1) { - GST_DEBUG ("using clock-base of %" G_GUINT32_FORMAT, rtptime); - src->clock_base = rtptime; - src->clock_base_time = arrival->timestamp; - } - /* convert arrival time to RTP timestamp units, truncate to 32 bits, we don't * care about the absolute value, just the difference. */ rtparrival = gst_util_uint64_scale_int (ntpnstime, clock_rate, GST_SECOND); @@ -923,13 +910,11 @@ rtp_source_process_rtp (RTPSource * src, GstBuffer * buffer, } else { /* unacceptable jump */ stats->bad_seq = (seqnr + 1) & (RTP_SEQ_MOD - 1); - src->clock_base = -1; goto bad_sequence; } } else { /* duplicate or reordered packet, will be filtered by jitterbuffer. */ GST_WARNING ("duplicate or reordered packet"); - src->clock_base = -1; } src->stats.octets_received += arrival->payload_len; -- cgit v1.2.1