Videoio: FFMpeg remove locks from VideoCapure/VideoWriter::open() to fix 20114#23601
Conversation
47ae518 to
17c30e6
Compare
17c30e6 to
6711bf8
Compare
|
@mshabunin Should all the FFmpeg environmental variables be documented somewhere? e.g. |
6711bf8 to
41b2acd
Compare
|
@cudawarped , yes, ideally all available environment variables should be documented. But we do not have such page yet. Some information is scattered through the wiki. |
| } | ||
|
|
||
| static bool isThreadSafe() { | ||
| const bool threadSafe = utils::getConfigurationParameterBool("OPENCV_FFMPEG_IS_THREAD_SAFE", false); |
There was a problem hiding this comment.
Will this make any difference if the the scope of threadSafe is limited to isThreadSafe?
There was a problem hiding this comment.
It depends on what we need.
static- make variable with "global" lifetime and execute rhs expression once- no
static- read configuration on every call. We should not do that for performance sensitive cases, but there is no performance problem in the current case.
41b2acd to
99ef35a
Compare
mshabunin
left a comment
There was a problem hiding this comment.
I tried to run it and it works well. And I have one more suggestion 🙂 Maybe we should rename environment variable to work the other way: OPENCV_FFMPEG_DISABLE_LOCKS (default 0) or OPENCV_FFMPEG_ENABLE_LOCKS (default 1), so that its name would directly state what it does.
Though this is just naming suggestion, overall the PR looks good to me.
Remove locks added in #9006 from
VideoCapure/VideoWriter::open()when using the FFMpeg backend to fix #20114.Locks are removed if
OPENCV_FFMPEG_IS_THREAD_SAFE==true.Should I add a test? If so it would need to be skipped on Windows to avoid build bot failures and it may be confusing when it fails on user's machines?
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.