Commit Graph

201 Commits

Author SHA1 Message Date
Michael Niedermayer 9c9d2e9c77 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  rtpdec: Fix the alphabetical ordering in registering depacketizers

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-07 10:17:20 +02:00
Martin Storsjö aa2c918f7d rtpdec: Fix the alphabetical ordering in registering depacketizers
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-06-06 19:56:05 +03:00
Michael Niedermayer 2653e12520 Merge commit '1afddbe59e96af75f1c07605afc95615569f388f'
* commit '1afddbe59e96af75f1c07605afc95615569f388f':
  avpacket: use AVBuffer to allow refcounting the packets.

Conflicts:
	libavcodec/avpacket.c
	libavcodec/utils.c
	libavdevice/v4l2.c
	libavformat/avidec.c
	libavformat/flacdec.c
	libavformat/id3v2.c
	libavformat/matroskaenc.c
	libavformat/mux.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-08 19:12:03 +01:00
Anton Khirnov 1afddbe59e avpacket: use AVBuffer to allow refcounting the packets.
This will allow us to avoid copying the packets in many cases.

This breaks ABI.
2013-03-08 07:33:45 +01:00
Michael Niedermayer fd464d4d01 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  rtpdec: Initialize some variables to silence compiler warnings

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-03 11:40:37 +01:00
Martin Storsjö 8fbab7a6c8 rtpdec: Initialize some variables to silence compiler warnings
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>
2013-03-02 21:23:52 +02:00
Michael Niedermayer acc0c0190b Merge commit 'f53490cc0c809975f8238d5a9edbd26f83bd2f84'
* commit 'f53490cc0c809975f8238d5a9edbd26f83bd2f84':
  rtpdec/srtp: Handle CSRC fields being present
  rtpdec: Check the return value from av_new_packet
  ac3dec: fix non-optimal dithering of zero bit mantissas

Conflicts:
	libavcodec/ac3dec.c
	libavformat/rtpdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-21 14:55:48 +01:00
Michael Niedermayer 0a5da9cc14 Merge commit 'c6f1dc8e4cd967ae056698eafb891a08003c211c'
* commit 'c6f1dc8e4cd967ae056698eafb891a08003c211c':
  rtpdec: Move setting the parsing flags to the actual depacketizers
  rtpdec: Split handling of mpeg12 audio/video to a separate depacketizer

Conflicts:
	libavformat/rtpdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-21 14:02:01 +01:00
Michael Niedermayer 950482bf58 Merge commit '2326558d5277ec87ba6d607a01ec6acfc51c694c'
* commit '2326558d5277ec87ba6d607a01ec6acfc51c694c':
  rtpdec: Split mpegts parsing to a normal depacketizer
  rtpdec: Reorder payload handler registration alphabetically

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-21 13:52:42 +01:00
Martin Storsjö f53490cc0c rtpdec/srtp: Handle CSRC fields being present
This is untested in practice, but follows the spec.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-21 00:10:47 +02:00
Martin Storsjö a76bc3bc44 rtpdec: Check the return value from av_new_packet
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-21 00:08:19 +02:00
Martin Storsjö c6f1dc8e4c rtpdec: Move setting the parsing flags to the actual depacketizers
This gets rid of almost all the codec specific details from the
generic rtpdec code.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-20 18:20:42 +02:00
Martin Storsjö a9c847c1ba rtpdec: Split handling of mpeg12 audio/video to a separate depacketizer
This also adds checking of mallocs.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-20 18:20:22 +02:00
Martin Storsjö 2326558d52 rtpdec: Split mpegts parsing to a normal depacketizer
This gets rid of a number of special cases from the common rtpdec
code.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-20 18:17:17 +02:00
Martin Storsjö d5bb8cc2dd rtpdec: Reorder payload handler registration alphabetically
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-20 18:16:04 +02:00
Michael Niedermayer 918b411636 rtpdec: support CSRC
Untested, due to lack of rtp stream with CSRCs, but the code as
is does not work with multiple CSRCs

