Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(715)

Unified Diff: webrtc/modules/audio_device/test/func_test_manager.cc

Issue 2054373002: FileWrapper[Impl] modifications and actually remove the "Impl" class. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix use of ASSERT instead of ASSERT_TRUE in test Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_device/test/func_test_manager.cc
diff --git a/webrtc/modules/audio_device/test/func_test_manager.cc b/webrtc/modules/audio_device/test/func_test_manager.cc
index f16f296011bcfa2bebed4bce805530848ab1d9e0..6e58841b22f0a3108eb31ca69d5d9b017fed31db 100644
--- a/webrtc/modules/audio_device/test/func_test_manager.cc
+++ b/webrtc/modules/audio_device/test/func_test_manager.cc
@@ -169,15 +169,10 @@ int32_t AudioTransportImpl::SetFilePlayout(bool enable, const char* fileName)
{
_playFromFile = enable;
if (enable)
- {
- return (_playFile.OpenFile(fileName, true, true, false));
- } else
- {
- _playFile.Flush();
- return (_playFile.CloseFile());
- }
+ return _playFile.OpenFile(fileName, true) ? 0 : -1;
+ _playFile.CloseFile();
+ return 0;
}
-;
void AudioTransportImpl::SetFullDuplex(bool enable)
{
@@ -462,36 +457,31 @@ int32_t AudioTransportImpl::NeedMorePlayData(
}
} // if (_fullDuplex)
- if (_playFromFile && _playFile.Open())
- {
- int16_t fileBuf[480];
-
- // read mono-file
- int32_t len = _playFile.Read((int8_t*) fileBuf, 2 * nSamples);
- if (len != 2 * (int32_t) nSamples)
- {
- _playFile.Rewind();
- _playFile.Read((int8_t*) fileBuf, 2 * nSamples);
- }
-
- // convert to stero if required
- if (nChannels == 1)
- {
- memcpy(audioSamples, fileBuf, 2 * nSamples);
- } else
- {
- // mono sample from file is duplicated and sent to left and right
- // channels
- int16_t* audio16 = (int16_t*) audioSamples;
- for (size_t i = 0; i < nSamples; i++)
- {
- (*audio16) = fileBuf[i]; // left
- audio16++;
- (*audio16) = fileBuf[i]; // right
- audio16++;
- }
+ if (_playFromFile && _playFile.is_open()) {
+ int16_t fileBuf[480];
+
+ // read mono-file
+ int32_t len = _playFile.Read((int8_t*)fileBuf, 2 * nSamples);
+ if (len != 2 * (int32_t)nSamples) {
+ _playFile.Rewind();
+ _playFile.Read((int8_t*)fileBuf, 2 * nSamples);
+ }
+
+ // convert to stero if required
+ if (nChannels == 1) {
+ memcpy(audioSamples, fileBuf, 2 * nSamples);
+ } else {
+ // mono sample from file is duplicated and sent to left and right
+ // channels
+ int16_t* audio16 = (int16_t*)audioSamples;
+ for (size_t i = 0; i < nSamples; i++) {
+ (*audio16) = fileBuf[i]; // left
+ audio16++;
+ (*audio16) = fileBuf[i]; // right
+ audio16++;
}
- } // if (_playFromFile && _playFile.Open())
+ }
+ } // if (_playFromFile && _playFile.is_open())
_playCount++;
« no previous file with comments | « webrtc/modules/audio_device/dummy/file_audio_device.cc ('k') | webrtc/modules/audio_processing/audio_processing_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698