Migrate modules/video_coding to webrtc::Mutex.
Bug: webrtc:11567 Change-Id: I8023fbe7595f7ba8ae7c7db3583fc2e560ec3df2 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178803 Commit-Queue: Markus Handell <handellm@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31644}
This commit is contained in:

committed by
Commit Bot

parent
fb6f975401
commit
6deec38ede
@ -37,7 +37,7 @@ VideoCodecUnitTest::FakeEncodeCompleteCallback::OnEncodedImage(
|
||||
const EncodedImage& frame,
|
||||
const CodecSpecificInfo* codec_specific_info,
|
||||
const RTPFragmentationHeader* fragmentation) {
|
||||
rtc::CritScope lock(&test_->encoded_frame_section_);
|
||||
MutexLock lock(&test_->encoded_frame_section_);
|
||||
test_->encoded_frames_.push_back(frame);
|
||||
RTC_DCHECK(codec_specific_info);
|
||||
test_->codec_specific_infos_.push_back(*codec_specific_info);
|
||||
@ -58,7 +58,7 @@ void VideoCodecUnitTest::FakeDecodeCompleteCallback::Decoded(
|
||||
VideoFrame& frame,
|
||||
absl::optional<int32_t> decode_time_ms,
|
||||
absl::optional<uint8_t> qp) {
|
||||
rtc::CritScope lock(&test_->decoded_frame_section_);
|
||||
MutexLock lock(&test_->decoded_frame_section_);
|
||||
test_->decoded_frame_.emplace(frame);
|
||||
test_->decoded_qp_ = qp;
|
||||
test_->decoded_frame_event_.Set();
|
||||
@ -126,7 +126,7 @@ bool VideoCodecUnitTest::WaitForEncodedFrame(
|
||||
}
|
||||
|
||||
void VideoCodecUnitTest::SetWaitForEncodedFramesThreshold(size_t num_frames) {
|
||||
rtc::CritScope lock(&encoded_frame_section_);
|
||||
MutexLock lock(&encoded_frame_section_);
|
||||
wait_for_encoded_frames_threshold_ = num_frames;
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ bool VideoCodecUnitTest::WaitForEncodedFrames(
|
||||
EXPECT_TRUE(encoded_frame_event_.Wait(kEncodeTimeoutMs))
|
||||
<< "Timed out while waiting for encoded frame.";
|
||||
// This becomes unsafe if there are multiple threads waiting for frames.
|
||||
rtc::CritScope lock(&encoded_frame_section_);
|
||||
MutexLock lock(&encoded_frame_section_);
|
||||
EXPECT_FALSE(encoded_frames_.empty());
|
||||
EXPECT_FALSE(codec_specific_infos_.empty());
|
||||
EXPECT_EQ(encoded_frames_.size(), codec_specific_infos_.size());
|
||||
@ -157,7 +157,7 @@ bool VideoCodecUnitTest::WaitForDecodedFrame(std::unique_ptr<VideoFrame>* frame,
|
||||
bool ret = decoded_frame_event_.Wait(kDecodeTimeoutMs);
|
||||
EXPECT_TRUE(ret) << "Timed out while waiting for a decoded frame.";
|
||||
// This becomes unsafe if there are multiple threads waiting for frames.
|
||||
rtc::CritScope lock(&decoded_frame_section_);
|
||||
MutexLock lock(&decoded_frame_section_);
|
||||
EXPECT_TRUE(decoded_frame_);
|
||||
if (decoded_frame_) {
|
||||
frame->reset(new VideoFrame(std::move(*decoded_frame_)));
|
||||
@ -170,7 +170,7 @@ bool VideoCodecUnitTest::WaitForDecodedFrame(std::unique_ptr<VideoFrame>* frame,
|
||||
}
|
||||
|
||||
size_t VideoCodecUnitTest::GetNumEncodedFrames() {
|
||||
rtc::CritScope lock(&encoded_frame_section_);
|
||||
MutexLock lock(&encoded_frame_section_);
|
||||
return encoded_frames_.size();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user