Reviewed-by: Luca Abeni <lucabe72@email.it>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-15 16:20:31 +01:00
Michael Niedermayer b52925d2cd Merge commit '2f3bada63e57345329c4f9b48e9b81b5cfc03d05'
* commit '2f3bada63e57345329c4f9b48e9b81b5cfc03d05':
  lavf: Add a protocol for SRTP encryption/decryption
  rtsp: Support decryption of SRTP signalled via RFC 4568 (SDES)

Conflicts:
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-15 16:05:34 +01:00
Michael Niedermayer 8686b6c68b Merge commit 'ba0c72a9ae1e2954e5dcf920f7b4e9a8f8a22f3e'
* commit 'ba0c72a9ae1e2954e5dcf920f7b4e9a8f8a22f3e':
  build: Remove stray Makefile entry for non-existent VCR1 encoder
  rtpdec: Handle more received packets than expected when sending RR

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-15 14:42:24 +01:00
Michael Niedermayer eaf1f01169 Merge commit 'd0fe217e3990b003b3b3f2c2daaadfb2af590def'
* commit 'd0fe217e3990b003b3b3f2c2daaadfb2af590def':
  rtpdec: Simplify insertion into the linked list queue
  rtpdec: Remove a woefully misplaced comment

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-15 14:34:32 +01:00
Martin Storsjö 424da30830 rtsp: Support decryption of SRTP signalled via RFC 4568 (SDES)
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>
2013-01-15 11:54:40 +02:00
Martin Storsjö 30b50f79ae rtpdec: Handle more received packets than expected when sending RR
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>
2013-01-14 17:52:02 +02:00
Martin Storsjö d0fe217e39 rtpdec: Simplify insertion into the linked list queue
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>
2013-01-14 17:51:48 +02:00
Martin Storsjö 62761934b0 rtpdec: Remove a woefully misplaced comment
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>
2013-01-14 17:51:42 +02:00
Michael Niedermayer 3bcf443f91 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  rtpdec: Send a valid "delay since SR" value in the RTCP RR packets

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-13 14:06:01 +01:00
Michael Niedermayer 6cd1dbe6df Merge commit 'e568db40258d549777ac1c16971678e18a18f5f5'
* commit 'e568db40258d549777ac1c16971678e18a18f5f5':
  rtpdec: Calculate and report packet reception jitter

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-13 14:00:12 +01:00
Michael Niedermayer 6d6eb7c12c Merge commit 'abae27ed3acd0a7c54f11760c5be2d2653c4edf8'
* commit 'abae27ed3acd0a7c54f11760c5be2d2653c4edf8':
  rtpdec: Fix the calculation of expected number of packets
  fate: vp3: Fix fate-vp3-coeff-level64 test dependencies

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-13 13:54:52 +01:00
Martin Storsjö 22c436c85e rtpdec: Send a valid "delay since SR" value in the RTCP RR packets
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>
2013-01-12 19:55:49 +02:00
Martin Storsjö e568db4025 rtpdec: Calculate and report packet reception jitter
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>
2013-01-12 19:53:53 +02:00
Martin Storsjö abae27ed3a rtpdec: Fix the calculation of expected number of packets
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>
2013-01-12 19:48:41 +02:00
Michael Niedermayer 15daa8f9dd Merge commit 'f61272f0efd80da437570aad2c40e00f9d3f4fe6'
* commit 'f61272f0efd80da437570aad2c40e00f9d3f4fe6':
  ratecontrol: K&R cosmetic formatting
  rtpdec: Remove a useless todo comment

Conflicts:
	libavcodec/ratecontrol.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-12 13:32:13 +01:00
Martin Storsjö f6804c3e1b rtpdec: Remove a useless todo comment
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>
2013-01-12 00:02:17 +02:00
Michael Niedermayer ac6e074fb7 Merge commit 'ed79093222ceb42f0c3a39095a69af0b32be5450'
* commit 'ed79093222ceb42f0c3a39095a69af0b32be5450':
  rtpdec: Add a terminating null byte at the end of the SDES/CNAME
  yuv4mpeg: do not use deprecated functions
  oggdec: fix faulty cleanup prototype
  idcin: return 0 from idcin_read_packet() on success.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-10 12:57:08 +01:00
