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 <henrika@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25518}
This commit is contained in:
parent
361dbc1973
commit
27f31727d0
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user