summaryrefslogtreecommitdiff
path: root/libavformat/rtpenc.c
Commit message (Collapse)AuthorAge
* cosmetics: Fix spelling mistakesVittorio Giovara2016-05-04
| | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* lavf: replace AVStream.codec with AVStream.codecparAnton Khirnov2016-02-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, AVStream contains an embedded AVCodecContext instance, which is used by demuxers to export stream parameters to the caller and by muxers to receive stream parameters from the caller. It is also used internally as the codec context that is passed to parsers. In addition, it is also widely used by the callers as the decoding (when demuxer) or encoding (when muxing) context, though this has been officially discouraged since Libav 11. There are multiple important problems with this approach: - the fields in AVCodecContext are in general one of * stream parameters * codec options * codec state However, it's not clear which ones are which. It is consequently unclear which fields are a demuxer allowed to set or a muxer allowed to read. This leads to erratic behaviour depending on whether decoding or encoding is being performed or not (and whether it uses the AVStream embedded codec context). - various synchronization issues arising from the fact that the same context is used by several different APIs (muxers/demuxers, parsers, bitstream filters and encoders/decoders) simultaneously, with there being no clear rules for who can modify what and the different processes being typically delayed with respect to each other. - avformat_find_stream_info() making it necessary to support opening and closing a single codec context multiple times, thus complicating the semantics of freeing various allocated objects in the codec context. Those problems are resolved by replacing the AVStream embedded codec context with a newly added AVCodecParameters instance, which stores only the stream parameters exported by the demuxers or read by the muxers.
* Replace av_dlog with normal av_log at trace levelVittorio Giovara2015-04-19
| | | | This applies to every library where performance is not critical.
* rtpenc: Don't set max_frames_per_packet based on the packet frame size or ↵Martin Storsjö2015-02-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | frame rate 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>
* rtpenc: Skip redundant initializationMartin Storsjö2015-02-28
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpenc: Always do the default initialization regardless of codecsMartin Storsjö2015-02-28
| | | | | | | | 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>
* rtpenc_xiph: Don't exclude headers from max_payload_sizeMartin Storsjö2015-02-28
| | | | | | | This makes things more consistent by using the variable in the same way as in all other packetizers. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpenc: Write conditional statements on separate linesMartin Storsjö2015-02-28
| | | | | | | Intentionally keeping some conditional statements on single lines in rtpenc_h263.c. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpenc_aac: Set a default value for max_frames_per_packet at initMartin Storsjö2015-02-28
| | | | | | | This avoids having to conditionally set the default within the packetizer function. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpenc: Merge the h264 and hevc packetizersMartin Storsjö2015-02-24
| | | | | | | | | | | 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>
* rtp: Initial H.261 supportThomas Volkert2014-12-18
| | | | | | | | | | | | | | 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>
* rtpenc: Avoid brittle switch fallthroughsMartin Storsjö2014-12-18
| | | | | | | | | 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>
* rtpenc: Set the AVFMT_TS_NONSTRICT flagMartin Storsjö2014-12-18
| | | | | | | | 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>
* rtpenc: Set the timestamp properly when sending mpegts data, tooMartin Storsjö2014-12-18
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpenc: HEVC/H.265 supportThomas Volkert2014-09-24
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* cosmetics: Write NULL pointer equality checks more compactlyGabriel Dume2014-08-15
| | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* rtpenc: base max_frames_per_packet on avg_frame_rate, not codec timebaseAnton Khirnov2014-06-18
| | | | | Fall back to 1 (which is what is used for most cases anyway) when the framerate is not set.
* rtpenc: Add a rtpflag option for sending BYE packets when finishingMartin Storsjö2013-11-01
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpenc: Remove some superfluous parenthesesMartin Storsjö2013-11-01
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpenc: Simplify code by introducing a macro for rescaling NTP timestampsMartin Storsjö2013-07-31
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* Remove commented-out debug #define cruftDiego Biurrun2013-05-16
|
* rtpenc: Start the sequence numbers from a random offsetMartin Storsjö2013-01-22
| | | | | | | | 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>
* rtpenc: Allow including a SDES/CNAME block in RTCP SR packetsMartin Storsjö2012-12-16
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtp: set the payload type as stream idLuca Barbato2012-11-14
| | | | | | | Support multiple video/audio streams with different format in the same session. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* rtp: Support packetization/depacketization of opusMartin Storsjö2012-10-09
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpenc_vp8: Update the packetizer to the latest spec versionMartin Storsjö2012-10-08
| | | | | | Tested to work with the gstreamer depacketizer. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpenc: Add support for packetizing speexDmitry Samonenko2012-09-26
| | | | | | | 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>
* rtp: Packetization of JPEG (RFC 2435)Samuel Pitoiset2012-09-23
|
* avopt: Store defaults for AV_OPT_TYPE_INT in the i64 union memberMartin Storsjö2012-09-04
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpenc: Remove an av_abort() that depends on user-supplied dataMartin Storsjö2012-08-09
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* Replace all CODEC_ID_* with AV_CODEC_ID_*Anton Khirnov2012-08-07
|
* avformat: Drop pointless "format" from container long namesDiego Biurrun2012-07-30
|
* rtsp: remove terminal comma in FF_RTP_FLAG_OPTS macro.Ronald S. Bultje2012-07-21
| | | | | | | This makes usage of the macro look more natural when used with array entries. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* rtpenc: Support packetizing iLBCMartin Storsjö2012-06-18
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpenc: Fix memory leaks in the muxer open functionMartin Storsjö2012-06-17
| | | | | | Also return a proper error code in these cases. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpenc: Expose the ssrc as an avoptionMartin Storsjö2012-05-26
| | | | | | | This allows the caller to set it, and allows the caller to query what it was set to. Signed-off-by: Martin Storsjö <martin@martin.st>
* cosmetics: Align muxer/demuxer declarationsMartin Storsjö2012-04-06
| | | | | | | 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>
* libavformat: Set the default for the max_delay option to -1Martin Storsjö2012-03-20
| | | | | | | | | | 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>
* rtpenc: Use AVFormatContext.packet_size instead of a private optionMartin Storsjö2012-03-19
| | | | | | | | 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>
* rtpenc: Fix the AVRational used for av_rescale_q_rndMartin Storsjö2012-03-08
| | | | | | | The current one has a zero denominator - this is what was intended in 14aecc50fae6. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpenc: use av_get_audio_frame_duration() for max_frames_per_packetJustin Ruggles2012-03-05
| | | | | It is more reliable than AVCodecContext.frame_size for codecs with constant packet duration.
* rtpenc: Use MB info side data for splitting H263 packets for RFC 2190Martin Storsjö2012-03-01
| | | | | | | 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>
* rtpenc: Fix setting the max packet sizeMartin Storsjö2012-02-29
| | | | | | | 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>
* rtpenc: Expose the max packet size via an avoptionMartin Storsjö2012-02-23
| | | | | | | | | | 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>
* rtpenc: Move max_packet_size to a context variableMartin Storsjö2012-02-23
| | | | | | This is in preparation for exposing this via an avoption. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpenc: Add an option for not sending RTCP packetsMartin Storsjö2012-02-23
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpenc: Add an error messageMartin Storsjö2012-02-23
| | | | | | Also return a proper error code. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpenc: Allow packetizing H263 according to the old RFC 2190Martin Storsjö2012-02-23
| | | | | | | | | | | | | | | | | | 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>
* rtpenc: Move the trailing comma into FF_RTP_FLAG_OPTSMartin Storsjö2012-02-23
| | | | | | This simplifies adding more flags to the macro. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpenc: Write a log message if the max packet size is too smallMartin Storsjö2012-02-10
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>