Merge pull request #25419 from vrabaud:ffmpeg

Fix race condition in InternalFFMpegRegister initialization. #25419

initLogger_ does not check if the logger has been initizalized before and it might initialize it several times from different threads, racing with other threads that are logging.

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
pull/25439/head
Vincent Rabaud 10 months ago committed by GitHub
parent 05a54b1405
commit c317a3ee89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      modules/videoio/src/cap_ffmpeg_impl.hpp

@ -927,7 +927,6 @@ public:
if(!threadSafe)
lock.lock();
static InternalFFMpegRegister instance;
initLogger_(); // update logger setup unconditionally (GStreamer's libav plugin may override these settings)
}
static void initLogger_()
{
@ -965,6 +964,7 @@ public:
/* register a callback function for synchronization */
av_lockmgr_register(&LockCallBack);
#endif
initLogger_();
}
~InternalFFMpegRegister()
{

Loading…
Cancel
Save