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}
diff --git a/video/BUILD.gn b/video/BUILD.gn
index 12a316e..97ed965 100644
--- a/video/BUILD.gn
+++ b/video/BUILD.gn
@@ -170,6 +170,7 @@
     "../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" ]
diff --git a/video/video_stream_decoder_impl.cc b/video/video_stream_decoder_impl.cc
index 1e11d38..02ba45e 100644
--- a/video/video_stream_decoder_impl.cc
+++ b/video/video_stream_decoder_impl.cc
@@ -47,7 +47,7 @@
 }
 
 VideoStreamDecoderImpl::~VideoStreamDecoderImpl() {
-  rtc::CritScope lock(&shut_down_crit_);
+  MutexLock lock(&shut_down_mutex_);
   shut_down_ = true;
 }
 
@@ -157,7 +157,7 @@
       RTC_DCHECK(frame);
       SaveFrameTimestamps(*frame);
 
-      rtc::CritScope lock(&shut_down_crit_);
+      MutexLock lock(&shut_down_mutex_);
       if (shut_down_) {
         return;
       }
diff --git a/video/video_stream_decoder_impl.h b/video/video_stream_decoder_impl.h
index 4163afe..2f33e9d 100644
--- a/video/video_stream_decoder_impl.h
+++ b/video/video_stream_decoder_impl.h
@@ -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 @@
   // 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_);