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

Side by Side Diff: media/blink/webaudiosourceprovider_impl_unittest.cc

Issue 2004283002: AudioConverter: Express delay in frames rather than msec. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missed files & removed rounding Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « media/base/loopback_audio_converter.cc ('k') | media/cast/test/fake_media_source.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 190
191 wasp_impl_->Initialize(params_, &fake_callback_); 191 wasp_impl_->Initialize(params_, &fake_callback_);
192 SetClient(this); 192 SetClient(this);
193 193
194 // Verify provideInput() is muted prior to Start() and no calls to the render 194 // Verify provideInput() is muted prior to Start() and no calls to the render
195 // callback have occurred. 195 // callback have occurred.
196 bus1->channel(0)[0] = 1; 196 bus1->channel(0)[0] = 1;
197 bus2->Zero(); 197 bus2->Zero();
198 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer()); 198 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer());
199 ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get())); 199 ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get()));
200 ASSERT_EQ(fake_callback_.last_audio_delay_milliseconds(), -1); 200 ASSERT_EQ(fake_callback_.last_frames_delayed(), -1);
201 201
202 wasp_impl_->Start(); 202 wasp_impl_->Start();
203 203
204 // Ditto for Play(). 204 // Ditto for Play().
205 bus1->channel(0)[0] = 1; 205 bus1->channel(0)[0] = 1;
206 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer()); 206 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer());
207 ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get())); 207 ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get()));
208 ASSERT_EQ(fake_callback_.last_audio_delay_milliseconds(), -1); 208 ASSERT_EQ(fake_callback_.last_frames_delayed(), -1);
209 209
210 wasp_impl_->Play(); 210 wasp_impl_->Play();
211 211
212 // Now we should get real audio data. 212 // Now we should get real audio data.
213 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer()); 213 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer());
214 ASSERT_FALSE(CompareBusses(bus1.get(), bus2.get())); 214 ASSERT_FALSE(CompareBusses(bus1.get(), bus2.get()));
215 215
216 // Ensure volume adjustment is working. 216 // Ensure volume adjustment is working.
217 fake_callback_.reset(); 217 fake_callback_.reset();
218 fake_callback_.Render(bus2.get(), 0, 0); 218 fake_callback_.Render(bus2.get(), 0, 0);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 Render(bus1.get()); 267 Render(bus1.get());
268 268
269 wasp_impl_->ClearCopyAudioCallback(); 269 wasp_impl_->ClearCopyAudioCallback();
270 EXPECT_CALL(*this, DoCopyAudioCB(_, _, _)).Times(0); 270 EXPECT_CALL(*this, DoCopyAudioCB(_, _, _)).Times(0);
271 Render(bus1.get()); 271 Render(bus1.get());
272 272
273 testing::Mock::VerifyAndClear(mock_sink_.get()); 273 testing::Mock::VerifyAndClear(mock_sink_.get());
274 } 274 }
275 275
276 } // namespace media 276 } // namespace media
OLDNEW
« no previous file with comments | « media/base/loopback_audio_converter.cc ('k') | media/cast/test/fake_media_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698