diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-03-15 03:25:26 +0530 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2016-04-06 13:17:21 +0100 |
commit | 24d2312ed703560ef4805cfc4bf7c67d35603f4e (patch) | |
tree | 149a10993d52910d117ff5c76e377ffd8ef1be19 | |
parent | b5a67a08575eab3965c6a77d892d08f590f21f94 (diff) | |
download | gstreamer-plugins-good-24d2312ed703560ef4805cfc4bf7c67d35603f4e.tar.gz |
rtpjpegdepay: Don't send invalid frames downstream after packet loss or a DISCONT
After clearing the adapter due to a DISCONT, as might happen when some packet(s)
have been lost, the depayloader was pushing data into the adapter (which had no
header due to the clear), creating a headerless frame out of it, and sending it
downstream. The downstream decoder would then usually ignore it; unless there
were lots of DISCONTs from the jitterbuffer in which case the decoder would reach
its max_errors limit and throw an element error. Now we just discard that data.
It is probaby not worth trying to salvage this data because non-progressive
jpeg does not degrade gracefully and makes the video unwatchable even with
low packet loss such as 3-5%.
-rw-r--r-- | gst/rtp/gstrtpjpegdepay.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gst/rtp/gstrtpjpegdepay.c b/gst/rtp/gstrtpjpegdepay.c index c804aea9d..d9687812b 100644 --- a/gst/rtp/gstrtpjpegdepay.c +++ b/gst/rtp/gstrtpjpegdepay.c @@ -531,6 +531,13 @@ gst_rtp_jpeg_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp) width = payload[6] * 8; height = payload[7] * 8; + /* saw a packet with fragment offset > 0 and we don't already have data queued + * up (most importantly, we don't have a header for this data) -- drop it + * XXX: maybe we can check if the jpeg is progressive and salvage the data? + * XXX: not implemented yet because jpegenc can't create progressive jpegs */ + if (frag_offset > 0 && gst_adapter_available (rtpjpegdepay->adapter) == 0) + goto no_header_packet; + /* allow frame dimensions > 2040, passed in SDP session or media attributes * from gstrtspsrc.c (gst_rtspsrc_sdp_attributes_to_caps), or in caps */ if (!width) @@ -747,6 +754,12 @@ invalid_packet: gst_adapter_available (rtpjpegdepay->adapter)); return NULL; } +no_header_packet: + { + GST_WARNING_OBJECT (rtpjpegdepay, + "discarding data packets received when we have no header"); + return NULL; + } } |