Commit Graph

695 Commits

Author SHA1 Message Date
Andreas Rheinhardt
82bf41f3ab avformat: Replace ffurl_close() by ffurl_closep() where appropriate
It avoids leaving dangling pointers behind in memory.

Also remove redundant checks for whether the URLContext to be closed is
already NULL.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-25 13:11:36 +02:00
Andreas Rheinhardt
4e254ec6be avformat/rtsp: Put strings instead of pointers to strings into array
In this example, the difference in length between the shortest and
longest string is three, so that not using pointers to strings saves
space even on 32bit systems.

Moreover, there is no need to use a sentinel here; it can be replaced
with FF_ARRAY_ELEMS.

Reviewed-by: Ross Nicholson <phunkyfish@gmail.com>
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-20 18:21:39 +02:00
Andreas Rheinhardt
87b056e6af avformat/rtsp: Don't free uninitialized AVBPrint
Fixes Coverity ID 1462307.

Reviewed-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Ross Nicholson <phunkyfish@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-20 18:16:24 +02:00
Wolfgang Haupt
428a0987e4 libavformat/rtsp: pass protocol options for udp multicast
Protocol options like buffer_size need to be passed to the
underlying transport implementation for udp multicasts as well.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-04-19 23:27:45 +02:00
phunkyfish
2a322906b7 avformat/rtp: Pass sources and block filter addresses via sdp file for rtp
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-04-19 13:18:01 +02:00
Carl Eugen Hoyos
8b1f07ef51 Revert "avformat/rtp: Pass sources and block filter addresses via sdp file for rtp"
This reverts commit b71685865f.

The commit lead to the use of an uninitialized variable.
Other issues were listed by Andreas Rheinhardt:
https://ffmpeg.org/pipermail/ffmpeg-devel/2020-March/259150.html
2020-04-05 11:58:02 +02:00
phunkyfish
b71685865f avformat/rtp: Pass sources and block filter addresses via sdp file for rtp
Signed-off-by: Aman Gupta <aman@tmm1.net>
2020-03-27 10:39:15 -07:00
Martin Storsjö
29f8d4e947 rtsp: Use AVERROR() with errno.h error codes for error returns
This particular function is only required to return nonzero on
errors, but use the common AVERROR() pattern for consistency.

Signed-off-by: Martin Storsjö <martin@martin.st>
2019-12-12 11:28:31 +02:00
Ross Nicholson
460f74495f libavformat/rtsp: return error if rtsp_hd_out is null instead of crash
Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-27 10:54:28 -07:00
James Almer
3e076faf3b Merge commit '1e56173515826aa4d680d3b216d80a3879ed1c68'
* commit '1e56173515826aa4d680d3b216d80a3879ed1c68':
  rtsp: add pkt_size option

Merged-by: James Almer <jamrial@gmail.com>
2019-05-02 13:02:58 -03:00
Tristan Matthews
1e56173515 rtsp: add pkt_size option
This allows users to specify an upper limit on the size of outgoing packets
when publishing via RTSP.

Signed-off-by: Martin Storsjö <martin@martin.st>
2019-04-15 22:44:19 +03:00
Jun Li
32148b5ac9 lavf/rtsp.c: Fix stimeout option not applied on http tunnel
stimeout option is already used in tcp transport, since
http is based on tcp, pass the option to http for tunneling
case.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Jun Li <junli1026@gmail.com>
2019-04-15 19:46:20 +08:00
Steven Liu
7f78a1b1ca Revert "lavf/rtsp.c: Fix stimeout option not applied on http tunnel"
This reverts commit 1ae8a1073b.
2019-04-15 19:45:39 +08:00
Signed-off-by: Jun Li
1ae8a1073b lavf/rtsp.c: Fix stimeout option not applied on http tunnel
stimeout option is already used in tcp transport, since
http is based on tcp, pass the option to http for tunneling
case.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Jun Li <junli1026@gmail.com>
2019-04-15 19:44:11 +08:00
Steven Liu
bbae8d08f5 Revert "lavf/rtsp.c: Fix stimeout option not applied on http tunnel"
This reverts commit f502bd5432.
2019-04-15 19:43:21 +08:00
Steven Liu
f502bd5432 lavf/rtsp.c: Fix stimeout option not applied on http tunnel
stimeout option is already used in tcp transport, since
http is based on tcp, pass the option to http for tunneling
case.

Reviewed-by: Steven Liu <lq@onvideo.cn>
Signed-off-by: Jun Li <junli1026@gmail.com>
2019-04-15 15:24:56 +08:00
Jun Li
4f5e660e69 avformat/doc, http, icecast, rtsp: Add option to disable send-expect-100
Fix ticket #7297
The current setting for send-expect-100 option is either
enabled if applicable or forced enabled, no option to force
disable the header. This change is to expand the option setting
to provide more flexibility, which is useful for rstp case.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-03-31 23:23:52 +02:00
Jun Li
c3b517dac2 avformat/rtsp: Add https tunneling support
Add https based tunneling for RTSP/RTP. Tested on Axis and Bosch cameras.
Https is widely used for security consideration.
2019-03-25 01:17:23 +01:00
Carl Eugen Hoyos
4d8875ec23 lavf: Constify the probe function argument.
Reviewed-by: Lauri Kasanen
Reviewed-by: Tomas Härdin
2019-03-21 11:42:17 +01:00
Michael Niedermayer
497c9b0cce avformat/rtsp: Check number of streams in sdp_parse_line()
Fixes: OOM

