[FFmpeg-trac] #8893(avformat:new): multiple calls to srt_startup/srt_cleanup within a process

FFmpeg trac at avcodec.org
Wed Sep 16 18:42:08 EEST 2020

#8893: multiple calls to srt_startup/srt_cleanup within a process
             Reporter:  malcolmb     |                    Owner:
                 Type:  enhancement  |                   Status:  new
             Priority:  normal       |                Component:  avformat
              Version:  git-master   |               Resolution:
             Keywords:  srt          |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |

Comment (by malcolmb):

 The purpose of reference counting is to avoid incorrect duplicate buildups
 or premature tear downs in the event that multiple usage points of a
 library are active within a larger library. Even if they fix the issue, a
 way to buildup/teardown only once per process is useful for performance

 Agreed it should not be done in all cases, but potentially a flag, or
 another exposed function as a solution?

 I don't see anything about the network init functions being deprecated. I
 see they are optional now, which is a nice design addition. I certainly
 would hope they don't get deprecated since for the same reason as above, I
 wouldn't want multiple buildup/teardowns of network libraries during a
 single process run.

 Calling srt_startup() myself would only work if I was linking with a
 dynamic library of libsrt. Currently it's statically linked so the only
 way would be to expose a function through libavformat's API. Otherwise I'm
 not initializing the same resources that libavformat is using.
 Besides, calling a library I'm not using directly to affect the behavior
 of a different library isn't good design.

 I do think a general way for users of libavformat to say 'I'm using this
 feature, don't tear it down until I tell you to' is useful, as already
 exists with avformat_network_init()

Ticket URL: <https://trac.ffmpeg.org/ticket/8893#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list