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

Unified Diff: media/audio/audio_output_device_unittest.cc

Issue 10823175: Switch AudioRenderSink::Callback to use AudioBus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup MCR AudioBus usage. Created 8 years, 4 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
« no previous file with comments | « media/audio/audio_output_device.cc ('k') | media/audio/audio_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_output_device_unittest.cc
diff --git a/media/audio/audio_output_device_unittest.cc b/media/audio/audio_output_device_unittest.cc
index 8133f341f17e9172e5640a8288a34f9e7b7c7cc9..152e958b3a492402b99e2515b943aa9715633234 100644
--- a/media/audio/audio_output_device_unittest.cc
+++ b/media/audio/audio_output_device_unittest.cc
@@ -35,9 +35,7 @@ class MockRenderCallback : public AudioRendererSink::RenderCallback {
MockRenderCallback() {}
virtual ~MockRenderCallback() {}
- MOCK_METHOD3(Render, int(const std::vector<float*>& audio_data,
- int number_of_frames,
- int audio_delay_milliseconds));
+ MOCK_METHOD2(Render, int(AudioBus* audio_bus, int audio_delay_milliseconds));
MOCK_METHOD0(OnRenderError, void());
};
@@ -87,19 +85,6 @@ ACTION_P(QuitLoop, loop) {
loop->PostTask(FROM_HERE, MessageLoop::QuitClosure());
}
-// Zeros out |number_of_frames| in all channel buffers pointed to by
-// the |audio_data| vector.
-void ZeroAudioData(int number_of_frames,
- const std::vector<float*>& audio_data) {
- std::vector<float*>::const_iterator it = audio_data.begin();
- for (; it != audio_data.end(); ++it) {
- float* channel = *it;
- for (int j = 0; j < number_of_frames; ++j) {
- channel[j] = 0.0f;
- }
- }
-}
-
} // namespace.
class AudioOutputDeviceTest : public testing::Test {
@@ -222,21 +207,10 @@ TEST_F(AudioOutputDeviceTest, CreateStream) {
// So, for the sake of this test, we consider the call to Render a sign
// of success and quit the loop.
- // A note on the call to ZeroAudioData():
- // Valgrind caught a bug in AudioOutputDevice::AudioThreadCallback::Process()
- // whereby we always interleaved all the frames in the buffer regardless
- // of how many were actually rendered. So to keep the benefits of that
- // test, we explicitly pass 0 in here as the number of frames to
- // ZeroAudioData(). Other tests might want to pass the requested number
- // by using WithArgs<1, 0>(Invoke(&ZeroAudioData)) and set the return
- // value accordingly.
const int kNumberOfFramesToProcess = 0;
- EXPECT_CALL(callback_, Render(_, _, _))
+ EXPECT_CALL(callback_, Render(_, _))
.WillOnce(DoAll(
- WithArgs<0>(Invoke(
- testing::CreateFunctor(&ZeroAudioData,
- kNumberOfFramesToProcess))),
QuitLoop(io_loop_.message_loop_proxy()),
Return(kNumberOfFramesToProcess)));
« no previous file with comments | « media/audio/audio_output_device.cc ('k') | media/audio/audio_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698