1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

654 Commits

Author SHA1 Message Date
Martin Storsjö
f8a13c7213 lavf/rtsp: Fix a crash with the RTSP muxer.
Introduced in 00e122bc / bc2a3296
The whole block that the statement was added to is only
relevant when used as a demuxer, but the other statements
there have had other if statements guarding them. Make
sure to only run this whole block if being used as a
demuxer.

Fixes ticket #5844.
2016-09-15 13:50:57 +02:00
Andreas Cadhalpun
a16018461b lavf: forward protocol_whitelist for the remaining cases
Also set a default_whitelist for mmsh and ffrtmphttp.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-05 16:18:49 +02:00
Hendrik Leppkes
f972653ec1 Merge commit '3fdffc032e8ea5676bc0c2551b900c0dc887835b'
* commit '3fdffc032e8ea5676bc0c2551b900c0dc887835b':
  rtsp: Use avcodec_descriptor_get instead of avcodec_find_decoder

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-06-26 14:51:33 +02:00
Clément Bœsch
00e122bc0f Merge commit 'bc2a32969eb4db17677971def5ad5b936d9d1648'
* commit 'bc2a32969eb4db17677971def5ad5b936d9d1648':
  rtsp: Parse SSRC attributes in the SDP

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 22:26:44 +02:00
Martin Storsjö
3fdffc032e rtsp: Use avcodec_descriptor_get instead of avcodec_find_decoder
This is only used for logging a human readable codec name for
debugging.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-05-25 12:22:28 +03:00
Martin Storsjö
bc2a32969e rtsp: Parse SSRC attributes in the SDP
When feeding input RTP packets to the depacketizer via custom IO,
it needs to pick the right stream using the payload type for
RTP packets, and using the SSRC for RTCP packets. If the first
packet is an RTCP packet, we don't (currently) know the SSRC
yet and thus can't pick the right RTP depacketizer to handle it.

By parsing the SSRC attribute in the SDP, we can map initial
RTCP packets to the right stream.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-05-11 10:35:26 +03:00
Derek Buitenhuis
f8e89d8a29 Merge commit 'fab8156b2f30666adabe227b3d7712fd193873b1'
* commit 'fab8156b2f30666adabe227b3d7712fd193873b1':
  avio: Copy URLContext generic options into child URLContexts

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-21 15:55:09 +01:00
Derek Buitenhuis
6f69f7a8bf Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
* commit '9200514ad8717c63f82101dc394f4378854325bf':
  lavf: replace AVStream.codec with AVStream.codecpar

This has been a HUGE effort from:
    - Derek Buitenhuis <derek.buitenhuis@gmail.com>
    - Hendrik Leppkes <h.leppkes@gmail.com>
    - wm4 <nfxjfg@googlemail.com>
    - Clément Bœsch <clement@stupeflix.com>
    - James Almer <jamrial@gmail.com>
    - Michael Niedermayer <michael@niedermayer.cc>
    - Rostislav Pehlivanov <atomnuker@gmail.com>

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-10 20:59:55 +01:00
Martin Storsjö
fab8156b2f avio: Copy URLContext generic options into child URLContexts
Since all URLContexts have the same AVOptions, such AVOptions
will be applied on the outermost context only and removed from the
dict, while they probably make sense on all contexts.

This makes sure that rw_timeout gets propagated to the innermost
URLContext (to make sure it gets passed to the tcp protocol, when
opening a http connection for instance).

Alternatively, such matching options would be kept in the dict
and only removed after the ffurl_connect call.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-03-24 10:34:19 +02:00
Zhao Zhili
6f5048f4a0 rtp: Fix play multiple multicast streams with the same port
We cannot play multiple multicast streams with the same port at the
same time. This is because both rtp and rtcp port are opened in
read-write mode, so they will not bind to the multicast address. Try
to make rtp port as read-only by default to solve this bug.

