Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |