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

59 Commits

Author SHA1 Message Date
Andreas Rheinhardt
790f793844 avutil/common: Don't auto-include mem.h
There are lots of files that don't need it: The number of object
files that actually need it went down from 2011 to 884 here.

Keep it for external users in order to not cause breakages.

Also improve the other headers a bit while just at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-31 00:08:43 +01:00
Marton Balint
87677c2195 avformat/libsrt: use SRT_EPOLL_IN for waiting for an incoming connection
This is the proper poll mode for waiting for an incoming connection according
to the SRT API docs.

Fixes ticket #9142.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-25 00:35:02 +01:00
Zhao Zhili
4ea2b271eb avformat/libsrt: Remove manually free AV_OPT_TYPE_STRING
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-02-22 19:13:36 +08:00
Ingo Oppermann
86128bd07a avformat/libsrt: Fix srt:// URL query string parsing
Add missing NULL check and use ff_urldecode for string query
parameters.

Signed-off-by: Ingo Oppermann <ingo@datarhei.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-15 00:34:16 +01:00
Anton Khirnov
1e7d2007c3 all: use designated initializers for AVOption.unit
Makes it robust against adding fields before it, which will be useful in
following commits.

Majority of the patch generated by the following Coccinelle script:

@@
typedef AVOption;
identifier arr_name;
initializer list il;
initializer list[8] il1;
expression tail;
@@
AVOption arr_name[] = { il, { il1,
- tail
+ .unit = tail
}, ...  };

with some manual changes, as the script:
* has trouble with options defined inside macros
* sometimes does not handle options under an #else branch
* sometimes swallows whitespace
2024-02-14 14:53:41 +01:00
Anton Khirnov
08bebeb1be Revert "all: Don't set AVClass.item_name to its default value"
Some callers assume that item_name is always set, so this may be
considered an API break.

This reverts commit 0c6203c97a.
2024-01-20 10:34:48 +01:00
Andreas Rheinhardt
0c6203c97a all: Don't set AVClass.item_name to its default value
Unnecessary since acf63d5350adeae551d412db699f8ca03f7e76b9;
also avoids relocations.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-12-22 15:12:33 +01:00
Zhao Zhili
3721aaeaaa avformat/libsrt: use a larger buffer for find_info_tag
The upper limit of strlen(streamid) is 512. Use a larger buffer for
future proof, for example, deal with percent-encoding.

Reviewed-by: Zhao Jun <barryjzhao@tencent.com>
Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
2022-03-30 10:30:02 +08:00
Zhao Zhili
397a777aa1 avformat/libsrt: fix deprecated warning
srt_socket was deprecated after 1.4.1.

Reviewed-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
2022-03-30 10:29:52 +08:00
Marton Balint
6f10f4a479 avformat/libsrt: add missing version check for snddropdelay
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-11-25 19:11:24 +01:00
Limin Wang
6260c611c5 avformat/libsrt: add snddropdelay parameter for srt
Reviewed-by: "zhilizhao(赵志立)" <quinkblack@foxmail.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-11 18:43:47 +08:00
Limin Wang
b4d665bf69 avformat/libsrt: specify base of maxbw string to 10 instead of auto-detect
Make all options string conversion consistent.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-10 11:00:59 +08:00
Limin Wang
1161d8b4b3 avformat/libsrt: use strtoll/strtol for int64_t/int
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-10 11:00:59 +08:00
Zhao Zhili
e4f499f842 avformat/libsrt: remove url_get_file_handle implementation
SRTSOCKET is an abstraction designed by libsrt, it's not guaranteed
to be a real file descriptor. Even if it is, it should not be
operated directly outside of libsrt.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-09-18 22:10:03 +02:00
Zhao Zhili
fc9832f255 avformat/libsrt: log streamid in listener mode
It's useful for test client which pass streamid to ffmpeg/ffplay.
For example, use ffmpeg to test streamid support in VLC:
./ffmpeg -v info -re -i foo.mp4 -c copy -f mpegts -mode listener srt://127.0.0.1:9000
./vlc srt://127.0.0.1:9000?streamid=foobar

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-09-18 21:44:25 +02:00
Andreas Rheinhardt
2934a4b9a5 Remove unnecessary avassert.h inclusions
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 15:02:30 +02:00
Zhao Zhili
58614f7bee avformat/libsrt: workaround conflict with ffmpeg cmdline option
Add 'srt_streamid' option as an alias for 'streamid'.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-06-09 00:09:33 +02:00
Zhao Zhili
55c54ff744 avformat/libsrt: add tsbpd option
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-06-09 00:07:10 +02:00
Zhao Zhili
9099046cc7 avformat/libsrt: send message in order
There is no good use case for out of order delivery of data. For live
streaming with TSBPD enabled by default, the receiver get data in order
based on the timestamps. However, if TSBPD is disabled, the data can
be delivered out of order.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-06-09 00:07:10 +02:00
Zhao Zhili
d86f44fecc avformat/libsrt: fix help message
SRTO_TLPKTDROP works for receiver and sender both.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-19 22:57:23 +01:00
Zhao Zhili
65bfb6af66 avformat/libsrt: fix setsockopt() typo
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-19 22:57:20 +01:00
Marton Balint
cae57cae1f avformat/libsrt: fix race condition with libsrt_network_wait_fd and epoll
The way SRT's async / epoll-based IO works is that the event status is stored
in the epoll containers. That is, if an event occurs on an SRT socket, and that
SRT socket isn't part of any epoll container, then that event is lost. If we
later add that socket to an epoll container, we still won't receive the event
even if it wasn't serviced.

