Migrate VideoStreamDecoderImpl to webrtc::Mutex.

Bug: webrtc:11567
Change-Id: Ie5ae7aa630f1c702634cf6663853114b4e0f9d9b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179064
Reviewed-by: Magnus Flodman <mflodman@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31698}
This commit is contained in:
Markus Handell 2020-07-10 12:23:48 +02:00 committed by Commit Bot
parent bc633d714d
commit 265931ea3c
3 changed files with 6 additions and 5 deletions

View File

@ -170,6 +170,7 @@ rtc_library("video_stream_decoder_impl") {
"../modules/video_coding",
"../rtc_base:rtc_base_approved",
"../rtc_base:rtc_task_queue",
"../rtc_base/synchronization:mutex",
"../system_wrappers",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]

View File

@ -47,7 +47,7 @@ VideoStreamDecoderImpl::VideoStreamDecoderImpl(
}
VideoStreamDecoderImpl::~VideoStreamDecoderImpl() {
rtc::CritScope lock(&shut_down_crit_);
MutexLock lock(&shut_down_mutex_);
shut_down_ = true;
}
@ -157,7 +157,7 @@ void VideoStreamDecoderImpl::OnNextFrameCallback(
RTC_DCHECK(frame);
SaveFrameTimestamps(*frame);
rtc::CritScope lock(&shut_down_crit_);
MutexLock lock(&shut_down_mutex_);
if (shut_down_) {
return;
}

View File

@ -19,8 +19,8 @@
#include "api/video/video_stream_decoder.h"
#include "modules/video_coding/frame_buffer2.h"
#include "modules/video_coding/timing.h"
#include "rtc_base/critical_section.h"
#include "rtc_base/platform_thread.h"
#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/task_queue.h"
#include "rtc_base/thread_checker.h"
#include "system_wrappers/include/clock.h"
@ -113,8 +113,8 @@ class VideoStreamDecoderImpl : public VideoStreamDecoderInterface {
// safe for the |decode_queue_| to be destructed. After that the |decoder_|
// can be destructed, and then the |bookkeeping_queue_|. Finally the
// |frame_buffer_| can be destructed.
rtc::CriticalSection shut_down_crit_;
bool shut_down_ RTC_GUARDED_BY(shut_down_crit_);
Mutex shut_down_mutex_;
bool shut_down_ RTC_GUARDED_BY(shut_down_mutex_);
video_coding::FrameBuffer frame_buffer_ RTC_GUARDED_BY(bookkeeping_queue_);
rtc::TaskQueue bookkeeping_queue_;
std::unique_ptr<VideoDecoder> decoder_ RTC_GUARDED_BY(decode_queue_);