Instead check the timestamps while muxing, to avoid buffering a
too long timestamp range into one single packet.
This makes the AMR and AAC packetization slightly less efficient,
since we set a possibly unnecessarily high max_frames_per_packet.
(These packetizers end up doing a memmove of the TOC bytes if
sending a packet before max_frames_per_packet is achieved, and
we end up setting max_frames_per_packet to a value that should
be high enough for most uses.)
All packetizers that use max_frames_per_packet now set it either
to a default value, or to a value calculated based on other
parameters, so none of them rely on the previous default setting.
For iLBC, copy one frame at a time, to allow checking the timestamp
range for each of them - basically doing potentially multiple
loops to simplify the code instead of trying to calculate the
number of frames to buffer while honoring s1->max_delay.
This is in preparation for reducing the coupling between libavformat
and libavcodec, by not having the muxers use the encoder field
frame_size (which may not be available during e.g. stream copy).
Signed-off-by: Martin Storsjö <martin@martin.st>
This avoids having to jump to the defaultcase in the switch. Manually
override the stream time base back to 90 kHz for the few audio codecs
that don't use the sample rate as time base (mp2, mp3).
Signed-off-by: Martin Storsjö <martin@martin.st>
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>
Instead explicitly jump to the default case in the cases where
it is wanted, and avoid fallthrough between different codecs,
which could easily introduce bugs if people editing the code
aren't careful.
Signed-off-by: Martin Storsjö <martin@martin.st>
In particular, when packetizing mpegts into rtp, the input packet
timestamp may come from more than one stream, which could cause
multiple packets be written with the same timestamp.
Signed-off-by: Martin Storsjö <martin@martin.st>
For muxing, it accepts
both 0 and AV_NOPTS_VALUE. For demuxing, it will present
AV_NOPTS_VALUE when start_time_realtime is unknown.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
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 packetization scheme simply places the full packets into the
RTP packet without any extra header bytes.
Signed-off-by: Martin Storsjö <martin@martin.st>
* libspeex audio codec is no longer considered unsupported
when using rtp as output format.
* SDP rtpmap is added for speex payload, formatted according to RFC
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Also add missing trailing commas, break long codec_tag lines and
add spaces in codec_tag declarations.
Signed-off-by: Martin Storsjö <martin@martin.st>
Make the muxers/demuxers that use the field handle the default
-1 in the same way as 0.
This allows distinguishing an intentionally set 0 from the default
value where the user hasn't set it.
Signed-off-by: Martin Storsjö <martin@martin.st>
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>
This fixes cases where the user had specified one desired MTU
via an option, and the protocol indicates another one.
Signed-off-by: Martin Storsjö <martin@martin.st>
This allows opting for a lower MTU than what the AVIOContext
indicated, and allows writing into outputs that don't indicate
an MTU at all (such as plain files, which is useful for testing).
This also allows querying for the MTU via the avoption.
Signed-off-by: Martin Storsjö <martin@martin.st>