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

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

Issue 1538463002: Revert of 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: 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') | no next file » | 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 uint32_t audio_delay_milliseconds, 629 int audio_delay_milliseconds) {
630 uint32_t frames_skipped) {
631 const int requested_frames = audio_bus->frames(); 630 const int requested_frames = audio_bus->frames();
632 base::TimeDelta playback_delay = base::TimeDelta::FromMilliseconds( 631 base::TimeDelta playback_delay = base::TimeDelta::FromMilliseconds(
633 audio_delay_milliseconds); 632 audio_delay_milliseconds);
634 const int delay_frames = static_cast<int>(playback_delay.InSecondsF() * 633 const int delay_frames = static_cast<int>(playback_delay.InSecondsF() *
635 audio_parameters_.sample_rate()); 634 audio_parameters_.sample_rate());
636 int frames_written = 0; 635 int frames_written = 0;
637 { 636 {
638 base::AutoLock auto_lock(lock_); 637 base::AutoLock auto_lock(lock_);
639 last_render_time_ = tick_clock_->NowTicks(); 638 last_render_time_ = tick_clock_->NowTicks();
640 639
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 << buffering_state; 817 << buffering_state;
819 DCHECK_NE(buffering_state_, buffering_state); 818 DCHECK_NE(buffering_state_, buffering_state);
820 lock_.AssertAcquired(); 819 lock_.AssertAcquired();
821 buffering_state_ = buffering_state; 820 buffering_state_ = buffering_state;
822 821
823 task_runner_->PostTask(FROM_HERE, 822 task_runner_->PostTask(FROM_HERE,
824 base::Bind(buffering_state_cb_, buffering_state_)); 823 base::Bind(buffering_state_cb_, buffering_state_));
825 } 824 }
826 825
827 } // namespace media 826 } // namespace media
OLDNEW
« no previous file with comments | « media/renderers/audio_renderer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698