They share a great deal of common structure; only a few minor
bits in the headers differ.
This also fixes an off-by-one in sending of the last fragment
of large HEVC nals (where it previously sent len+2 bytes, even
if it should have been len+RTP_HEVC_HEADERS_SIZE aka len+3).
Signed-off-by: Martin Storsjö <martin@martin.st>
The packetizer only supports splitting at GOB headers - if
such aren't available frequently enough, it splits at any
random byte offset (not at a macroblock boundary either, which
would be allowed by the spec) and sends a payload header pretend
that it starts with a GOB header.
As long as a receiver doesn't try to handle such cases cleverly
but just drops broken frames, this shouldn't matter too much
in practice.
Signed-off-by: Martin Storsjö <martin@martin.st>
Expose the current sequence number via an AVOption - this can
be used both for setting the initial sequence number, or for
querying the current number.
Signed-off-by: Martin Storsjö <martin@martin.st>
This makes it easier for receivers to decide what to do if data
is lost.
Refactor calculating the max payload size, to avoid hardcoding the
header size in too many places, reducing the number of lines that
have to be touched if the header is adjusted further.
Signed-off-by: Martin Storsjö <martin@martin.st>
This requires all NAL units to fit within single RTP packets. It
doesn't change the actual packetization for packets that fit, but
errors out and gives a helpful hint if the NAL units would have to
be split, and signals the right packetization mode in the SDP.
Signed-off-by: Martin Storsjö <martin@martin.st>
Defining restrict results - for some compilers - in changing other
uses of the restrict keyword also, e.g. __declspec(restrict) gets
changed to __declspec(__restrict) on MSVC. This causes compilation
failures. Therefore, using a private namespace macro instead is
more reliable and robust.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
The private option has not been part of any release yet (and
it is only of use in quite rare cases), so just remove it instead
of keeping it with deprecation warnings.
Signed-off-by: Martin Storsjö <martin@martin.st>
This makes the packetization spec compliant for cases where one single
GOB doesn't fit into an RTP packet.
Signed-off-by: Martin Storsjö <martin@martin.st>
According to newer RFCs, this packetization scheme should only
be used for interfacing with legacy systems.
Implementing this packetization mode properly requires parsing
the full H263 bitstream to find macroblock boundaries (and knowing
their macroblock and gob numbers and motion vector predictors).
This implementation tries to look for GOB headers (which
can be inserted by using -ps <small number>), but if the GOBs
aren't small enough to fit into the MTU, the packetizer blindly
splits packets at any offset and claims it to be a GOB boundary
(by using Mode A from the RFC). While not correct, this seems
to work with some receivers.
Signed-off-by: Martin Storsjö <martin@martin.st>
This is enabled with an AVOption on the RTP muxer. The SDP
generator looks for a latm flag in the rtpflags field.
Signed-off-by: Martin Storsjö <martin@martin.st>