[FFmpeg-trac] #8372(avformat:new): SRT Handling Does Not Clean Up Connection

FFmpeg trac at avcodec.org
Thu Nov 7 11:08:47 EET 2019


#8372: SRT Handling Does Not Clean Up Connection
-------------------------------------+-------------------------------------
             Reporter:  whitik       |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  avformat     |                  Version:
             Keywords:  SRT          |  unspecified
  Reconnection                       |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 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().

--
Ticket URL: <https://trac.ffmpeg.org/ticket/8372>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list