Commit Graph

55 Commits

Author SHA1 Message Date
Martin Storsjö
b7e6da988b rtpproto: Move rtpproto specific function declarations to a separate header
Mixing these with the rtp depacketizer functions in rtpdec.h is
no good.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-31 21:12:34 +03:00
Andrew Van Til
0e729b2290 rtpdec: Increase max rtp packet size to 8192
This fixes connecting to "Ceton InfiniTV4 PCIe & USB".

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-04-09 10:36:56 +03: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ö
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ö
d596f2b322 rtpdec: Make variables that should wrap unsigned
This makes the behaviour defined when they wrap around. The value
assigned to expected_prior was a uint32_t already.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-14 20:09:42 +02: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ö
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
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
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
Martin Storsjö
584a017925 rtpdec: Cosmetic cleanup of the header
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-12-12 12:18:44 +02:00
Martin Storsjö
abf74a1169 rtpdec: Get rid of a useless _s suffix on a struct name
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-12-12 12:18:38 +02:00
Martin Storsjö
7941159df6 rtpdec/enc: Remove outdated/useless/misleading comments
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-12-12 12:18:33 +02:00
Martin Storsjö
d6ec745246 rtpdec: Improve some comments
The previous comment about the buffer was wildly inaccurate and
misleading.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-12-12 12:18:28 +02:00
Martin Storsjö
e66d448c75 rtpdec: Remove unused context variables
These stem from back when both the rtp muxer and rtp depacketizing
shared the same struct.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-12-12 12:18:22 +02:00
Anton Khirnov
179a5c37e0 rtpdec: factorize identical code used in several handlers 2012-11-02 07:58:37 +01:00
Diego Biurrun
e4cbf7529b Give all anonymously typedeffed structs in headers a name
Anonymous structs cannot be forward declared and have no benefit.
2012-10-06 09:27:11 +02:00
Jordi Ortiz
a2dd4f7780 rtp: remove ff_rtp_get_rtcp_file_handle().
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-17 22:15:56 +03:00
Anton Khirnov
36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Martin Storsjö
2583660664 rtpdec: Add an init function that can do custom codec context initialization
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-30 17:32:18 +02:00
John Brooks
12348ca25e rtpdec: unwrap RTP timestamps for PTS calculation
The timestamp field in RTPDemuxContext was unused before this.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-18 10:31:17 +02:00
Martin Storsjö
bfc6db4477 rtpdec: Add ff_ prefix to all nonstatic symbols
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-12 14:48:12 +03:00
Martin Storsjö
9261e6cf3f rtp: Rename the open/close functions to alloc/free
This avoids clashes if we internally want to override the global
open function.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-04-24 00:05:37 +03:00
Anton Khirnov
c486dade95 avio: make URLContext internal. 2011-04-08 15:59:19 +02:00
Mans Rullgard
2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Diego Elio Pettenò
119cc033fc Make RTPFirstDynamicPayloadHandler static to rtpdec.c
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-01-25 01:45:34 +00:00
Martin Storsjö
3a1cdcc798 rtpdec: Emit timestamps for packets before the first RTCP packet, too
Emitted timestamps in each stream start from 0, for the first received
RTP packet. Once an RTCP packet is received, that one is used for
sync, emitting timestamps that fit seamlessly into the earlier ones.

Originally committed as revision 26187 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-01 22:27:16 +00:00
Martin Storsjö
1e515c4280 rtpdec: Add functions for finding depacketizers by name or payload id
Originally committed as revision 25891 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-12-05 19:39:50 +00:00
Martin Storsjö
2beb910d79 rtpdec: Allow dynamic payload handlers to handle static payload types, too
Originally committed as revision 25890 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-12-05 19:38:55 +00:00
Aurelien Jacobs
a178edf298 drop rtp_get_file_handles() which is not part of public API and not used anymore
Originally committed as revision 25556 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-23 16:21:49 +00:00
Aurelien Jacobs
fb660f4015 drop rtp_get_local_port() which is not part of public API and not used anymore
Originally committed as revision 25555 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-23 16:20:56 +00:00
Martin Storsjö
58ee09911e rtpdec: Reorder received RTP packets according to the seq number
Reordering is enabled only when receiving over UDP.

Originally committed as revision 25294 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-01 17:50:24 +00:00
Martin Storsjö
ad4ad27fb6 rtsp/rtpdec: Allow rtp_parse_packet to take ownership of the packet buffer
Do the same change for ff_rdt_parse_packet, too, to keep the interfaces
similar.