Found-by: Michael Hanselmann <public@hansmi.ch>
Reviewed-by: Michael Hanselmann <public@hansmi.ch>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-01-31 17:33:50 +01:00
Michael Niedermayer
0b50f27635 avformat/rtsp: Clear reply in every iteration in ff_rtsp_connect()
Fixes: Infinite loop

Found-by: Michael Hanselmann <public@hansmi.ch>
Reviewed-by: Michael Hanselmann <public@hansmi.ch>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-01-31 00:24:38 +01:00
Carl Eugen Hoyos
dced1f6cdf lavf/rtpdec: Constify several pointers.
Fixes two warnings:
libavformat/rtpdec.c:155:20: warning: return discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
libavformat/rtpdec.c:168:20: warning: return discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
2018-02-11 20:03:33 +01:00
wm4
ff46124b0d rtsp: rename certain options after a deprecation period
The "timeout" option name inherently clashes with the meaning of the
HTTP libavformat protocol option with the same name. Rename it after a
deprecation period to make it compatible with the HTTP one.
2018-02-04 15:08:48 +01:00
Marton Balint
18ac642359 avformat: migrate to AVFormatContext->url
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-01-28 23:06:43 +01:00
James Almer
dae6d27aa0 Merge commit 'f6161fccf8c5720ceac1ed1df8ba60ff8fed69f5'
* commit 'f6161fccf8c5720ceac1ed1df8ba60ff8fed69f5':
  rtsp: only break on parse_rtsp_message on error

Merged-by: James Almer <jamrial@gmail.com>
2017-12-10 20:44:26 -03:00
Tristan Matthews
f6161fccf8 rtsp: only break on parse_rtsp_message on error
Fix suggested by Luca Barbato.

This was causing spurious EOFs when using -rtsp_transport udp, as
reported in https://bugzilla.libav.org/show_bug.cgi?id=1103

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-11-30 15:32:04 +01:00
Luca Barbato
1e27837265 rtsp: Move message parsing to a separate function
Make easier to handle the polling function before we implement
full threading support.

(cherry picked from libav commit ca960161f0)
Signed-off-by: James Almer <jamrial@gmail.com>
2017-10-06 00:22:10 -03:00
James Almer
1e7b6e47d2 Merge commit '79331df362fb05a0d04ca9489c87e5b80077a3f4'
* commit '79331df362fb05a0d04ca9489c87e5b80077a3f4':
  rtsp: Lazily set up the pollfd array once

Merged-by: James Almer <jamrial@gmail.com>
2017-10-03 23:08:06 -03:00
James Almer
c2916564d8 Merge commit '5263f464db5f2df74ddf712f6d1221b24475fa8e'
* commit '5263f464db5f2df74ddf712f6d1221b24475fa8e':
  rtsp: Lazily allocate the pollfd array

Merged-by: James Almer <jamrial@gmail.com>
2017-10-03 21:40:22 -03:00
James Almer
7c74efeaf8 Merge commit 'b9b82151a1aaa8bbf389853a6142c4e101d80b86'
* commit 'b9b82151a1aaa8bbf389853a6142c4e101d80b86':
  rtsp: Move the pollfd setup out of the for loop

Merged-by: James Almer <jamrial@gmail.com>
2017-10-03 21:37:37 -03:00
James Almer
c244d4af43 Merge commit '150e99d694f33ab9ad678834964909aa315d14a1'
* commit '150e99d694f33ab9ad678834964909aa315d14a1':
  rtsp: Factor out packet reading

Merged-by: James Almer <jamrial@gmail.com>
2017-10-03 21:34:08 -03:00
wm4
5d76674756 lavf: make avio_read_partial() public
Main use-case is proxying avio through a foreign I/O layer and a custom
AVIO context, without losing latency and performance characteristics.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Merged from Libav commit 173b56218f.
2017-09-01 17:56:33 +02:00
wm4
173b56218f lavf: make avio_read_partial() public
Main use-case is proxying avio through a foreign I/O layer and a custom
AVIO context, without losing latency and performance characteristics.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2017-08-30 14:29:14 +02:00
Clément Bœsch
e3287077ec Merge commit '67deba8a416d818f3d95aef0aa916589090396e2'
* commit '67deba8a416d818f3d95aef0aa916589090396e2':
  Use avpriv_report_missing_feature() where appropriate

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-03-31 10:40:34 +02:00
Luca Barbato
ca960161f0 rtsp: Move message parsing to a separate function
Make easier to handle the polling function before we implement
full threading support.
2017-03-21 04:23:41 +01:00
Luca Barbato
79331df362 rtsp: Lazily set up the pollfd array once 2017-02-28 12:54:04 +01:00
Luca Barbato
5263f464db rtsp: Lazily allocate the pollfd array
And use av_malloc_array.
2017-02-27 13:51:53 +01:00
Luca Barbato
b9b82151a1 rtsp: Move the pollfd setup out of the for loop 2017-02-27 13:51:53 +01:00
Luca Barbato
150e99d694 rtsp: Factor out packet reading 2017-02-27 13:51:53 +01:00
Diego Biurrun
67deba8a41 Use avpriv_report_missing_feature() where appropriate 2016-11-08 17:54:34 +01:00
Martin Storsjö
df37950253 rtsp: Fix a crash with the RTSP muxer
This was introduced in bc2a32969e.

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.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2016-09-15 16:07:45 +03:00
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