]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/utils: Remove ff_codec_open2_recursive()
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 27 Nov 2020 00:12:01 +0000 (01:12 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 4 Dec 2020 14:46:46 +0000 (15:46 +0100)
This function existed to enable codecs with non-threadsafe init functions
to initialize other codecs despite the fact that normally no two codecs
with non-threadsafe init functions can be initialized at the same time
(there is a mutex guarding this). Yet there are no users of this
function any more as all users have been made thread-safe (switching
away from ff_codec_open2_recursive() was required for this as said
function requires the caller to hold the lock to the mutex guarding the
initializations and this is only true for codecs with the
FF_CODEC_CAP_INIT_THREADSAFE flag unset); so remove it.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/internal.h
libavcodec/utils.c

index 17defb9b50ec53935be4c710ef13764793ae0ed4..141f3fb88e0d439ade1db2b18e8b2d7611edfd7b 100644 (file)
@@ -306,13 +306,6 @@ int ff_thread_can_start_frame(AVCodecContext *avctx);
 
 int avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx);
 
-/**
- * Call avcodec_open2 recursively by decrementing counter, unlocking mutex,
- * calling the function and then restoring again. Assumes the mutex is
- * already locked
- */
-int ff_codec_open2_recursive(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options);
-
 const uint8_t *avpriv_find_start_code(const uint8_t *p,
                                       const uint8_t *end,
                                       uint32_t *state);
index 45295dd3cedfdb068e32e790c20e701a0da0e3bc..0226e36ee7f2d92f360ca78e714be23408d7e875 100644 (file)
@@ -535,18 +535,6 @@ static void ff_unlock_avcodec(const AVCodec *codec)
         ff_mutex_unlock(&codec_mutex);
 }
 
-int attribute_align_arg ff_codec_open2_recursive(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
-{
-    int ret = 0;
-
-    ff_unlock_avcodec(codec);
-
-    ret = avcodec_open2(avctx, codec, options);
-
-    ff_lock_avcodec(avctx, codec);
-    return ret;
-}
-
 int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
 {
     int ret = 0;