Therefore we create the epoll and put the fd into it right after the connection
is established.

See http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2021-January/275334.html

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-02-07 19:42:22 +01:00
Marton Balint
5cf01ed5cd avformat/libsrt: fix or simplify some function return values
Sometimes there was a confusion between srt_*() function return values and
libavformat-style return values.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-02-07 19:42:22 +01:00
Marton Balint
d4e4ffd348 avformat/libsrt: close listen fd immediately after accept
There is no reason to keep it open.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-02-07 19:42:22 +01:00
Marton Balint
fb0304fcc9 avformat/libsrt: fix cleanups on failed libsrt_open() and libsrt_setup()
- Call srt_epoll_release() to avoid fd leak on libsrt_setup() error.
- Call srt_cleanup() on libsrt_open() failure.
- Fix return value and method on mode parsing failure.

Based on a patch by Nicolas Sugino <nsugino@3way.com.ar>.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-10-16 23:15:09 +02:00
Nicolas Sugino
86f5fd471d avformat/libsrt: close listen fd in listener mode
In listener mode the first fd is not closed when libsrt_close() is called
because it is overwritten by the new accept fd.  Added the listen_fd to the
context to properly close it when libsrt_close() is called.

Fixes trac ticket #8372.

Signed-off-by: Nicolas Sugino <nsugino@3way.com.ar>
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-08-20 16:24:46 +02:00
Jun Zhao
7c59e1b0f2 lavf/srt: fix build fail when used the libsrt 1.4.1
libsrt changed the:
SRTO_SMOOTHER   -> SRTO_CONGESTION
SRTO_STRICTENC  -> SRTO_ENFORCEDENCRYPTION
and removed the front of deprecated options (SRTO_SMOOTHER/SRTO_STRICTENC)
in the header, it's lead to build fail

fix #8760

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-07-28 09:30:11 +08:00
Limin Wang
e9b35a249d avformat/libsrt: change open_timeout to int64_t to avoid integer overflow
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-03 05:28:33 +08:00
Limin Wang
6e95ce8cc9 avformat/libsrt: clarify option description for timeout and latency unit of measurement
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-03 05:28:32 +08:00
Marton Balint
290a35aefe avformat/libsrt: make avformat connect timeout 0 by default
Otherwise the user is not able to override the SRT API connect timeout above 5
sec without also setting the timeout option.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-02-24 00:13:38 +01:00
Marton Balint
449e984192 avformat/libsrt: use listen_timeout for listening
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-02-24 00:02:46 +01:00
Marton Balint
7cc7680a80 avformat/libsrt: send non-blocking mode on both the listen and the connect socket
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-02-24 00:02:46 +01:00
Marton Balint
86a7b77b60 avformat/libsrt: small fixes in libsrt_neterrno()
Return os error code if available, check for both SRT_EASYNCRCV and
SRT_EASYNCSND when transforming them to EAGAIN and only display error if it is
not EAGAIN.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-02-24 00:02:45 +01:00
Marton Balint
c112fae660 avformat/libsrt: poll for error conditions as well
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-02-24 00:02:45 +01:00
Marton Balint
aab9133d91 avformat/libsrt: fix checking connection result in non-blocking mode
After f8990c5f41 we properly set non-blocking
mode which makes the connect() call return always 0 even if no connection can
be established.

