Commit Graph

454 Commits

Author SHA1 Message Date
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ö 54cb096ee4 rtsp: Remove an outdated comment
It is unclear what the bug exactly was and if it ever was fixed,
and we don't even support decoding via faad any longer. The
comment has been present since d0deedcb in 2006.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-12 00:02:11 +02:00
Martin Storsjö 3900d53fb1 rtsp: Remove references to weirdly named variables in other files
One of them is renamed now, but mentioning it by name serves
no purpose here.  The other table mentioned ceased to exist
under that name in 4934884a1 in 2006.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-12 00:02:04 +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ö f811cd2d47 rtsp: Respect max_delay for the reordering queue when using custom IO
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-08 11:22:43 +02:00
Martin Storsjö 8729698d50 rtsp: Recheck the reordering queue if getting a new packet
If we timed out and consumed a packet from the reordering queue,
but didn't return a packet to the caller, recheck the queue status.
Otherwise, we could end up in an infinite loop, trying to consume
a queued packet that has already been consumed.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-08 11:22:37 +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
Luca Barbato 8034130e06 rtp: set the payload type as stream id
Support multiple video/audio streams with different format in the
same session.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-11-14 20:38:51 +01:00
Martin Storsjö f21d5c905d rtsp: Avoid a cast when calling strtol
This gets rid of this warning:

libavformat/rtsp.c: In function ‘rtsp_parse_transport’:
libavformat/rtsp.c:794: warning: cast discards qualifiers from pointer target type

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-10-29 17:47:25 +02:00
Martin Storsjö 2f41eaa9c6 rtsp: Make sure the ret variable is initialized in ff_rtsp_fetch_packet
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-10-20 01:59:06 +03:00
Martin Storsjö 3f055f8f5f rtsp: Allow setting the reordering buffer size via an AVOption
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-10-18 23:10:48 +03:00
Diego Biurrun 11d4e92ed9 avformat: Remove non-compiling and/or silly commented-out printf/av_log statements 2012-10-01 10:24:28 +02:00
Martin Storsjö e6153f173a avopt: Store defaults for AV_OPT_TYPE_INT in the i64 union member
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-04 23:13:44 +03:00
Martin Storsjö d58dd4b5b5 avopt: Store defaults for AV_OPT_TYPE_FLAGS in the i64 union member
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-04 23:13:38 +03:00
Martin Storsjö 124134e424 avopt: Store defaults for AV_OPT_TYPE_CONST in the i64 union member
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-04 23:13:32 +03:00
Martin Storsjö 125c6c0752 rtsp: Free the rtpdec context properly
The condition for calling the rtpdec cleanup was broken in
df8cf076c8.

This fixes a memory leak.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-27 12:29:47 +03:00
Jordi Ortiz e7993ece9b rtsp.c: use ffurl_get_multi_file_handle() instead of ff_rtp_get_rtcp_file_handle()
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-17 22:15:46 +03:00
Martin Storsjö 1243c72251 rtsp: Support mpegts in raw udp packets
This is basically the same way as mpegts packets are parsed in
rtpdec.c.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-09 00:25:57 +03:00
Martin Storsjö df8cf076c8 rtsp: Support receiving plain data over UDP without any RTP encapsulation
EvoStream Media Server can serve data in this format, and
VLC/live555 already supports it.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-09 00:25:15 +03:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Diego Biurrun 6774247a9d avformat: Drop pointless "format" from container long names 2012-07-30 13:59:06 +02:00
Anton Khirnov c4ef6a3e4b Add missing libavutil/time.h includes. 2012-07-28 09:02:07 +02:00
Ronald S. Bultje 5354a904fe rtsp: remove terminal comma in FF_RTP_FLAG_OPTS macro.
This makes usage of the macro look more natural when
used with array entries.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2012-07-21 15:35:01 -04:00
Jordi Ortiz a8ad6ffafe rtsp: Add listen mode
This makes the RTSP demuxer act as a server, listening for an
incoming connection.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-10 22:00:28 +03:00
Jordi Ortiz 6e71c1202b rtsp: Make rtsp_open_transport_ctx() non-static
This is required for the upcoming RTSP listen mode.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-10 21:21:19 +03:00
Jordi Ortiz 45b068580b rtsp: Parse the mode=receive/record parameter in transport lines
We need to support the nonstandard mode=receive, for compatibility
with older libavformat clients.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-10 21:20:04 +03:00
Mans Rullgard 6501dcfb5e Remove unnecessary inclusions of [sys/]time.h
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-20 11:46:46 +01:00
Martin Storsjö bbc8038614 rtsp: Send mode=record instead of mode=receive
This seems to be the correct mode to send, according to the
original RTSP RFC, and matches the method RECORD which is
sent later when starting to send data.

