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

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

Issue 418143005: media: Introduce Renderer interface and RendererImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add real RendererImpl Created 6 years, 5 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
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/filters/audio_renderer_impl.h" 5 #include "media/filters/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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 audio_clock_->WroteAudio( 583 audio_clock_->WroteAudio(
584 frames_written, delay_frames, playback_rate_, algorithm_->GetTime()); 584 frames_written, delay_frames, playback_rate_, algorithm_->GetTime());
585 } 585 }
586 audio_clock_->WroteSilence(requested_frames - frames_written, delay_frames); 586 audio_clock_->WroteSilence(requested_frames - frames_written, delay_frames);
587 587
588 if (frames_written == 0) { 588 if (frames_written == 0) {
589 if (received_end_of_stream_ && !rendered_end_of_stream_ && 589 if (received_end_of_stream_ && !rendered_end_of_stream_ &&
590 audio_clock_->CurrentMediaTimestamp(base::TimeDelta()) == 590 audio_clock_->CurrentMediaTimestamp(base::TimeDelta()) ==
591 audio_clock_->last_endpoint_timestamp()) { 591 audio_clock_->last_endpoint_timestamp()) {
592 rendered_end_of_stream_ = true; 592 rendered_end_of_stream_ = true;
593 ended_cb_.Run(); 593 task_runner_->PostTask(FROM_HERE, ended_cb_);
xhwang 2014/07/25 00:39:29 Post ended_cb_ so that we don't need to force post
594 } else if (!received_end_of_stream_ && state_ == kPlaying) { 594 } else if (!received_end_of_stream_ && state_ == kPlaying) {
595 if (buffering_state_ != BUFFERING_HAVE_NOTHING) { 595 if (buffering_state_ != BUFFERING_HAVE_NOTHING) {
596 algorithm_->IncreaseQueueCapacity(); 596 algorithm_->IncreaseQueueCapacity();
597 SetBufferingState_Locked(BUFFERING_HAVE_NOTHING); 597 SetBufferingState_Locked(BUFFERING_HAVE_NOTHING);
598 } 598 }
599 } 599 }
600 } 600 }
601 601
602 if (CanRead_Locked()) { 602 if (CanRead_Locked()) {
603 task_runner_->PostTask(FROM_HERE, 603 task_runner_->PostTask(FROM_HERE,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 << buffering_state; 689 << buffering_state;
690 DCHECK_NE(buffering_state_, buffering_state); 690 DCHECK_NE(buffering_state_, buffering_state);
691 lock_.AssertAcquired(); 691 lock_.AssertAcquired();
692 buffering_state_ = buffering_state; 692 buffering_state_ = buffering_state;
693 693
694 task_runner_->PostTask(FROM_HERE, 694 task_runner_->PostTask(FROM_HERE,
695 base::Bind(buffering_state_cb_, buffering_state_)); 695 base::Bind(buffering_state_cb_, buffering_state_));
696 } 696 }
697 697
698 } // namespace media 698 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698