OLD | NEW |
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 Loading... |
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(bus2.get(), 0, 0); | 218 fake_callback_.Render(base::TimeDelta(), base::TimeTicks::Now(), 0, |
| 219 bus2.get()); |
219 bus2->Scale(kTestVolume); | 220 bus2->Scale(kTestVolume); |
220 | 221 |
221 fake_callback_.reset(); | 222 fake_callback_.reset(); |
222 wasp_impl_->SetVolume(kTestVolume); | 223 wasp_impl_->SetVolume(kTestVolume); |
223 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer()); | 224 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer()); |
224 ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get())); | 225 ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get())); |
225 | 226 |
226 // Pause should return to silence. | 227 // Pause should return to silence. |
227 wasp_impl_->Pause(); | 228 wasp_impl_->Pause(); |
228 bus1->channel(0)[0] = 1; | 229 bus1->channel(0)[0] = 1; |
229 bus2->Zero(); | 230 bus2->Zero(); |
230 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer()); | 231 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer()); |
231 ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get())); | 232 ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get())); |
232 | 233 |
233 // Ensure if a renderer properly fill silence for partial Render() calls by | 234 // Ensure if a renderer properly fill silence for partial Render() calls by |
234 // configuring the fake callback to return half the data. After these calls | 235 // configuring the fake callback to return half the data. After these calls |
235 // bus1 is full of junk data, and bus2 is partially filled. | 236 // bus1 is full of junk data, and bus2 is partially filled. |
236 wasp_impl_->SetVolume(1); | 237 wasp_impl_->SetVolume(1); |
237 fake_callback_.Render(bus1.get(), 0, 0); | 238 fake_callback_.Render(base::TimeDelta(), base::TimeTicks::Now(), 0, |
| 239 bus1.get()); |
238 fake_callback_.reset(); | 240 fake_callback_.reset(); |
239 fake_callback_.Render(bus2.get(), 0, 0); | 241 fake_callback_.Render(base::TimeDelta(), base::TimeTicks::Now(), 0, |
| 242 bus2.get()); |
240 bus2->ZeroFramesPartial(bus2->frames() / 2, | 243 bus2->ZeroFramesPartial(bus2->frames() / 2, |
241 bus2->frames() - bus2->frames() / 2); | 244 bus2->frames() - bus2->frames() / 2); |
242 fake_callback_.reset(); | 245 fake_callback_.reset(); |
243 fake_callback_.set_half_fill(true); | 246 fake_callback_.set_half_fill(true); |
244 wasp_impl_->Play(); | 247 wasp_impl_->Play(); |
245 | 248 |
246 // Play should return real audio data again, but the last half should be zero. | 249 // Play should return real audio data again, but the last half should be zero. |
247 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer()); | 250 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer()); |
248 ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get())); | 251 ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get())); |
249 | 252 |
(...skipping 17 matching lines...) Expand all Loading... |
267 Render(bus1.get()); | 270 Render(bus1.get()); |
268 | 271 |
269 wasp_impl_->ClearCopyAudioCallback(); | 272 wasp_impl_->ClearCopyAudioCallback(); |
270 EXPECT_CALL(*this, DoCopyAudioCB(_, _, _)).Times(0); | 273 EXPECT_CALL(*this, DoCopyAudioCB(_, _, _)).Times(0); |
271 Render(bus1.get()); | 274 Render(bus1.get()); |
272 | 275 |
273 testing::Mock::VerifyAndClear(mock_sink_.get()); | 276 testing::Mock::VerifyAndClear(mock_sink_.get()); |
274 } | 277 } |
275 | 278 |
276 } // namespace media | 279 } // namespace media |
OLD | NEW |