Commit Graph

159 Commits

Author SHA1 Message Date
Limin Wang
7bf4c06809 avformat/rtp: add localaddr for network interface selection
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-11-27 11:21:17 +08:00
Limin Wang
2aceae1438 avformat/rtpproto: support for rtp read timeout
then we can set the rtp read timeout instead of infinite timeout.

How to test(5s timeout):
./ffprobe -i rtp://192.168.1.67:1234?timeout=5000000

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-10-22 20:53:56 +08:00
Limin Wang
6e911898fc avformat/rtpproto: av_dict_set() -> av_dict_set_int()
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-06-02 22:25:11 +08:00
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
Carl Eugen Hoyos
06f65a17a3 lavf/rtpproto: Use the correct patch when including poll.h
Fixes a warning using musl:
In file included from libavformat/rtpproto.c:43:0:
/usr/local/musl/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
2019-01-16 00:09:21 +01:00
Marton Balint
9d4829f3c9 avformat/rtpproto: use factorized ip functions
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-10-03 22:03:29 +02:00
Rostislav Pehlivanov
d41de90d44 libavformat: remove the ff_rtp_get_local_rtcp_port function
Only used by ffserver

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2018-01-06 18:34:55 +00:00
Clément Bœsch
03f5e80bdb Merge commit '67351924fa91dea4339109100a4c0689f006581f'
* commit '67351924fa91dea4339109100a4c0689f006581f':
  Drop unreachable break and return statements

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-03-30 10:26:29 +02:00
Vlad Tarca
2bd83ef26a avformat: Add Pro-MPEG CoP #3-R2 FEC protocol
Pro-MPEG Code of Practice #3 release 2 forward error correction for rtp_mpegts streams

Signed-off-by: Vlad Tarca <vtarca@mobibase.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-13 11:38:15 +01:00
Diego Biurrun
67351924fa Drop unreachable break and return statements 2016-11-03 20:17:12 +01: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
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
Derek Buitenhuis
9c75148e6e Merge commit '2758cdedfb7ac61f8b5e4861f99218b6fd43491d'
This commit also disables the async fate test, because it
used internal APIs in a non-kosher way, which no longer
exists.

* commit '2758cdedfb7ac61f8b5e4861f99218b6fd43491d':
  lavf: reorganize URLProtocols

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-29 16:51:10 +00: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
Anton Khirnov
2758cdedfb lavf: reorganize URLProtocols
Instead of a linked list constructed at av_register_all(), store them
in a constant array of pointers.

Since no registration is necessary now, this removes some global state
from lavf. This will also allow the urlprotocol layer caller to limit
the available protocols in a simple and flexible way in the following
commits.
2016-02-22 11:30:58 +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
Clément Bœsch
43ecec0f03 avformat: use AV_OPT_TYPE_BOOL in a bunch of places 2015-12-04 15:43:33 +01:00
Michael Niedermayer
f944aeb07a avformat/rtpproto: Move dscp into context & AVOptions
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-11 18:53:54 +02:00
Michael Niedermayer
b99a8e4e4a Merge commit '8c9c5479c4ba729b4ba868ab541a90b2061a7c2f'
* commit '8c9c5479c4ba729b4ba868ab541a90b2061a7c2f':
  rtp: Add an option to set the send/receive buffer size

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-01 21:12:47 +02:00
Michael Niedermayer
fde2e35e56 Merge commit '3c47e7c4350f73fc77d8e76f0dd6d2946b13c5cc'
* commit '3c47e7c4350f73fc77d8e76f0dd6d2946b13c5cc':
  rtp: Map the urloptions to AVOptions

Conflicts:
	libavformat/rtpproto.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-01 21:03:10 +02:00