Darwin Streaming Server works fine with either of them.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-18 21:35:28 +03:00
Martin Storsjö 6099543ad4 rtsp: Check for dynamic payload handlers if no static payload mapping was found
Some systems abuse the static payload types 35 or 36 (which
according to IANA are unassigned) for H264.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-05-26 21:58:18 +03:00
Martin Storsjö 68c813081b rtpenc_chain: Return an error code instead of just a plain pointer
Also check the return value in sapenc.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-05-26 13:35:44 +03:00
Jordi Ortiz fcd0298c05 rtsp: Add content-type message header parsing
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-05-08 10:18:35 -07:00
Mans Rullgard ddce7dabd2 rtsp: avoid const warnings from strtol() call
The strtol() interface makes it difficult to use with
const-qualified pointers.  With this change, although
the const is still lost, the compiler does not warn
about it.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-05-06 12:04:25 +01:00
Martin Storsjö 62c3c8ca78 rtsp: Don't use uninitialized data if there are no streams
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-04-08 15:51:32 +03:00
Martin Storsjö 456001486e rtsp: Don't expose the MS-RTSP RTX data stream to the caller
This avoids exposing a dummy AVStream which won't get any data
and which will make avformat_find_stream_info wait for info about
this stream.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-04-08 12:04:22 +03:00
Diego Biurrun a92be9b856 Replace memset(0) by zero initializations.
Also remove one pointless zero initialization in rangecoder.c.
2012-03-28 09:38:33 +02:00
Martin Storsjö ccfa8aa26f rtsp: Set the default delay to 0.1 s for the RTSP/SDP/RTP demuxers
This enables reordering of UDP packets by default, unless the caller
explicitly sets -max_delay 0.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-20 10:53:49 +02:00
Martin Storsjö 4fa57d524f libavformat: Set the default for the max_delay option to -1
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>
2012-03-20 10:53:47 +02:00
Martin Storsjö 17934c1824 cosmetics: Align some AVInput/OutputFormat declarations
Also add missing trailing commas.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-19 14:27:43 +02:00
Martin Storsjö 2f96cc1fc4 rtsp: Retry authentication if failed due to being stale
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-13 10:36:18 +02:00
Martin Storsjö 705eeb5eca rtsp: Fix a typo
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-12 16:27:00 +02:00
Martin Storsjö 6294d708b8 rtsp: Only set the ttl parameter if the server actually gave a value
Passing ttl=0 to the rtp/udp url contexts makes packets never
leave the host machine.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-09 15:04:32 +02:00
Tommy Winther 1a6b9a98ce rtsp: Handle requests from server to client
This returns 200 OK for OPTIONS requests and 501 Not Implemented
for all other requests.

Even though this doesn't do much actual handling of the requests,
it makes the code properly identify server requests as such, instead
of interpreting it as a reply to the client's request as it did
before.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-27 12:04:11 +02:00
Martin Storsjö c2ff63e3ac rtpenc: Move the trailing comma into FF_RTP_FLAG_OPTS
This simplifies adding more flags to the macro.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-23 15:27:42 +02:00
Martin Storsjö 298a587f44 rtp: Factorize the check for distinguishing RTCP packets from RTP
The binary doesn't change after this patch.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-16 17:45:33 +01:00
Martin Storsjö f3a094f2da sdp: Ignore RTCP packets when autodetecting RTP streams
The rtp demuxer which listens for RTP packets and detects the
RTP payload type will currently get confused if the first packet
received is an RTCP packet. Thus ignore such packets.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-16 16:14:35 +01:00
Diego Biurrun a846202343 rtsp: Remove some unused variables from ff_rtsp_connect(). 2012-01-30 10:19:47 +01:00
Alex Converse 7181c4edee cosmetics: Remove extra newlines at EOF 2012-01-27 17:19:09 -08:00
Anton Khirnov adad5b88f8 lavf: remove disabled FF_API_RTSP_URL_OPTIONS cruft 2012-01-27 10:52:43 +01:00