SRT Handling Does Not Clean Up Connection
|Reported by:||whitik||Owned by:|
|Blocking:||Reproduced by developer:||no|
|Analyzed by developer:||no|
Using the FFMPEG in C++ for SRT listening connections.
If I use:
avformat_open_input(&context1, "srt://0.0.0.0:9000/mode=listener", nullptr, &options); avformat_open_input(&context2, "srt://0.0.0.0:9005/mode=listener", nullptr, &options);
to open two listeners, and then use the Larix app to stream to the first, it works. i.e. av_read_frame gives back valid frames.
If the Larix app then stops streaming (a 'UMSG_SHUTDOWN' happens in the SRT library), then no error is returned from av_read_frame. However, if I set the rw_timeout option for SRT, an error happens then.
Issue: If I then close and reopen the context (avformat_close_input and avformat_close_input) an error is received saying that the socket is already open. There is no way to restart streaming.
(Note: If I don't recreate the context, streaming also doesn't work since 'no space to hold' errors are then received - the SRT library isn't initialized properly for the new connection.
The issue seems to do with properly closing all the resources with the context (i.e. the listener and connection socket resources). Reconnection only works when a single context is being used - because of usage counts in the library, closing the only context happens to completely restart the SRT library with srt_cleanup() / srt_startup().