Luca Barbato
8c9c5479c4 rtp: Add an option to set the send/receive buffer size
It gets forwarded down to UDP.
2015-04-01 14:26:35 +02:00
Luca Barbato
3c47e7c435 rtp: Map the urloptions to AVOptions
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-04-01 14:26:35 +02:00
Michael Niedermayer
ef05af82b2 avformat/rtpproto: Use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-24 13:14:07 +01:00
Michael Niedermayer
bd378acad4 Merge commit '95d880fa6436f3b557a9c060428a04b9e4d552df'
* commit '95d880fa6436f3b557a9c060428a04b9e4d552df':
  rtpproto: Fix the input RTP data format check

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-10 01:24:12 +01:00
Martin Storsjö
95d880fa64 rtpproto: Fix the input RTP data format check
Only the upper 2 bits of the first byte are known to be
a fixed value.

The lower bits in the first byte of a RTP packet could be set
if the input is from another RTP packetizers than libavformat's,
but for RTCP packets, they would also be set when sending RTCP RR
packets, triggering false warnings about incorrect input format
to the protocol.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-12-09 23:59:14 +02:00
Michael Niedermayer
5ab467043a Merge commit '29bc7bfba288ff8572ed967a8752a1dbde7b724b'
* commit '29bc7bfba288ff8572ed967a8752a1dbde7b724b':
  rtpproto: Write a warning if the input data written isn't RTP packetized

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-08 12:15:44 +01:00
Martin Storsjö
29bc7bfba2 rtpproto: Write a warning if the input data written isn't RTP packetized
Tell the user that the RTP muxer needs to be used to packetize
the data - using the RTP protocol on its own isn't enough.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-12-08 11:59:12 +02:00
Vincent Bernat
d0f8b94b43 avformat/rtpproto: Allow to specify DSCP class
By appending `?dscp=26` to the URL, IP packets will be classified as
AF31 (assured forwarding for multimedia flows with low probability of
loss). On congested network, this allows a user to assign priorities to
flows.

Signed-off-by: Vincent Bernat <vincent@bernat.im>
2014-11-27 19:53:09 +01:00
Michael Niedermayer
cec4e1c7c7 Merge commit 'd2771a1dc0a3695e8873adc16d068077f2417eea'
* commit 'd2771a1dc0a3695e8873adc16d068077f2417eea':
  rtpproto: Free the addrinfo pointer on failure

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-20 23:05:06 +02:00
Luca Barbato
d2771a1dc0 rtpproto: Free the addrinfo pointer on failure
CC: libav-stable@libav.org
Bug-Id: CID 1238797
2014-10-20 10:47:29 +01:00
Michael Niedermayer
474d858fd9 Revert "avformat/rtpproto: fix strict aliasing violations with sockaddr"
It appears this breaks build with MSVC
until someone who has MSVC setup has time to investigate and
workaround/fix this, its better to revert so that build is not broken
Thats even more so as the original commit only fixed a hypothetical issue