Fix this by always doing a poll after calling connect(). Also there was some
leftover copy paste code which checks for various errors which are simply not
possible with SRT.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-02-24 00:02:45 +01:00
Marton Balint
006744bdbd avformat/libsrt: fix name of timeout option
rw_timeout is the generic URLcontext option, not the protocol specific timeout
option, also ?rw_timeout never worked because ?timeout was parsed instead.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-02-24 00:02:45 +01:00
Marton Balint
b96bc946f2 avformat/libsrt: fix timeout unit confusion between milisec and microsec
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-02-24 00:02:45 +01:00
Marton Balint
fee4cafbf5 avformat/libsrt: add missing SRT_VERSION_VALUE check
This was missed in d7e2a2bb35.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-23 22:41:43 +01:00
Anthony Delannoy
f8990c5f41 avformat/libsrt: fix enabling nonblocking mode
As written in https://github.com/Haivision/srt/blob/v1.4.1/docs/API.md,
the nonblock mode is activated if SRTO_SNDSYN and SRTO_RCVSYN, for
sending and receiving respectively, are set to 0.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-19 00:17:11 +01:00
Anthony Delannoy
3def315c5c lavf/libsrt: Fix typo
Reviewed-by: "mypopy@gmail.com" <mypopy@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-08 01:35:13 +01:00
Jun Zhao
d7e2a2bb35 lavf/libsrt: add version guard for srt encryption control
add version guard for srt encryption control. and use
SRTO_STRICTENC(53) for compatibility.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-01-01 19:35:53 +08:00
Jun Zhao
952fd0c768 lavf/libsrt: enable other encryption parameters
Enable the SRTO_ENFORCEDENCRYPTION/SRTO_KMREFRESHRATE/
SRTO_KMPREANNOUNCE for srt encryption control.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-12-11 14:23:26 +08:00
Jun Zhao
8d823e6005 lavf/libsrt: add linger parameter to libsrt
add linger parameter to libsrt, it's setting the number of seconds
that the socket waits for unsent data when closing.

Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-12-11 14:23:26 +08:00
Limin Wang
79d907774d avformat/libsrt: change tlpktdrop, nakreport, messageapi options to boolean type
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-06 11:27:25 +01:00
Limin Wang
f9d6addd60 avformat/libsrt: fix for the memory leak if passphrase has been configured by option
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-06 11:25:29 +01:00
Steven Liu
1f7b527194 avformat/libsrt: check av_strdup() return value and fix memleak
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-10-19 06:49:46 +02:00
James Almer
1811b7d1f5 Merge commit '90b15f60bf4919deaed66d868e18107eba371da7'
* commit '90b15f60bf4919deaed66d868e18107eba371da7':
  srt: Set srto_sender flag to sender srt socket

Merged-by: James Almer <jamrial@gmail.com>
2019-02-20 15:50:06 -03:00
Sven Dueking
90b15f60bf srt: Set srto_sender flag to sender srt socket
SRT API Documentation:
This flag is superfluous if both parties are at least version 1.3.0
(this shall be enforced by setting this value to SRTO_MINVERSION if
you expect that it be true) and therefore support HSv5 handshake,
where the SRT extended handshake is done with the overall handshake
process.

This flag is however obligatory if at least one party may be using
SRT below version 1.3.0 and does not support HSv5.
2019-02-12 11:59:29 +01:00
Matsuzawa Tomohiro
c2ac3b8e6a avformat/libsrt: add several options supported in srt 1.3.0
Several SRT options are missing. Since pkg_config requires libsrt v1.3.0 and above, it should be able to support options added in libsrt v1.3.0 and below.
This commit adds 8 SRT options.
sndbuf, rcvbuf, lossmaxttl, minversion, streamid, smoother, messageapi and transtype
The keys of option are equivalent to stransmit.
https://github.com/Haivision/srt/blob/v1.3.0/apps/socketoptions.hpp#L196-L223

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-10-23 19:42:48 +02:00
Marton Balint
23fe072e43 avformat/libsrt: fix merge of payload_size option
Fixes a compile error and re-adds pkt_size as a url?option as well.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-09-03 09:46:42 +02:00