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}
This commit is contained in:
Pengyu Liao
2017-11-27 15:15:53 -08:00
committed by Commit Bot
parent 43d069a2cd
commit 570cf968eb

View File

@ -140,6 +140,14 @@ int32_t FileAudioDevice::PlayoutIsAvailable(bool& available) {
}
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 @@ int32_t FileAudioDevice::InitPlayout() {
}
bool FileAudioDevice::PlayoutIsInitialized() const {
return true;
return _playoutFramesIn10MS != 0;
}
int32_t FileAudioDevice::RecordingIsAvailable(bool& available) {
@ -186,7 +194,6 @@ int32_t FileAudioDevice::StartPlayout() {
return 0;
}
_playoutFramesIn10MS = static_cast<size_t>(kPlayoutFixedSampleRate / 100);
_playing = true;
_playoutFramesLeft = 0;
@ -243,7 +250,7 @@ int32_t FileAudioDevice::StopPlayout() {
}
bool FileAudioDevice::Playing() const {
return true;
return _playing;
}
int32_t FileAudioDevice::StartRecording() {