Originally committed as revision 25289 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-01 17:43:27 +00:00
Josh Allmann
186f1ec5f4 Add rtp_get_rtcp_file_handle function
Patch by Josh Allmann, joshua dot allmann at gmail

Originally committed as revision 24929 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-08-25 17:32:59 +00:00
Martin Storsjö
1537817e38 Move SPACE_CHARS back to libavformat/internal.h
It will be used by other parts of lavf now. This reverts svn rev 23846.

Originally committed as revision 24265 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-07-16 14:12:52 +00:00
Martin Storsjö
d74c6145fb rtpdec: Allow depacketizers to specify that pkt->pts should be left as AV_NOPTS_VALUE
Originally committed as revision 24234 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-07-14 12:26:16 +00:00
Josh Allmann
016bc031eb rtpdec: Add generic function for iterating over FMTP configuration lines
This will be used for cleaning up code that is common among RTP depacketizers.

Patch by Josh Allmann, joshua dot allmann at gmail

Originally committed as revision 23847 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-06-28 11:24:12 +00:00
Josh Allmann
8b114d85ba rtpdec: Move space_chars from avformat/internal to rtpdec
Patch by Josh Allmann, joshua dot allmann at gmail

Originally committed as revision 23846 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-06-28 11:21:34 +00:00
Josh Allmann
ca937a5508 RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp
Patch by Josh Allmann, joshua dot allmann at gmail

Originally committed as revision 23772 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-06-25 08:02:50 +00:00
Martin Storsjö
5948f82227 Reset RTCP timestamps after seeking, add range start offset to the packets timestamps
If these aren't reset, the timestamps make a huge jump when the next RTCP
is received.

Originally committed as revision 22918 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-04-20 07:38:52 +00:00
Martin Storsjö
2cab6b48ad Revert svn rev 21857, readd first_rtcp_ntp_time in RTPDemuxContext
In order to sync RTP streams that get their initial RTCP timestamp at
different times, propagate the NTP timestamp of the first RTCP packet
to all other streams.

This makes the timestamps of returned packets start at (near) zero instead
of at any random offset.

Originally committed as revision 22917 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-04-20 07:34:28 +00:00
Luca Barbato
9094d867aa Make rtp protocol obey rfc3550
Originally committed as revision 22906 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-04-19 11:40:45 +00:00
Martin Storsjö
0e4b185a8d Fix leaks in the AAC RTP depacketizer
Originally committed as revision 22804 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-04-05 17:25:39 +00:00
Ronald S. Bultje
1da1e1933f Add void to a function prototype that takes no arguments. Fixes a potential
compiler warning.

Originally committed as revision 22803 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-04-05 16:13:51 +00:00
Stefano Sabatini
72415b2adb Define AVMediaType enum, and use it instead of enum CodecType, which
is deprecated and will be dropped at the next major bump.

Originally committed as revision 22735 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-30 23:30:55 +00:00
Ronald S. Bultje
3307e6ea86 Prefix non-static RTSP functions with ff_.
Originally committed as revision 21974 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-23 00:35:50 +00:00
Ronald S. Bultje
fc78b0cb7e Remove first_rtcp_ntp_time. This is used to prevent overflow of the timestamp,
but doesn't actually do that. What's worse, it creates timestamp adjustments
that are different per stream within a session, leading to a/v sync issues.

See discussion in thread "[FFmpeg-devel] rtp streaming x264+audio issues (and
some ideas to fix them)". Patch suggested by Luca Abeni <lucabe72 email it>.

Originally committed as revision 21857 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-16 23:00:03 +00:00
Martin Storsjö
9c8fa20d7e When using RTP-over-UDP, send dummy packets during stream setup, similar to
what e.g. RealPlayer does. This allows proper port forwarding setup in NAT-
based environments.

Patch by Martin Storsjö <$firstname at $firstname dot st>.

Originally committed as revision 21856 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-16 22:50:50 +00:00
Ronald S. Bultje
f0a8039464 Add url_get_file_handle(), which is used to get the file descriptor
associated with the I/O handle (e.g. the fd returned by open()). See
"[RFC] rtsp.c EOF support" thread.

There were previously some URI-specific implementations of the same idea,
e.g. rtp_get_file_handles() and udp_get_file_handle(). All of these are
deprecated by this patch and will be removed at the next major API bump.

Originally committed as revision 17779 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-03-03 17:04:51 +00:00