Remove explicit locking using av_lockmgr_register
av_lockmgr_register is deprecated and no-op since
a04c2c707d
Bug: webrtc:8745
Change-Id: I284c9a6edf88a584c3a5cb5dfae4ccf1be1f8851
Reviewed-on: https://webrtc-review.googlesource.com/39503
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23508}
This commit is contained in:

committed by
Commit Bot

parent
520ca4e3b8
commit
adb4841173
@ -50,37 +50,9 @@ enum H264DecoderImplEvent {
|
|||||||
rtc::CriticalSection ffmpeg_init_lock;
|
rtc::CriticalSection ffmpeg_init_lock;
|
||||||
bool ffmpeg_initialized = false;
|
bool ffmpeg_initialized = false;
|
||||||
|
|
||||||
// Called by FFmpeg to do mutex operations if initialized using
|
|
||||||
// |InitializeFFmpeg|. Disabling thread safety analysis because void** does not
|
|
||||||
// play nicely with thread_annotations.h macros.
|
|
||||||
int LockManagerOperation(void** lock,
|
|
||||||
AVLockOp op) RTC_NO_THREAD_SAFETY_ANALYSIS {
|
|
||||||
switch (op) {
|
|
||||||
case AV_LOCK_CREATE:
|
|
||||||
*lock = new rtc::CriticalSection();
|
|
||||||
return 0;
|
|
||||||
case AV_LOCK_OBTAIN:
|
|
||||||
static_cast<rtc::CriticalSection*>(*lock)->Enter();
|
|
||||||
return 0;
|
|
||||||
case AV_LOCK_RELEASE:
|
|
||||||
static_cast<rtc::CriticalSection*>(*lock)->Leave();
|
|
||||||
return 0;
|
|
||||||
case AV_LOCK_DESTROY:
|
|
||||||
delete static_cast<rtc::CriticalSection*>(*lock);
|
|
||||||
*lock = nullptr;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
RTC_NOTREACHED() << "Unrecognized AVLockOp.";
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void InitializeFFmpeg() {
|
void InitializeFFmpeg() {
|
||||||
rtc::CritScope cs(&ffmpeg_init_lock);
|
rtc::CritScope cs(&ffmpeg_init_lock);
|
||||||
if (!ffmpeg_initialized) {
|
if (!ffmpeg_initialized) {
|
||||||
if (av_lockmgr_register(LockManagerOperation) < 0) {
|
|
||||||
RTC_NOTREACHED() << "av_lockmgr_register failed.";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
av_register_all();
|
av_register_all();
|
||||||
ffmpeg_initialized = true;
|
ffmpeg_initialized = true;
|
||||||
}
|
}
|
||||||
@ -200,12 +172,12 @@ int32_t H264DecoderImpl::InitDecode(const VideoCodec* codec_settings,
|
|||||||
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FFmpeg must have been initialized (with |av_lockmgr_register| and
|
// FFmpeg must have been initialized (with |av_register_all|) before we
|
||||||
// |av_register_all|) before we proceed. |InitializeFFmpeg| does this, which
|
// proceed. |InitializeFFmpeg| does this, which makes sense for WebRTC
|
||||||
// makes sense for WebRTC standalone. In other cases, such as Chromium, FFmpeg
|
// standalone. In other cases, such as Chromium, FFmpeg is initialized
|
||||||
// is initialized externally and calling |InitializeFFmpeg| would be
|
// externally and calling |InitializeFFmpeg| would be thread-unsafe and result
|
||||||
// thread-unsafe and result in FFmpeg being initialized twice, which could
|
// in FFmpeg being initialized twice, which could break other FFmpeg usage.
|
||||||
// break other FFmpeg usage. See the |rtc_initialize_ffmpeg| flag.
|
// See the |rtc_initialize_ffmpeg| flag.
|
||||||
#if defined(WEBRTC_INITIALIZE_FFMPEG)
|
#if defined(WEBRTC_INITIALIZE_FFMPEG)
|
||||||
// Make sure FFmpeg has been initialized. Subsequent |InitializeFFmpeg| calls
|
// Make sure FFmpeg has been initialized. Subsequent |InitializeFFmpeg| calls
|
||||||
// do nothing.
|
// do nothing.
|
||||||
|
Reference in New Issue
Block a user