diff options
author | Julien Isorce <julien.isorce@gmail.com> | 2017-06-22 07:25:07 -0700 |
---|---|---|
committer | Julien Isorce <jisorce@oblong.com> | 2017-07-25 10:12:42 +0100 |
commit | 674faa5e5e8c8276c6dc9fff654fcdef77c1c688 (patch) | |
tree | d4dd478445514725607a3e08dca35bdd7b5d6473 | |
parent | 12ff43a6b3c65f43c0b5c1320e63f4f616e20309 (diff) |
rtsp-stream: fix connection delay due to wrong assumption on last-sample
Commit 852cc09f542af5cadd79ffd7fe79d6475cf57e14 assumed that
multiudpsink's last-sample always comes from the payloader. Which
is wrong if auxiliary streams are multiplexed in the same stream.
So check the buffer's ssrc against the caps'ssrc before to use its
seqnum. If not the same ssrc just use the payloader as done prior
the commit above or when there is no last-sample yet.
https://bugzilla.gnome.org/show_bug.cgi?id=784094
-rw-r--r-- | gst/rtsp-server/rtsp-stream.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/gst/rtsp-server/rtsp-stream.c b/gst/rtsp-server/rtsp-stream.c index 6bb24df..6e8c97a 100644 --- a/gst/rtsp-server/rtsp-stream.c +++ b/gst/rtsp-server/rtsp-stream.c @@ -3018,13 +3018,29 @@ gst_rtsp_stream_get_rtpinfo (GstRTSPStream * stream, GstCaps *caps; GstBuffer *buffer; GstSegment *segment; + GstStructure *s; GstRTPBuffer rtp_buffer = GST_RTP_BUFFER_INIT; caps = gst_sample_get_caps (last_sample); buffer = gst_sample_get_buffer (last_sample); segment = gst_sample_get_segment (last_sample); + s = gst_caps_get_structure (caps, 0); if (gst_rtp_buffer_map (buffer, GST_MAP_READ, &rtp_buffer)) { + guint ssrc_buf = gst_rtp_buffer_get_ssrc (&rtp_buffer); + guint ssrc_stream = 0; + if (gst_structure_has_field_typed (s, "ssrc", G_TYPE_UINT) && + gst_structure_get_uint (s, "ssrc", &ssrc_stream) && + ssrc_buf != ssrc_stream) { + /* Skip buffers from auxiliary streams. */ + GST_DEBUG_OBJECT (stream, + "not a buffer from the payloader, SSRC: %08x", ssrc_buf); + + gst_rtp_buffer_unmap (&rtp_buffer); + gst_sample_unref (last_sample); + goto stats; + } + if (seq) { *seq = gst_rtp_buffer_get_seq (&rtp_buffer); } @@ -3042,8 +3058,6 @@ gst_rtsp_stream_get_rtpinfo (GstRTSPStream * stream, } if (clock_rate) { - GstStructure *s = gst_caps_get_structure (caps, 0); - gst_structure_get_int (s, "clock-rate", (gint *) clock_rate); if (*clock_rate == 0 && running_time) @@ -3058,6 +3072,7 @@ gst_rtsp_stream_get_rtpinfo (GstRTSPStream * stream, } } +stats: if (g_object_class_find_property (payobjclass, "stats")) { g_object_get (priv->payloader, "stats", &stats, NULL); if (stats == NULL) |