This reverts commit e587a428d7.
2014-09-16 23:43:13 +02:00
Michael Niedermayer
e587a428d7 avformat/rtpproto: fix strict aliasing violations with sockaddr
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-15 13:31:00 +02:00
lemonlinger@gmail.com
2cf94485de avformat/rtpproto: when local rtp port and local rtcp port are not specified, try to make two successive ports and retry 3 times when failed
some video players on Android will not send udp hole punching messages if the rtcp port and rtp port are not two successive integers.
So, if the video player is behind NAT, it could not receive and rtp messages via udp

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-25 22:40:21 +02:00
Michael Niedermayer
e1ec7990fe Merge commit '4b054a3400f728c54470ee6a1eefe1d82420f6a2'
* commit '4b054a3400f728c54470ee6a1eefe1d82420f6a2':
  rtpproto: Check the right feature detection macro

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-16 12:31:15 +02:00
Martin Storsjö
4b054a3400 rtpproto: Check the right feature detection macro
IPPROTO_IPV6 is unrelated here (it's only used in udp.c for
multicast sockopts), check for support for the sockaddr_in6
struct itself.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-15 15:35:41 +03:00
Michael Niedermayer
2c959eccc6 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  rtpproto: Check for the right feature when reading a sockaddr_in6

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-15 11:34:30 +02:00
Dave Yeo
c3386bd5b4 rtpproto: Check for the right feature when reading a sockaddr_in6
Some systems, such as OS/2, define AF_INET6 without a full
implementation.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-15 10:31:43 +03:00
Michael Niedermayer
2425be894a Merge commit '6b58e11a8331690ec32e9869db89ae10c54614e9'
* commit '6b58e11a8331690ec32e9869db89ae10c54614e9':
  rtpproto: Add an option for writing return packets to the address of the last received packets

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-14 12:38:11 +02:00
Michael Niedermayer
1a01f367a4 Merge commit '2427ac6ccd868811d1fe9df7c64c50ca58abe6f6'
* commit '2427ac6ccd868811d1fe9df7c64c50ca58abe6f6':
  rtpproto: Update the parameter documentation

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-14 12:30:40 +02:00
Martin Storsjö
6b58e11a83 rtpproto: Add an option for writing return packets to the address of the last received packets
If we've received packets on the same socket before, the return
packets are sent to that address. If we've only received packets
on the other socket, try to guess the source port for the other
one assuming the basic +1/-1 logic.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-14 11:21:32 +03:00
Martin Storsjö
2427ac6ccd rtpproto: Update the parameter documentation
Move the sources documentation up below the marker for deprecated
otpions. Also mention the new block parameter, that was added
in 749722209.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-13 22:16:53 +03:00
Michael Niedermayer
0f5a40c2a4 Merge commit 'ee37d5811caa8f4ad125a37fe6ce3f9e66cd72f2'
* commit 'ee37d5811caa8f4ad125a37fe6ce3f9e66cd72f2':
  rtpproto: Allow specifying a separate rtcp port in ff_rtp_set_remote_url

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-01 13:51:44 +02:00
Michael Niedermayer
2ee58af53e Merge commit '1851e1d05d06f6ef3436c667e4354da0f407b226'
* commit '1851e1d05d06f6ef3436c667e4354da0f407b226':
  rtpproto: Check the size before reading buf[1]

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-01 13:24:57 +02:00
Michael Niedermayer
fcccb4c11d Merge commit 'b7e6da988bfd5def40ccf3476eb8ce2f98a969a5'
* commit 'b7e6da988bfd5def40ccf3476eb8ce2f98a969a5':
  rtpproto: Move rtpproto specific function declarations to a separate header

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-01 12:03:24 +02:00
Michael Niedermayer
d6b37de4d4 Merge commit '892b0be1dfbdeaf71235fb6c593286e4f5c7e4ec'
* commit '892b0be1dfbdeaf71235fb6c593286e4f5c7e4ec':
  rtpproto: Simplify the rtp_read function by looping over the fds

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-01 11:58:17 +02:00
Michael Niedermayer
b39f012dee Merge commit '7531588fffbca1f0afdcc06635999c00dfc16ca6'
* commit '7531588fffbca1f0afdcc06635999c00dfc16ca6':
  rtpproto: Remove a misplaced comment

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-01 11:53:54 +02:00
Michael Niedermayer
d2c613dd14 Merge commit '54e03ff6af8a070f1055edd26028f3f7b2e2ca8e'
* commit '54e03ff6af8a070f1055edd26028f3f7b2e2ca8e':
  rtpproto: Support nonblocking reads

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-01 11:47:42 +02:00
Martin Storsjö
ee37d5811c rtpproto: Allow specifying a separate rtcp port in ff_rtp_set_remote_url
A separate rtcp port can already be set when opening the rtp
protocol normally, but when doing port setup as in RTSP (where
we first need to open the local ports and pass them to the peer,
and only then receive the remote peer port numbers), we didn't
check the same url parameter as in the normal open routine.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-01 10:26:17 +03:00