Bug 911450: followup, fix CriticalSectionScoped scope NPOTB r=jesup
authorLandry Breuil <landry@openbsd.org>
Tue, 17 Nov 2015 19:05:52 +0100
changeset 273028 2a05b69065e655f8123fd7b1412c066fffaef6de
parent 273027 65fd70e90f5c10654d1984353d6dd42b97589d39
child 273029 29001cebc62c4366d36ef36ab79c75c3800a7984
push id29693
push usercbook@mozilla.com
push dateWed, 18 Nov 2015 13:50:33 +0000
treeherdermozilla-central@1d6155d7e6c9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs911450
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 911450: followup, fix CriticalSectionScoped scope NPOTB r=jesup
media/webrtc/trunk/webrtc/modules/audio_device/sndio/audio_device_sndio.cc
--- a/media/webrtc/trunk/webrtc/modules/audio_device/sndio/audio_device_sndio.cc
+++ b/media/webrtc/trunk/webrtc/modules/audio_device/sndio/audio_device_sndio.cc
@@ -742,25 +742,27 @@ int32_t AudioDeviceSndio::StartRecording
     }
     _recording = true;
     return 0;
 }
 
 int32_t AudioDeviceSndio::StopRecording()
 {
 
-    CriticalSectionScoped lock(&_critSect);
+    {
+      CriticalSectionScoped lock(&_critSect);
 
-    if (_recHandle == NULL)
-    {
-        return 0;
+      if (_recHandle == NULL)
+      {
+          return 0;
+      }
+
+      _recording = false;
     }
 
-    _recording = false;
-
     if (_ptrThreadRec && !_ptrThreadRec->Stop())
     {
         WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id,
                      "    failed to stop the rec audio thread");
         return -1;
     }
 
     sio_stop(_recHandle);
@@ -836,22 +838,25 @@ int32_t AudioDeviceSndio::StartPlayout()
         return -1;
     }
     _playing = true;
     return 0;
 }
 
 int32_t AudioDeviceSndio::StopPlayout()
 {
-    CriticalSectionScoped lock(&_critSect);
-    if (_playHandle == NULL)
+
     {
-        return 0;
+      CriticalSectionScoped lock(&_critSect);
+      if (_playHandle == NULL)
+      {
+          return 0;
+      }
+      _playing = false;
     }
-    _playing = false;
 
     if (_ptrThreadPlay && !_ptrThreadPlay->Stop())
     {
         WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id,
                      "  failed to stop the play audio thread");
         return -1;
     } else {
         delete _ptrThreadPlay;