Signed-off-by: Zhao Zhili <wantlamy@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-07 02:29:41 +01:00
Derek Buitenhuis
93629735d7 avformat: Add a protocol blacklisting API
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-03-04 16:13:42 +00:00
Anton Khirnov
9200514ad8 lavf: replace AVStream.codec with AVStream.codecpar
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.
2016-02-23 17:01:58 +01:00
Anton Khirnov
ec4c483976 lavf: add a protocol whitelist/blacklist for file opened internally
Should make the default behaviour safer for careless callers that open
random untrusted files.

Bug-Id: CVE-2016-1897
Bug-Id: CVE-2016-1898
2016-02-22 11:48:30 +01:00
Anton Khirnov
8c0ceafb0f urlprotocol: receive a list of protocols from the caller
This way, the decisions about which protocols are available for use in
any given situations can be delegated to the caller.
2016-02-22 11:45:31 +01:00
Michael Niedermayer
fe3fed0b14 Update demuxers and protocols for protocol whitelist support
Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-02 04:16:50 +01:00
Ganesh Ajjanagadde
d5f5c90be9 rtsp: free opts dictionary on failure of getnameinfo
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-12-07 11:11:31 +02:00
Ganesh Ajjanagadde
90409b6da8 avformat/rtsp: free opts dictionary on failure of getnameinfo
Fixes: CID 1341579.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-06 08:11:47 -05:00
Clément Bœsch
43ecec0f03 avformat: use AV_OPT_TYPE_BOOL in a bunch of places 2015-12-04 15:43:33 +01:00
Hendrik Leppkes
f62fe535d5 Merge commit '2c17fb61ced2059034856a6c6cd303014aed01fe'
* commit '2c17fb61ced2059034856a6c6cd303014aed01fe':
  rtsp: Log getaddrinfo failures

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-29 16:13:24 +01:00
Hendrik Leppkes
aaa4abfdb8 Merge commit '98063bcf15eb1e9bf9c8758c83c88d51cbb7ace7'
* commit '98063bcf15eb1e9bf9c8758c83c88d51cbb7ace7':
  rtsp: Do not assume getnameinfo cannot fail

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-29 16:09:58 +01:00
Luca Barbato
2c17fb61ce rtsp: Log getaddrinfo failures
And forward the logging contexts when needed.
2015-11-25 09:01:25 +01:00
Luca Barbato
98063bcf15 rtsp: Do not assume getnameinfo cannot fail
And properly report the error when it happens.
2015-11-25 09:01:25 +01:00
Hendrik Leppkes
12e95d156a Merge commit 'e02dcdf6bb6835ef4b49986b85a67efcb3495a7f'
* commit 'e02dcdf6bb6835ef4b49986b85a67efcb3495a7f':
  rtsp: Allow $ as interleaved packet indicator before a complete response header

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-27 12:41:37 +01:00
Martin Storsjö
e02dcdf6bb rtsp: Allow $ as interleaved packet indicator before a complete response header
Some RTSP servers ("HiIpcam/V100R003 VodServer/1.0.0") respond to
our keepalive GET_PARAMETER request by a truncated RTSP header
(lacking the final empty line to indicate a complete response
header). Prior to 764ec70149, this worked just fine since we
reacted to the $ as interleaved packet indicator anywhere.

Since $ is a valid character within the response header lines,
764ec70149 changed it to be ignored there. But to keep
compatibility with such broken servers, we need to at least
allow reacting to it at the start of lines.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-10-23 10:31:55 +03:00
Hendrik Leppkes
78af3ffaa9 Merge commit '1ec611a10228945d2ec8a9cf6c5531dee6b7ee56'
* commit '1ec611a10228945d2ec8a9cf6c5531dee6b7ee56':
  rtsp: warning when max_delay reached

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-16 14:11:24 +02:00
Eloi BAIL
1ec611a102 rtsp: warning when max_delay reached
packets are queued due to packet reordering until the queue reach its
maximal size or max delay is reached.
This commit adds a warning trace when max delay is reached.

