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

Side by Side Diff: media/cast/test/receiver.cc

Issue 481193003: Remove AudioBuffersState usage in Chromium (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix audio muter build buster. Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « media/audio/win/waveout_output_win.cc ('k') | media/cast/test/utility/audio_utility.cc » ('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 <algorithm> 5 #include <algorithm>
6 #include <climits> 6 #include <climits>
7 #include <cstdarg> 7 #include <cstdarg>
8 #include <cstdio> 8 #include <cstdio>
9 #include <deque> 9 #include <deque>
10 #include <map> 10 #include <map>
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 audio_playout_queue_.push_back( 309 audio_playout_queue_.push_back(
310 std::make_pair(playout_time, audio_frame.release())); 310 std::make_pair(playout_time, audio_frame.release()));
311 } 311 }
312 312
313 // End of InProcessReceiver overrides. 313 // End of InProcessReceiver overrides.
314 //////////////////////////////////////////////////////////////////// 314 ////////////////////////////////////////////////////////////////////
315 315
316 //////////////////////////////////////////////////////////////////// 316 ////////////////////////////////////////////////////////////////////
317 // AudioSourceCallback implementation. 317 // AudioSourceCallback implementation.
318 318
319 virtual int OnMoreData(AudioBus* dest, AudioBuffersState buffers_state) 319 virtual int OnMoreData(AudioBus* dest, uint32 total_bytes_delay)
320 OVERRIDE { 320 OVERRIDE {
321 // Note: This method is being invoked by a separate thread unknown to us 321 // Note: This method is being invoked by a separate thread unknown to us
322 // (i.e., outside of CastEnvironment). 322 // (i.e., outside of CastEnvironment).
323 323
324 int samples_remaining = dest->frames(); 324 int samples_remaining = dest->frames();
325 325
326 while (samples_remaining > 0) { 326 while (samples_remaining > 0) {
327 // Get next audio frame ready for playout. 327 // Get next audio frame ready for playout.
328 if (!currently_playing_audio_frame_.get()) { 328 if (!currently_playing_audio_frame_.get()) {
329 base::AutoLock auto_lock(audio_lock_); 329 base::AutoLock auto_lock(audio_lock_);
330 330
331 // Prune the queue, skipping entries that are too old. 331 // Prune the queue, skipping entries that are too old.
332 // TODO(miu): Use |buffers_state| to account for audio buffering delays 332 // TODO(miu): Use |total_bytes_delay| to account for audio buffering
333 // upstream. 333 // delays upstream.
334 const base::TimeTicks earliest_time_to_play = 334 const base::TimeTicks earliest_time_to_play =
335 cast_env()->Clock()->NowTicks() - max_frame_age_; 335 cast_env()->Clock()->NowTicks() - max_frame_age_;
336 while (!audio_playout_queue_.empty() && 336 while (!audio_playout_queue_.empty() &&
337 audio_playout_queue_.front().first < earliest_time_to_play) { 337 audio_playout_queue_.front().first < earliest_time_to_play) {
338 PopOneAudioFrame(true); 338 PopOneAudioFrame(true);
339 } 339 }
340 if (audio_playout_queue_.empty()) 340 if (audio_playout_queue_.empty())
341 break; 341 break;
342 342
343 currently_playing_audio_frame_ = PopOneAudioFrame(false).Pass(); 343 currently_playing_audio_frame_ = PopOneAudioFrame(false).Pass();
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 audio_config, 592 audio_config,
593 video_config, 593 video_config,
594 window_width, 594 window_width,
595 window_height); 595 window_height);
596 player.Start(); 596 player.Start();
597 597
598 base::MessageLoop().Run(); // Run forever (i.e., until SIGTERM). 598 base::MessageLoop().Run(); // Run forever (i.e., until SIGTERM).
599 NOTREACHED(); 599 NOTREACHED();
600 return 0; 600 return 0;
601 } 601 }
OLDNEW
« no previous file with comments | « media/audio/win/waveout_output_win.cc ('k') | media/cast/test/utility/audio_utility.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698