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

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

Issue 2101303004: Pass delay and timestamp to AudioSourceCallback::OnMoreData. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Fix Mac CQ errors. Created 4 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
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 <limits.h> 5 #include <limits.h>
6 #include <stddef.h> 6 #include <stddef.h>
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <climits> 10 #include <climits>
11 #include <cstdarg> 11 #include <cstdarg>
12 #include <cstdio> 12 #include <cstdio>
13 #include <deque> 13 #include <deque>
14 #include <map> 14 #include <map>
15 #include <memory> 15 #include <memory>
16 #include <string> 16 #include <string>
17 #include <utility> 17 #include <utility>
18 18
19 #include "base/at_exit.h" 19 #include "base/at_exit.h"
20 #include "base/command_line.h" 20 #include "base/command_line.h"
21 #include "base/logging.h" 21 #include "base/logging.h"
22 #include "base/memory/ref_counted.h" 22 #include "base/memory/ref_counted.h"
23 #include "base/message_loop/message_loop.h" 23 #include "base/message_loop/message_loop.h"
24 #include "base/run_loop.h" 24 #include "base/run_loop.h"
25 #include "base/synchronization/lock.h" 25 #include "base/synchronization/lock.h"
26 #include "base/synchronization/waitable_event.h" 26 #include "base/synchronization/waitable_event.h"
27 #include "base/threading/thread.h" 27 #include "base/threading/thread.h"
28 #include "base/time/default_tick_clock.h" 28 #include "base/time/default_tick_clock.h"
29 #include "base/time/time.h"
29 #include "base/timer/timer.h" 30 #include "base/timer/timer.h"
30 #include "media/audio/audio_io.h" 31 #include "media/audio/audio_io.h"
31 #include "media/audio/audio_manager.h" 32 #include "media/audio/audio_manager.h"
32 #include "media/audio/fake_audio_log_factory.h" 33 #include "media/audio/fake_audio_log_factory.h"
33 #include "media/base/audio_bus.h" 34 #include "media/base/audio_bus.h"
34 #include "media/base/audio_parameters.h" 35 #include "media/base/audio_parameters.h"
35 #include "media/base/channel_layout.h" 36 #include "media/base/channel_layout.h"
36 #include "media/base/video_frame.h" 37 #include "media/base/video_frame.h"
37 #include "media/cast/cast_config.h" 38 #include "media/cast/cast_config.h"
38 #include "media/cast/cast_environment.h" 39 #include "media/cast/cast_environment.h"
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 audio_playout_queue_.push_back( 318 audio_playout_queue_.push_back(
318 std::make_pair(playout_time, audio_frame.release())); 319 std::make_pair(playout_time, audio_frame.release()));
319 } 320 }
320 321
321 // End of InProcessReceiver finals. 322 // End of InProcessReceiver finals.
322 //////////////////////////////////////////////////////////////////// 323 ////////////////////////////////////////////////////////////////////
323 324
324 //////////////////////////////////////////////////////////////////// 325 ////////////////////////////////////////////////////////////////////
325 // AudioSourceCallback implementation. 326 // AudioSourceCallback implementation.
326 327
327 int OnMoreData(AudioBus* dest, 328 int OnMoreData(base::TimeDelta /* delay */,
328 uint32_t total_bytes_delay, 329 base::TimeTicks /* delay_timestamp */,
329 uint32_t frames_skipped) final { 330 int /* prior_frames_skipped */,
331 AudioBus* dest) final {
330 // Note: This method is being invoked by a separate thread unknown to us 332 // Note: This method is being invoked by a separate thread unknown to us
331 // (i.e., outside of CastEnvironment). 333 // (i.e., outside of CastEnvironment).
332 334
333 int samples_remaining = dest->frames(); 335 int samples_remaining = dest->frames();
334 336
335 while (samples_remaining > 0) { 337 while (samples_remaining > 0) {
336 // Get next audio frame ready for playout. 338 // Get next audio frame ready for playout.
337 if (!currently_playing_audio_frame_.get()) { 339 if (!currently_playing_audio_frame_.get()) {
338 base::AutoLock auto_lock(audio_lock_); 340 base::AutoLock auto_lock(audio_lock_);
339 341
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 audio_config, 604 audio_config,
603 video_config, 605 video_config,
604 window_width, 606 window_width,
605 window_height); 607 window_height);
606 player.Start(); 608 player.Start();
607 609
608 base::RunLoop().Run(); // Run forever (i.e., until SIGTERM). 610 base::RunLoop().Run(); // Run forever (i.e., until SIGTERM).
609 NOTREACHED(); 611 NOTREACHED();
610 return 0; 612 return 0;
611 } 613 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698