Signed-off-by: Eloi BAIL <eloi.bail@savoirfairelinux.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-09-16 09:58:12 +03:00
Michael Niedermayer
bc4bdc6d61 Merge commit '764ec70149728be82304c163ccc4e280f1629201'
* commit '764ec70149728be82304c163ccc4e280f1629201':
  rtsp: Only interpret $ as interleaved packet indicator at the start of replies

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-30 18:37:37 +02:00
Martin Storsjö
764ec70149 rtsp: Only interpret $ as interleaved packet indicator at the start of replies
Allow $ as character anywhere within normal RTSP replies - both
within the lines, and as the first character of RTSP header lines.
(The existing old comment indicated that an inline packet could
start at any line within a RTSP reply header, but that doesn't
sound valid to me, and I'm not sure if the existing code
handled that correctly either.)

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-07-30 16:59:36 +03:00
Michael Niedermayer
e6ec65d2d3 avformat/rtsp: print a debug level note if time parsing fails
Fixes CID733718 again

This partly reverts commit eb7ddb5066.
2015-05-15 20:21:37 +02:00
Michael Niedermayer
10a28e8a08 Merge commit 'b90adb0aba073f9c1b4abca852119947393ced4c'
* commit 'b90adb0aba073f9c1b4abca852119947393ced4c':
  rtsp: Make sure we don't write too many transport entries into a fixed-size array

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-24 20:37:51 +02:00
Martin Storsjö
b90adb0aba rtsp: Make sure we don't write too many transport entries into a fixed-size array
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-04-24 16:07:14 +03:00
Michael Niedermayer
f8951d36df Merge commit 'eb7ddb5066843ab16caf33b05eafb2576648b797'
* commit 'eb7ddb5066843ab16caf33b05eafb2576648b797':
  rtsp: Don't warn about unparsed time ranges

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-24 03:00:37 +02:00
Martin Storsjö
eb7ddb5066 rtsp: Don't warn about unparsed time ranges
This removes the error logging added in 4e54432164.

This avoids warnings about "Invalid interval start specification 'now'"
for live rtsp streams.

We only try to parse some of the many valid values for time ranges
in RTSP - the other ones are fully valid but not interesting for the
use case in rtsp.c, so we shouldn't warn about them.

(Parsing the time ranges is needed to allow seeking, but e.g. setting
the current realtime clock for the start time doesn't make sense.
av_parse_time has got a different mode for parsing absolute times
as well, which can handle the special case "now", but that doesn't
make much sense for this particular use in rtsp.c.)

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-04-23 23:20:02 +03:00
Michael Niedermayer
40d552dae6 Merge commit '1a3eb042c704dea190c644def5b32c9cee8832b8'
* commit '1a3eb042c704dea190c644def5b32c9cee8832b8':
  Replace av_dlog with normal av_log at trace level

Conflicts:
	ffplay.c
	libavdevice/fbdev_dec.c
	libavfilter/avfilter.c
	libavfilter/internal.h
	libavfilter/setpts.c
	libavfilter/src_movie.c
	libavfilter/vf_crop.c
	libavfilter/vf_drawtext.c
	libavfilter/vf_fieldorder.c
	libavformat/assdec.c
	libavformat/avidec.c
	libavformat/flvdec.c
	libavformat/http.c
	libavformat/ipmovie.c
	libavformat/isom.c
	libavformat/mov.c
	libavformat/mpegenc.c
	libavformat/mpegts.c
	libavformat/mpegtsenc.c
	libavformat/mux.c
	libavformat/mxfdec.c
	libavformat/nsvdec.c
	libavformat/oggdec.c
	libavformat/r3d.c
	libavformat/rtspdec.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-20 03:19:47 +02:00
Vittorio Giovara
1a3eb042c7 Replace av_dlog with normal av_log at trace level
This applies to every library where performance is not critical.
2015-04-19 12:41:59 +01:00
Himangi Saraogi
f03dfe118b avformat/rtsp: Fix dereference after null check
This fixes CID 732219