Martin Storsjö ed79093222 rtpdec: Add a terminating null byte at the end of the SDES/CNAME
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>
2013-01-10 09:40:49 +02:00
Michael Niedermayer 34c1c08c66 Merge commit '86d9181cf41edc3382bf2481f95a2fb321058689'
* commit '86d9181cf41edc3382bf2481f95a2fb321058689':
  rtpdec: Support sending RTCP feedback packets

Conflicts:
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-09 11:48:14 +01:00
Michael Niedermayer 8c3ae9ee66 Merge commit '42805eda554a7fc44341282771531e7837ac72b7'
* commit '42805eda554a7fc44341282771531e7837ac72b7':
  rtpdec: Store the dynamic payload handler in the rtpdec context

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-09 11:42:01 +01:00
Martin Storsjö 86d9181cf4 rtpdec: Support sending RTCP feedback packets
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>
2013-01-08 17:48:14 +02:00
Martin Storsjö 42805eda55 rtpdec: Store the dynamic payload handler in the rtpdec context
This allows calling other dynamic payload handler functions if
needed.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-08 17:47:27 +02:00
Michael Niedermayer 8d0b2aae71 Merge commit 'e96406eda4f143f101bd44372f7b2d542183000a'
* commit 'e96406eda4f143f101bd44372f7b2d542183000a':
  rtsp: Add support for depacketizing RTP data via custom IO

Conflicts:
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-04 13:23:19 +01:00
Michael Niedermayer ea96feddb7 Merge commit '3f95f0dda55fca74b646937095a02a8fa9776622'
* commit '3f95f0dda55fca74b646937095a02a8fa9776622':
  rtpdec: Move the URLContext used for RTCP RR out from the context, to a parameter

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-04 13:13:30 +01:00
Martin Storsjö e96406eda4 rtsp: Add support for depacketizing RTP data via custom IO
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>
2013-01-03 15:15:27 +02:00
Martin Storsjö 3f95f0dda5 rtpdec: Move the URLContext used for RTCP RR out from the context, to a parameter
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-03 15:14:34 +02:00
Michael Niedermayer bb3420d88e Merge commit '90c784cc13f6bf21a8eb69f3b88b50c7a70f6c59'
* commit '90c784cc13f6bf21a8eb69f3b88b50c7a70f6c59':
  rtpdec: Pass the sequence number to depacketizers
  configure: Make avconv depend on null, anull and resample filters

Conflicts:
	configure

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-21 17:46:43 +01:00
Martin Storsjö 90c784cc13 rtpdec: Pass the sequence number to depacketizers
This allows depacketizers to figure out if packets have been lost.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-12-21 14:14:40 +02:00
Michael Niedermayer de7c95d551 Merge commit '7941159df6aad2d219e2a7184489be7a735dd944'
* commit '7941159df6aad2d219e2a7184489be7a735dd944':
  rtpdec/enc: Remove outdated/useless/misleading comments
  rtpdec: Improve some comments
  rtpdec: Remove unused context variables
  rtpdec: Limit writing to the buffer size
  svq1: Fix building with -DDEBUG
  svq1: return meaningful error codes.

Conflicts:
	libavcodec/svq1dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-13 12:06:19 +01:00
Martin Storsjö 81ef519252 rtpdec: Limit writing to the buffer size
This fixes potential buffer overwrites.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-12-12 12:18:16 +02:00
Michael Niedermayer 6321e02896 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  rtpdec: Remove an outdated todo comment
  rtpdec: Rename a static variable to normal naming conventions
  sh4: dsputil: remove duplicate of ff_gmc_c()

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-10 12:13:42 +01:00
Martin Storsjö ccb59c106a rtpdec: Remove an outdated todo comment
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>
2012-12-10 11:58:32 +02:00
Martin Storsjö 0d85663a47 rtpdec: Rename a static variable to normal naming conventions
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-12-10 11:58:25 +02:00
Michael Niedermayer 78ac7ee970 Merge commit '5d471b73d20616f5ac701ff62e5de49465cda264'
* commit '5d471b73d20616f5ac701ff62e5de49465cda264':
  rtpdec: K&R formatting and spelling cosmetics
  cosmetics: Fix dropable --> droppable typo

Conflicts:
	libavcodec/h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-10 01:27:10 +01:00
Martin Storsjö 5d471b73d2 rtpdec: K&R formatting and spelling cosmetics
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2012-12-09 13:36:11 +01:00