Fix potential deadlock during release of quality analyzing codecs
Bug: webrtc:11407 Change-Id: I45637e39a03a385e0544d4de06786b9508b25ce8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/169728 Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30690}
This commit is contained in:
@ -109,11 +109,15 @@ int32_t QualityAnalyzingVideoDecoder::RegisterDecodeCompleteCallback(
|
||||
}
|
||||
|
||||
int32_t QualityAnalyzingVideoDecoder::Release() {
|
||||
// Release decoder first. During release process it can still decode some
|
||||
// frames, so we don't take a lock to prevent deadlock.
|
||||
int32_t result = delegate_->Release();
|
||||
|
||||
rtc::CritScope crit(&lock_);
|
||||
analyzing_callback_->SetDelegateCallback(nullptr);
|
||||
timestamp_to_frame_id_.clear();
|
||||
decoding_images_.clear();
|
||||
return delegate_->Release();
|
||||
return result;
|
||||
}
|
||||
|
||||
bool QualityAnalyzingVideoDecoder::PrefersLateDecoding() const {
|
||||
|
||||
@ -114,9 +114,13 @@ int32_t QualityAnalyzingVideoEncoder::RegisterEncodeCompleteCallback(
|
||||
}
|
||||
|
||||
int32_t QualityAnalyzingVideoEncoder::Release() {
|
||||
// Release encoder first. During release process it can still encode some
|
||||
// frames, so we don't take a lock to prevent deadlock.
|
||||
int32_t result = delegate_->Release();
|
||||
|
||||
rtc::CritScope crit(&lock_);
|
||||
delegate_callback_ = nullptr;
|
||||
return delegate_->Release();
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t QualityAnalyzingVideoEncoder::Encode(
|
||||
|
||||
Reference in New Issue
Block a user