summaryrefslogtreecommitdiff
path: root/libavformat/rtpdec.c
Commit message (Collapse)AuthorAge
* rtpdec: Always check if we have the next packet queuedMartin Storsjö2016-05-11
| | | | | | | | | | It doesn't matter what the actual reason for not returning an AVPacket was - if we didn't return any packet and we have the next one queued, parse it immediately. (rtp_parse_queued_packet always consumes a queued packet if one exists, so there's no risk for infinite loops.) Signed-off-by: Martin Storsjö <martin@martin.st>
* 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.
* rtpdec: Use the right logging contextDiego Biurrun2016-02-19
|
* rtpdec: Forward the memory failureLuca Barbato2015-09-16
| | | | | | And avoid a memory leak. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* rtpdec: inform jitter buffer sizeEloi BAIL2015-09-16
| | | | | | | | This commit print as AV_LOG_VERBOSE the jitter buffer size. It might be the default value or the value set by application. Signed-off-by: Eloi BAIL <eloi.bail@savoirfairelinux.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: add a trace when jitter buffer is fullEloi BAIL2015-09-16
| | | | | | | | This commit adds a warning trace when jitter buffer is full. It helps to understand leading decoding issues. Signed-off-by: Eloi BAIL <eloi.bail@savoirfairelinux.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* Replace av_dlog with normal av_log at trace levelVittorio Giovara2015-04-19
| | | | This applies to every library where performance is not critical.
* rtpdec: experimental VP9 depacketizer (draft 0)Thomas Volkert2015-03-05
| | | | | | The code was tested with live555 server. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Don't pass non-const pointers to fmtp attribute parsing functionsMartin Storsjö2015-02-24
| | | | | | | This makes it clear that the individual parsing functions can't touch the parsed out value. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Change enc_name to a pointer instead of a fixed-size bufferMartin Storsjö2015-02-24
| | | | | | | This avoids allocating space for a too large buffer for all the name strings. Signed-off-by: Martin Storsjö <martin@martin.st>
* libavformat: add T.140 RTP depacketization (RFC 4103)Gilles Chanteperdrix2015-02-24
| | | | | | Map this to AV_CODEC_ID_TEXT. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: DV depacketizer (RFC 6469)Thomas Volkert2015-02-22
| | | | | | (tested with live555 RTSP server) Signed-off-by: Martin Storsjö <martin@martin.st>
* libavformat: add robust MPEG audio depacketization (RFC 5219)Gilles Chanteperdrix2015-02-21
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* libavformat: add AC3 RTP depacketization (RFC 4184)Gilles Chanteperdrix2015-02-21
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: fix issue with conversion from unsigned to signedGilles Chanteperdrix2015-02-21
| | | | | | | | | | | | | When receiving an RTCP packet, the difference between the last RTCP timestamp and the base timestamp may be negative. As these timestamps are of the uint32_t type, the result becomes a large integer. Cast the difference to int32_t to avoid this issue. The result of this issue is very large start times for RTSP streams, and difficulty to restart correctly after a pause. Signed-off-by: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> 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>
* lavf: Use av_gettime_relativeMartin Storsjö2014-10-24
| | | | | | | | | The ones left using av_gettime are NTP timestamps (for RTCP, which is specified to send the actual current realtime clock in RTCP SR packets), and the NUT muxer timestamper, which is documented as using wallclock time. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec_hevc: Drop a duplicated, nonstandard entryVittorio Giovara2014-09-24
| | | | | | | | | | | | | | | | | | The RFC spec draft only specifies the "H265" name - there is no specification saying how to interpret "HEVC" (if such a packet format is specified it could be an entirely different format). Since this is a very new standard (still a draft), there is little need for compatibility with existing, broken implementations. Therefore remove the extra alias, to avoid the risk of encouraging incorrect usage. Intentionally keeping the ff_hevc_dynamic_handler name for the handler, to use "hevc" consistently as name for the codec instead of "h265" within the library internals as long as there only is one single variant in actual use. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: HEVC/H.265 supportThomas Volkert2014-09-03
| | | | | | As specified in draft-ietf-payload-rtp-h265-06. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* rtpdec: pass an AVFormatContext to ff_parse_fmtp()Anton Khirnov2014-07-09
| | | | Use it for logging, instead of NULL or the stream codec context.
* lavf: do not export av_register_{rtp,rdt}_dynamic_payload_handlers from ↵Anton Khirnov2013-10-28
| | | | shared objects
* rtpdec: Fix the alphabetical ordering in registering depacketizersMartin Storsjö2013-06-06
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* avpacket: use AVBuffer to allow refcounting the packets.Anton Khirnov2013-03-08
| | | | | | This will allow us to avoid copying the packets in many cases. This breaks ABI.
* rtpdec: Initialize some variables to silence compiler warningsMartin Storsjö2013-03-02
| | | | | | | | The warnings are false positives, older gcc versions (such as 4.5) think the variables can be used uninitialized while they in practice can't, while newer (4.6) gets it right. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec/srtp: Handle CSRC fields being presentMartin Storsjö2013-01-21
| | | | | | This is untested in practice, but follows the spec. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Check the return value from av_new_packetMartin Storsjö2013-01-21
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Move setting the parsing flags to the actual depacketizersMartin Storsjö2013-01-20
| | | | | | | This gets rid of almost all the codec specific details from the generic rtpdec code. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Split handling of mpeg12 audio/video to a separate depacketizerMartin Storsjö2013-01-20
| | | | | | This also adds checking of mallocs. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Split mpegts parsing to a normal depacketizerMartin Storsjö2013-01-20
| | | | | | | This gets rid of a number of special cases from the common rtpdec code. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Reorder payload handler registration alphabeticallyMartin Storsjö2013-01-20
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: Support decryption of SRTP signalled via RFC 4568 (SDES)Martin Storsjö2013-01-15
| | | | | | | | | | | | | | This only takes care of decrypting incoming packets; the outgoing RTCP packets are not encrypted. This is enough for some use cases, and signalling crypto keys for use with outgoing RTCP packets doesn't fit as simply into the API. If the SDP demuxer is hooked up with custom IO, the return packets can be encrypted e.g. via the SRTP protocol. If the SRTP keys aren't available within the SDP, the decryption can be handled externally as well (when using custom IO). Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Handle more received packets than expected when sending RRMartin Storsjö2013-01-14
| | | | | | | | | | Without this, we'd signal a huge loss rate (due to unsigned wraparound) if we had received one packet more than expected (that is, one seq number sent twice). The code has a check for lost_interval <= 0, but that doesn't do what was intended as long as the variable is unsigned. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Simplify insertion into the linked list queueMartin Storsjö2013-01-14
| | | | | | | By using a pointer-to-pointer, we avoid having to keep track of the previous packet separately. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Remove a woefully misplaced commentMartin Storsjö2013-01-14
| | | | | | | | The code below the comment does not at all relate to statistics, and even if moved to the right place, the comment adds little value. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Send a valid "delay since SR" value in the RTCP RR packetsMartin Storsjö2013-01-12
| | | | | | | | | | | Previously, we always signalled a zero time since the last RTCP SR, which is dubious. The code also suggested that this would be the difference in RTP NTP time units (32.32 fixed point), while it actually is in in 1/65536 second units. (RFC 3550 section 6.4.1) Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Calculate and report packet reception jitterMartin Storsjö2013-01-12
| | | | | | | | | This brings back some code that was added originally in 4a6cc061 but never was used, and was removed as unused in 4cc843fa. The code is updated to actually work and is tested to return sane values. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Fix the calculation of expected number of packetsMartin Storsjö2013-01-12
| | | | | | | | | The base_seq variable is set to first_seq - 1 (in rtp_init_sequence), so no + 1 is needed here. This avoids reporting 1 lost packet from the start. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Remove a useless todo commentMartin Storsjö2013-01-12
| | | | | | | | | The question can be answered: No, we do not know the initial sequence number from the SDP. In certain cases, it can be known from the RTP-Info response header in RTSP though. (In that case, we use it as timestamp origin, but not for rtp receiver statistics.) Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Add a terminating null byte at the end of the SDES/CNAMEMartin Storsjö2013-01-10
| | | | | | | | | | | | | | | | This is required by RFC 3550 (section 6.5): The list of items in each chunk MUST be terminated by one or more null octets, the first of which is interpreted as an item type of zero to denote the end of the list. This was implicitly added as padding before, unless the host name length matched up so no padding was added. This makes wireshark parse the packets properly if other RTCP items are appended to the same packet. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Support sending RTCP feedback packetsMartin Storsjö2013-01-08
| | | | | | | | | | | | | | | | | | | | | This sends NACK for missed packets and PLI (picture loss indication) if a depacketizer indicates that it needs a new keyframe, according to RFC 4585. This is only enabled if the SDP indicated that feedback is supported (via the AVPF or SAVPF profile names). The feedback packets are throttled to a certain maximum interval (currently 250 ms) to make sure the feedback packets don't eat up too much bandwidth (which might be counterproductive). The RFC specifies a more elaborate feedback packet scheduling. The feedback packets are currently sent independently from normal RTCP RR packets, which is not totally spec compliant, but works fine in the environments I've tested it in. (RFC 5506 allows this, but requires a SDP attribute for enabling it.) Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Store the dynamic payload handler in the rtpdec contextMartin Storsjö2013-01-08
| | | | | | | This allows calling other dynamic payload handler functions if needed. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtsp: Add support for depacketizing RTP data via custom IOMartin Storsjö2013-01-03
| | | | | | | | | | | | | | | | | | To use this, set sdpflags=custom_io to the sdp demuxer. During the avformat_open_input call, the SDP is read from the AVFormatContext AVIOContext (ctx->pb) - after the avformat_open_input call, during the av_read_frame() calls, the same ctx->pb is used for reading packets (and sending back RTCP RR packets). Normally, one would use this with a read-only AVIOContext for the SDP during the avformat_open_input call, then close that one and replace it with a read-write one for the packets after the avformat_open_input call has returned. This allows using the RTP depacketizers as "pure" demuxers, without having them tied to the libavformat network IO. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Move the URLContext used for RTCP RR out from the context, to a ↵Martin Storsjö2013-01-03
| | | | | | parameter Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Pass the sequence number to depacketizersMartin Storsjö2012-12-21
| | | | | | This allows depacketizers to figure out if packets have been lost. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Limit writing to the buffer sizeMartin Storsjö2012-12-12
| | | | | | This fixes potential buffer overwrites. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Remove an outdated todo commentMartin Storsjö2012-12-10
| | | | | | | | | | | | This comment was added in e309128f, in 2002, and has been brought along since then more or less unmodified. The first point of the todo was implemented in dbf30963 in 2006, the second one is not relevant to rtpdec.c (brought along from rtp.c in 8eb793c4 in 2008) but would be more relevant to the rtp muxer, although it isn't a good idea anyway. Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: Rename a static variable to normal naming conventionsMartin Storsjö2012-12-10
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* rtpdec: K&R formatting and spelling cosmeticsMartin Storsjö2012-12-09
| | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* rtpdec: factorize identical code used in several handlersAnton Khirnov2012-11-02
|