rtph26*depay: drop FU's without a corresponding start bit
authorMatthew Waters <matthew@centricular.com>
Fri, 18 Sep 2020 06:09:20 +0000 (16:09 +1000)
committerSebastian Dröge <slomo@coaxion.net>
Mon, 21 Sep 2020 08:08:38 +0000 (08:08 +0000)
commitea61714c70502240d6564523c7f0f184e4aea3fb
tree6c7e78945b728bcd15f8ee7226c21b7ffe7583db
parent027940a41669699e1020ad7214abaef48ccbb19d
rtph26*depay: drop FU's without a corresponding start bit

If we have not received a FU with a start bit set, any subsequent FU
data is not useful at all and would result in an invalid stream.

This case is constructed from multiple requirements in
RFC 3984 Section 5.8 and RFC 7798 Section 4.4.3.  Following are excerpts
from RFC 3984 but RFC 7798 contains similar language.

The FU in a single FU case is forbidden:

   A fragmented NAL unit MUST NOT be transmitted in one FU; i.e., the
   Start bit and End bit MUST NOT both be set to one in the same FU
   header.

and dropping is possible:

   If a fragmentation unit is lost, the receiver SHOULD discard all
   following fragmentation units in transmission order corresponding to
   the same fragmented NAL unit.

The jump in seqnum case is supported by this from the specification
instead of implementing the forbidden_zero_bit mangling:

   If a fragmentation unit is lost, the receiver SHOULD discard all
   following fragmentation units in transmission order corresponding to
   the same fragmented NAL unit.

   A receiver in an endpoint or in a MANE MAY aggregate the first n-1
   fragments of a NAL unit to an (incomplete) NAL unit, even if fragment
   n of that NAL unit is not received.  In this case, the
   forbidden_zero_bit of the NAL unit MUST be set to one to indicate a
   syntax violation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/730>
gst/rtp/gstrtph264depay.c
gst/rtp/gstrtph264depay.h
gst/rtp/gstrtph265depay.c
gst/rtp/gstrtph265depay.h
tests/check/elements/rtph264.c