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

Unified Diff: webrtc/modules/audio_coding/test/PCMFile.cc

Issue 1513223002: Reduce the runtime of some ACM tests in modules_tests (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing win64 build Created 5 years 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
« no previous file with comments | « webrtc/modules/audio_coding/test/PCMFile.h ('k') | webrtc/modules/audio_coding/test/TestAllCodecs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/test/PCMFile.cc
diff --git a/webrtc/modules/audio_coding/test/PCMFile.cc b/webrtc/modules/audio_coding/test/PCMFile.cc
index 0466e0222c1dbf90a9cbfba9a11f5205114abed6..9289d73baa7e044b14fe3e8a03c7f51b8e9e04db 100644
--- a/webrtc/modules/audio_coding/test/PCMFile.cc
+++ b/webrtc/modules/audio_coding/test/PCMFile.cc
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "PCMFile.h"
+#include "webrtc/modules/audio_coding/test/PCMFile.h"
#include <ctype.h>
#include <stdio.h>
@@ -137,6 +137,9 @@ int32_t PCMFile::Read10MsData(AudioFrame& audio_frame) {
audio_frame.num_channels_ = channels;
audio_frame.timestamp_ = timestamp_;
timestamp_ += samples_10ms_;
+ ++blocks_read_;
+ if (num_10ms_blocks_to_read_ && blocks_read_ >= *num_10ms_blocks_to_read_)
+ end_of_file_ = true;
return samples_10ms_;
}
@@ -182,11 +185,21 @@ void PCMFile::Write10MsData(int16_t* playout_buffer, size_t length_smpls) {
void PCMFile::Close() {
fclose(pcm_file_);
pcm_file_ = NULL;
+ blocks_read_ = 0;
+}
+
+void PCMFile::FastForward(int num_10ms_blocks) {
+ const int channels = read_stereo_ ? 2 : 1;
+ long num_bytes_to_move =
+ num_10ms_blocks * sizeof(int16_t) * samples_10ms_ * channels;
+ int error = fseek(pcm_file_, num_bytes_to_move, SEEK_CUR);
+ RTC_DCHECK_EQ(error, 0);
}
void PCMFile::Rewind() {
rewind(pcm_file_);
end_of_file_ = false;
+ blocks_read_ = 0;
}
bool PCMFile::Rewinded() {
@@ -201,4 +214,8 @@ void PCMFile::ReadStereo(bool is_stereo) {
read_stereo_ = is_stereo;
}
+void PCMFile::SetNum10MsBlocksToRead(int value) {
+ num_10ms_blocks_to_read_ = rtc::Optional<int>(value);
+}
+
} // namespace webrtc
« no previous file with comments | « webrtc/modules/audio_coding/test/PCMFile.h ('k') | webrtc/modules/audio_coding/test/TestAllCodecs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698