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

Unified Diff: media/base/multi_channel_resampler_unittest.cc

Issue 11410012: Collapse AudioRendererMixer and OnMoreDataResampler into AudioTransform. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename. Comments. Created 8 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 | « media/base/multi_channel_resampler.cc ('k') | media/media.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/multi_channel_resampler_unittest.cc
diff --git a/media/base/multi_channel_resampler_unittest.cc b/media/base/multi_channel_resampler_unittest.cc
index 623c9ef3dc096a2e39baa8c564796a7d8600291a..ad675500c80a0fb17cf5a005847bcdd3dd599a71 100644
--- a/media/base/multi_channel_resampler_unittest.cc
+++ b/media/base/multi_channel_resampler_unittest.cc
@@ -37,7 +37,9 @@ static const double kHighLatencyMaxError = 0.04;
class MultiChannelResamplerTest
: public testing::TestWithParam<int> {
public:
- MultiChannelResamplerTest() {}
+ MultiChannelResamplerTest()
+ : last_frame_delay_(-1) {
+ }
virtual ~MultiChannelResamplerTest() {}
void InitializeAudioData(int channels, int frames) {
@@ -47,7 +49,10 @@ class MultiChannelResamplerTest
// MultiChannelResampler::MultiChannelAudioSourceProvider implementation, just
// fills the provided audio_data with |kFillValue|.
- virtual void ProvideInput(AudioBus* audio_bus) {
+ virtual void ProvideInput(int frame_delay, AudioBus* audio_bus) {
+ EXPECT_GT(frame_delay, last_frame_delay_);
+ last_frame_delay_ = frame_delay;
+
float fill_value = fill_junk_values_ ? (1 / kFillValue) : kFillValue;
EXPECT_EQ(audio_bus->channels(), audio_bus_->channels());
for (int i = 0; i < audio_bus->channels(); ++i)
@@ -58,15 +63,19 @@ class MultiChannelResamplerTest
void MultiChannelTest(int channels, int frames, double expected_max_rms_error,
double expected_max_error) {
InitializeAudioData(channels, frames);
- MultiChannelResampler resampler(
- channels, kScaleFactor, base::Bind(
- &MultiChannelResamplerTest::ProvideInput,
- base::Unretained(this)));
+ MultiChannelResampler resampler(channels, kScaleFactor, base::Bind(
+ &MultiChannelResamplerTest::ProvideInput, base::Unretained(this)));
+
// First prime the resampler with some junk data, so we can verify Flush().
fill_junk_values_ = true;
resampler.Resample(audio_bus_.get(), 1);
resampler.Flush();
fill_junk_values_ = false;
+
+ // The last frame delay should be strictly less than the total frame count.
+ EXPECT_LT(last_frame_delay_, audio_bus_->frames());
+ last_frame_delay_ = -1;
+
// If Flush() didn't work, the rest of the tests will fail.
resampler.Resample(audio_bus_.get(), frames);
TestValues(expected_max_rms_error, expected_max_error);
@@ -108,6 +117,7 @@ class MultiChannelResamplerTest
int frames_;
bool fill_junk_values_;
scoped_ptr<AudioBus> audio_bus_;
+ int last_frame_delay_;
DISALLOW_COPY_AND_ASSIGN(MultiChannelResamplerTest);
};
« no previous file with comments | « media/base/multi_channel_resampler.cc ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698