Reviewed-by: Thomas Volkert <silvo@gmx.net>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-12 23:31:55 +02:00
Himangi Saraogi
4e54432164 rtsp: Fix unchecked return value
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-04-12 23:08:14 +03:00
Himangi Saraogi
0b72a47f55 rtsp: Check a malloc return value
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-04-12 23:08:13 +03:00
Himangi Saraogi
aae9f52c4e avformat/rtsp: Fix unchecked return value
Reviewed-by: Thomas Volkert <silvo@gmx.net>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-10 14:18:11 +02:00
Himangi Saraogi
4b03002527 avformat/rtsp: Fix null pointer dereference
This fixes CID 1257827.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-04 13:38:34 +02:00
Michael Niedermayer
53bf6b155c Merge commit 'e3ec6fe7bb2a622a863e3912181717a659eb1bad'
* commit 'e3ec6fe7bb2a622a863e3912181717a659eb1bad':
  rtsp: Add a buffer_size option

Conflicts:
	libavformat/rtsp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-01 21:34:20 +02:00
Luca Barbato
e3ec6fe7bb rtsp: Add a buffer_size option
And forward it to rtp and udp.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-04-01 14:26:35 +02:00
Michael Niedermayer
b425b81fd2 avformat/rtsp: Fix potential pointer overflow in sdp_probe()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-16 22:40:36 +01:00
Gilles Chanteperdrix
071f3e1c6e Revert "rtsp: Interpret the text media type as AVMEDIA_TYPE_DATA"
This reverts commit 26524e3581.

If we want the T.140 codec to have the AV_CODEC_ID_TEXT codec id,
its type needs to be AVMEDIA_TYPE_SUBTITLE, so, keep interpreting
the text media type as AVMEDIA_TYPE_SUBTITLE.

Signed-off-by: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-01 03:40:20 +01:00
Michael Niedermayer
3130e5be92 Merge commit 'd594dbecce5f3af7f80bbf5bb1b516d740b69ccd'
* commit 'd594dbecce5f3af7f80bbf5bb1b516d740b69ccd':
  rtpdec: Rename the free method to close

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-25 00:58:39 +01:00
Michael Niedermayer
7f03f75ce7 Merge commit '8e32b1f0963d01d4f5d4803eb721f162e0d58d9a'
* commit '8e32b1f0963d01d4f5d4803eb721f162e0d58d9a':
  libavformat: Use ffio_free_dyn_buf where applicable

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-25 00:48:50 +01:00
Michael Niedermayer
79052cd4ce Merge commit '078d43e23a7a3d64aafee8a58b380d3e139b3020'
* commit '078d43e23a7a3d64aafee8a58b380d3e139b3020':
  rtpdec: Free depacketizers if the init function failed

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-25 00:32:06 +01:00
Michael Niedermayer
fa80b76b11 Merge commit 'bb4a310bb85f43e62240145a656b1e5285b14239'
* commit 'bb4a310bb85f43e62240145a656b1e5285b14239':
  rtpdec: Don't free the payload context in the .free function

Conflicts:
	libavformat/rtpdec_latm.c
	libavformat/rtpdec_mpeg4.c
	libavformat/rtpdec_mpegts.c
	libavformat/rtpdec_xiph.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-25 00:25:12 +01:00
Michael Niedermayer
64f58d20b2 Merge commit 'f4b59334bd898c47c9ac30999a346176548630a8'
* commit 'f4b59334bd898c47c9ac30999a346176548630a8':
  rtpdec: Remove the now unused .alloc field

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-25 00:17:48 +01:00
Michael Niedermayer
48e3cd4fcd Merge commit 'e72605f80bf5cbe32053a554ccc137e0a99cf3dd'
* commit 'e72605f80bf5cbe32053a554ccc137e0a99cf3dd':
  rtpdec: Allow allocating and freeing the private data without explicit functions

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-24 22:42:04 +01:00