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

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

Issue 2452183003: Revert of Make more media APIs aware of |delay| and |delay_timestamp| (Closed)
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « media/blink/webaudiosourceprovider_impl.cc ('k') | media/renderers/audio_renderer_impl.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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 ASSERT_EQ(fake_callback_.last_frames_delayed(), -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(base::TimeDelta(), base::TimeTicks::Now(), 0, 218 fake_callback_.Render(bus2.get(), 0, 0);
219 bus2.get());
220 bus2->Scale(kTestVolume); 219 bus2->Scale(kTestVolume);
221 220
222 fake_callback_.reset(); 221 fake_callback_.reset();
223 wasp_impl_->SetVolume(kTestVolume); 222 wasp_impl_->SetVolume(kTestVolume);
224 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer()); 223 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer());
225 ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get())); 224 ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get()));
226 225
227 // Pause should return to silence. 226 // Pause should return to silence.
228 wasp_impl_->Pause(); 227 wasp_impl_->Pause();
229 bus1->channel(0)[0] = 1; 228 bus1->channel(0)[0] = 1;
230 bus2->Zero(); 229 bus2->Zero();
231 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer()); 230 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer());
232 ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get())); 231 ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get()));
233 232
234 // Ensure if a renderer properly fill silence for partial Render() calls by 233 // Ensure if a renderer properly fill silence for partial Render() calls by
235 // configuring the fake callback to return half the data. After these calls 234 // configuring the fake callback to return half the data. After these calls
236 // bus1 is full of junk data, and bus2 is partially filled. 235 // bus1 is full of junk data, and bus2 is partially filled.
237 wasp_impl_->SetVolume(1); 236 wasp_impl_->SetVolume(1);
238 fake_callback_.Render(base::TimeDelta(), base::TimeTicks::Now(), 0, 237 fake_callback_.Render(bus1.get(), 0, 0);
239 bus1.get());
240 fake_callback_.reset(); 238 fake_callback_.reset();
241 fake_callback_.Render(base::TimeDelta(), base::TimeTicks::Now(), 0, 239 fake_callback_.Render(bus2.get(), 0, 0);
242 bus2.get());
243 bus2->ZeroFramesPartial(bus2->frames() / 2, 240 bus2->ZeroFramesPartial(bus2->frames() / 2,
244 bus2->frames() - bus2->frames() / 2); 241 bus2->frames() - bus2->frames() / 2);
245 fake_callback_.reset(); 242 fake_callback_.reset();
246 fake_callback_.set_half_fill(true); 243 fake_callback_.set_half_fill(true);
247 wasp_impl_->Play(); 244 wasp_impl_->Play();
248 245
249 // Play should return real audio data again, but the last half should be zero. 246 // Play should return real audio data again, but the last half should be zero.
250 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer()); 247 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer());
251 ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get())); 248 ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get()));
252 249
(...skipping 17 matching lines...) Expand all
270 Render(bus1.get()); 267 Render(bus1.get());
271 268
272 wasp_impl_->ClearCopyAudioCallback(); 269 wasp_impl_->ClearCopyAudioCallback();
273 EXPECT_CALL(*this, DoCopyAudioCB(_, _, _)).Times(0); 270 EXPECT_CALL(*this, DoCopyAudioCB(_, _, _)).Times(0);
274 Render(bus1.get()); 271 Render(bus1.get());
275 272
276 testing::Mock::VerifyAndClear(mock_sink_.get()); 273 testing::Mock::VerifyAndClear(mock_sink_.get());
277 } 274 }
278 275
279 } // namespace media 276 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webaudiosourceprovider_impl.cc ('k') | media/renderers/audio_renderer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698