From 27f31727d06ad40dc63d6815129f6ff8811371c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Tue, 6 Nov 2018 11:02:46 +0100 Subject: [PATCH] Simplify use of events in TestAudioDevice Create events with |manual_reset| and |initially_signalled| both false (used to be both true). Delete calls to Set and Reset events from the {Start,Stop}{Playout,Recording} methods. Then, for each event, there remains a single call to Set, in the ProcessingAudio loop, and a single call to Wait, in WaitForPlayoutEnd and WaitForRecordingEnd, respectively. Bug: webrtc:9962 Change-Id: Ia358b4a36896e2378ad6166f3786d8d71392bf1b Reviewed-on: https://webrtc-review.googlesource.com/c/109562 Reviewed-by: Henrik Andreassson Commit-Queue: Niels Moller Cr-Commit-Position: refs/heads/master@{#25518} --- modules/audio_device/include/test_audio_device.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/modules/audio_device/include/test_audio_device.cc b/modules/audio_device/include/test_audio_device.cc index 23f857654f..7065c69af2 100644 --- a/modules/audio_device/include/test_audio_device.cc +++ b/modules/audio_device/include/test_audio_device.cc @@ -62,8 +62,8 @@ class TestAudioDeviceModuleImpl audio_callback_(nullptr), rendering_(false), capturing_(false), - done_rendering_(true, true), - done_capturing_(true, true), + done_rendering_(false, false), + done_capturing_(false, false), stop_thread_(false) { auto good_sample_rate = [](int sr) { return sr == 8000 || sr == 16000 || sr == 32000 || sr == 44100 || @@ -112,14 +112,12 @@ class TestAudioDeviceModuleImpl rtc::CritScope cs(&lock_); RTC_CHECK(renderer_); rendering_ = true; - done_rendering_.Reset(); return 0; } int32_t StopPlayout() { rtc::CritScope cs(&lock_); rendering_ = false; - done_rendering_.Set(); return 0; } @@ -127,14 +125,12 @@ class TestAudioDeviceModuleImpl rtc::CritScope cs(&lock_); RTC_CHECK(capturer_); capturing_ = true; - done_capturing_.Reset(); return 0; } int32_t StopRecording() { rtc::CritScope cs(&lock_); capturing_ = false; - done_capturing_.Set(); return 0; }