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

Side by Side Diff: media/renderers/audio_renderer_impl.cc

Issue 1538563002: Forward the number of skipped frames by the OS in audio playout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review fix. git cl format. Rebase. Created 5 years 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/renderers/audio_renderer_impl.h ('k') | ppapi/shared_impl/ppb_audio_shared.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/renderers/audio_renderer_impl.h" 5 #include "media/renderers/audio_renderer_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 } 619 }
620 620
621 bool AudioRendererImpl::IsBeforeStartTime( 621 bool AudioRendererImpl::IsBeforeStartTime(
622 const scoped_refptr<AudioBuffer>& buffer) { 622 const scoped_refptr<AudioBuffer>& buffer) {
623 DCHECK_EQ(state_, kPlaying); 623 DCHECK_EQ(state_, kPlaying);
624 return buffer.get() && !buffer->end_of_stream() && 624 return buffer.get() && !buffer->end_of_stream() &&
625 (buffer->timestamp() + buffer->duration()) < start_timestamp_; 625 (buffer->timestamp() + buffer->duration()) < start_timestamp_;
626 } 626 }
627 627
628 int AudioRendererImpl::Render(AudioBus* audio_bus, 628 int AudioRendererImpl::Render(AudioBus* audio_bus,
629 int audio_delay_milliseconds) { 629 uint32_t audio_delay_milliseconds,
630 uint32_t frames_skipped) {
630 const int requested_frames = audio_bus->frames(); 631 const int requested_frames = audio_bus->frames();
631 base::TimeDelta playback_delay = base::TimeDelta::FromMilliseconds( 632 base::TimeDelta playback_delay = base::TimeDelta::FromMilliseconds(
632 audio_delay_milliseconds); 633 audio_delay_milliseconds);
633 const int delay_frames = static_cast<int>(playback_delay.InSecondsF() * 634 const int delay_frames = static_cast<int>(playback_delay.InSecondsF() *
634 audio_parameters_.sample_rate()); 635 audio_parameters_.sample_rate());
635 int frames_written = 0; 636 int frames_written = 0;
636 { 637 {
637 base::AutoLock auto_lock(lock_); 638 base::AutoLock auto_lock(lock_);
638 last_render_time_ = tick_clock_->NowTicks(); 639 last_render_time_ = tick_clock_->NowTicks();
639 640
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 << buffering_state; 818 << buffering_state;
818 DCHECK_NE(buffering_state_, buffering_state); 819 DCHECK_NE(buffering_state_, buffering_state);
819 lock_.AssertAcquired(); 820 lock_.AssertAcquired();
820 buffering_state_ = buffering_state; 821 buffering_state_ = buffering_state;
821 822
822 task_runner_->PostTask(FROM_HERE, 823 task_runner_->PostTask(FROM_HERE,
823 base::Bind(buffering_state_cb_, buffering_state_)); 824 base::Bind(buffering_state_cb_, buffering_state_));
824 } 825 }
825 826
826 } // namespace media 827 } // namespace media
OLDNEW
« no previous file with comments | « media/renderers/audio_renderer_impl.h ('k') | ppapi/shared_impl/ppb_audio_shared.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698