Swap use of CriticalSectionWrapper for rtc::CriticalSection in webrtc/video.
While doing this, I made a couple of minor changes:
* Removed unused variables (one lock and one video frame variable)
* Switched over to a scoped lock in remb.cc and removed an if() in a function where we can just return the expression being checked.

BUG=
R=mflodman@webrtc.org

Review URL: https://codereview.webrtc.org/1613053003 .

Cr-Original-Commit-Position: refs/heads/master@{#11349}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 97888bd95a32c0fe3709a096cf37e116320f29e4
diff --git a/video/vie_receiver.cc b/video/vie_receiver.cc
index 4fb706c..da14a3c 100644
--- a/video/vie_receiver.cc
+++ b/video/vie_receiver.cc
@@ -23,7 +23,6 @@
 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h"
 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
 #include "webrtc/modules/video_coding/include/video_coding.h"
-#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
 #include "webrtc/system_wrappers/include/metrics.h"
 #include "webrtc/system_wrappers/include/tick_util.h"
 #include "webrtc/system_wrappers/include/timestamp_extrapolator.h"
@@ -36,8 +35,7 @@
 ViEReceiver::ViEReceiver(VideoCodingModule* module_vcm,
                          RemoteBitrateEstimator* remote_bitrate_estimator,
                          RtpFeedback* rtp_feedback)
-    : receive_cs_(CriticalSectionWrapper::CreateCriticalSection()),
-      clock_(Clock::GetRealTimeClock()),
+    : clock_(Clock::GetRealTimeClock()),
       rtp_header_parser_(RtpHeaderParser::Create()),
       rtp_payload_registry_(
           new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(false))),
@@ -153,7 +151,7 @@
 
 void ViEReceiver::RegisterRtpRtcpModules(
     const std::vector<RtpRtcp*>& rtp_modules) {
-  CriticalSectionScoped cs(receive_cs_.get());
+  rtc::CritScope lock(&receive_cs_);
   // Only change the "simulcast" modules, the base module can be accessed
   // without a lock whereas the simulcast modules require locking as they can be
   // changed in runtime.
@@ -262,7 +260,7 @@
                                  size_t rtp_packet_length,
                                  const PacketTime& packet_time) {
   {
-    CriticalSectionScoped cs(receive_cs_.get());
+    rtc::CritScope lock(&receive_cs_);
     if (!receiving_) {
       return -1;
     }
@@ -283,7 +281,7 @@
 
   {
     // Periodically log the RTP header of incoming packets.
-    CriticalSectionScoped cs(receive_cs_.get());
+    rtc::CritScope lock(&receive_cs_);
     if (now_ms - last_packet_log_ms_ > kPacketLogIntervalMs) {
       std::stringstream ss;
       ss << "Packet received on SSRC: " << header.ssrc << " with payload type: "
@@ -361,7 +359,7 @@
       return false;
     if (packet_length > sizeof(restored_packet_))
       return false;
-    CriticalSectionScoped cs(receive_cs_.get());
+    rtc::CritScope lock(&receive_cs_);
     if (restored_packet_in_use_) {
       LOG(LS_WARNING) << "Multiple RTX headers detected, dropping packet.";
       return false;
@@ -410,7 +408,7 @@
 int ViEReceiver::InsertRTCPPacket(const uint8_t* rtcp_packet,
                                   size_t rtcp_packet_length) {
   {
-    CriticalSectionScoped cs(receive_cs_.get());
+    rtc::CritScope lock(&receive_cs_);
     if (!receiving_) {
       return -1;
     }
@@ -444,12 +442,12 @@
 }
 
 void ViEReceiver::StartReceive() {
-  CriticalSectionScoped cs(receive_cs_.get());
+  rtc::CritScope lock(&receive_cs_);
   receiving_ = true;
 }
 
 void ViEReceiver::StopReceive() {
-  CriticalSectionScoped cs(receive_cs_.get());
+  rtc::CritScope lock(&receive_cs_);
   receiving_ = false;
 }