Fix playout (recording from caller point of view) functionality for FileAudioDevice.
Bug: webrtc:8585
Change-Id: Ied2cbea146560488b07ac74bd3c5009f8804f1a0
Reviewed-on: https://webrtc-review.googlesource.com/26440
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20927}
diff --git a/modules/audio_device/dummy/file_audio_device.cc b/modules/audio_device/dummy/file_audio_device.cc
index af9b569..e02ec6c 100644
--- a/modules/audio_device/dummy/file_audio_device.cc
+++ b/modules/audio_device/dummy/file_audio_device.cc
@@ -140,6 +140,14 @@
}
int32_t FileAudioDevice::InitPlayout() {
+ rtc::CritScope lock(&_critSect);
+
+ if (_playing) {
+ return -1;
+ }
+
+ _playoutFramesIn10MS = static_cast<size_t>(kPlayoutFixedSampleRate / 100);
+
if (_ptrAudioBuffer) {
// Update webrtc audio buffer with the selected parameters
_ptrAudioBuffer->SetPlayoutSampleRate(kPlayoutFixedSampleRate);
@@ -149,7 +157,7 @@
}
bool FileAudioDevice::PlayoutIsInitialized() const {
- return true;
+ return _playoutFramesIn10MS != 0;
}
int32_t FileAudioDevice::RecordingIsAvailable(bool& available) {
@@ -186,7 +194,6 @@
return 0;
}
- _playoutFramesIn10MS = static_cast<size_t>(kPlayoutFixedSampleRate / 100);
_playing = true;
_playoutFramesLeft = 0;
@@ -243,7 +250,7 @@
}
bool FileAudioDevice::Playing() const {
- return true;
+ return _playing;
}
int32_t FileAudioDevice::StartRecording() {