]> git.sesse.net Git - ffmpeg/commit
avformat/libsrt: fix race condition with libsrt_network_wait_fd and epoll
authorMarton Balint <cus@passwd.hu>
Sat, 30 Jan 2021 23:45:33 +0000 (00:45 +0100)
committerMarton Balint <cus@passwd.hu>
Sun, 7 Feb 2021 18:42:22 +0000 (19:42 +0100)
commitcae57cae1f70371591223a5f9fe3f370ce8dfd50
tree4b0af18ae2784ce41439e1c37ec7c24e4f7bfec5
parent5cf01ed5cdfafbb494ca1725b5408555abc9f223
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>
libavformat/libsrt.c