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

Unified Diff: webrtc/common_audio/wav_file.cc

Issue 1432843002: Add aecdump support to audioproc_f (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add used includes Created 5 years, 1 month 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/common_audio/wav_file.h ('k') | webrtc/modules/audio_processing/audio_processing_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_audio/wav_file.cc
diff --git a/webrtc/common_audio/wav_file.cc b/webrtc/common_audio/wav_file.cc
index 8dae7d6e98cb2fe17145bb435620c0de65ce453d..ac11bcdd7b0a59db39eee30c9853e90dad711ffe 100644
--- a/webrtc/common_audio/wav_file.cc
+++ b/webrtc/common_audio/wav_file.cc
@@ -13,6 +13,7 @@
#include <algorithm>
#include <cstdio>
#include <limits>
+#include <sstream>
#include "webrtc/base/checks.h"
#include "webrtc/base/safe_conversions.h"
@@ -37,9 +38,17 @@ class ReadableWavFile : public ReadableWav {
FILE* file_;
};
+std::string WavFile::FormatAsString() const {
+ std::ostringstream s;
+ s << "Sample rate: " << sample_rate() << " Hz, Channels: " << num_channels()
+ << ", Duration: "
+ << (1.f * num_samples()) / (num_channels() * sample_rate()) << " s";
+ return s.str();
+}
+
WavReader::WavReader(const std::string& filename)
: file_handle_(fopen(filename.c_str(), "rb")) {
- RTC_CHECK(file_handle_ && "Could not open wav file for reading.");
+ RTC_CHECK(file_handle_) << "Could not open wav file for reading.";
ReadableWavFile readable(file_handle_);
WavFormat format;
@@ -96,7 +105,7 @@ WavWriter::WavWriter(const std::string& filename, int sample_rate,
num_channels_(num_channels),
num_samples_(0),
file_handle_(fopen(filename.c_str(), "wb")) {
- RTC_CHECK(file_handle_ && "Could not open wav file for writing.");
+ RTC_CHECK(file_handle_) << "Could not open wav file for writing.";
RTC_CHECK(CheckWavParameters(num_channels_, sample_rate_, kWavFormat,
kBytesPerSample, num_samples_));
« no previous file with comments | « webrtc/common_audio/wav_file.h ('k') | webrtc/modules/audio_processing/audio_processing_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698