| 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/base/pipeline_impl.h" | 5 #include "media/base/pipeline_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 void RemoveTextStream(DemuxerStream* text_stream) final; | 106 void RemoveTextStream(DemuxerStream* text_stream) final; |
| 107 | 107 |
| 108 // RendererClient implementation. | 108 // RendererClient implementation. |
| 109 void OnError(PipelineStatus error) final; | 109 void OnError(PipelineStatus error) final; |
| 110 void OnEnded() final; | 110 void OnEnded() final; |
| 111 void OnStatisticsUpdate(const PipelineStatistics& stats) final; | 111 void OnStatisticsUpdate(const PipelineStatistics& stats) final; |
| 112 void OnBufferingStateChange(BufferingState state) final; | 112 void OnBufferingStateChange(BufferingState state) final; |
| 113 void OnWaitingForDecryptionKey() final; | 113 void OnWaitingForDecryptionKey() final; |
| 114 void OnVideoNaturalSizeChange(const gfx::Size& size) final; | 114 void OnVideoNaturalSizeChange(const gfx::Size& size) final; |
| 115 void OnVideoOpacityChange(bool opaque) final; | 115 void OnVideoOpacityChange(bool opaque) final; |
| 116 void OnDurationChange(base::TimeDelta duration) final; |
| 116 | 117 |
| 117 // TextRenderer tasks and notifications. | 118 // TextRenderer tasks and notifications. |
| 118 void OnTextRendererEnded(); | 119 void OnTextRendererEnded(); |
| 119 void AddTextStreamTask(DemuxerStream* text_stream, | 120 void AddTextStreamTask(DemuxerStream* text_stream, |
| 120 const TextTrackConfig& config); | 121 const TextTrackConfig& config); |
| 121 void RemoveTextStreamTask(DemuxerStream* text_stream); | 122 void RemoveTextStreamTask(DemuxerStream* text_stream); |
| 122 | 123 |
| 123 // Common handlers for notifications from renderers and demuxer. | 124 // Common handlers for notifications from renderers and demuxer. |
| 124 void OnPipelineError(PipelineStatus error); | 125 void OnPipelineError(PipelineStatus error); |
| 125 void OnCdmAttached(const CdmAttachedCB& cdm_attached_cb, | 126 void OnCdmAttached(const CdmAttachedCB& cdm_attached_cb, |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 } | 652 } |
| 652 | 653 |
| 653 void PipelineImpl::RendererWrapper::OnVideoOpacityChange(bool opaque) { | 654 void PipelineImpl::RendererWrapper::OnVideoOpacityChange(bool opaque) { |
| 654 DCHECK(media_task_runner_->BelongsToCurrentThread()); | 655 DCHECK(media_task_runner_->BelongsToCurrentThread()); |
| 655 | 656 |
| 656 main_task_runner_->PostTask( | 657 main_task_runner_->PostTask( |
| 657 FROM_HERE, | 658 FROM_HERE, |
| 658 base::Bind(&PipelineImpl::OnVideoOpacityChange, weak_pipeline_, opaque)); | 659 base::Bind(&PipelineImpl::OnVideoOpacityChange, weak_pipeline_, opaque)); |
| 659 } | 660 } |
| 660 | 661 |
| 662 void PipelineImpl::RendererWrapper::OnDurationChange(base::TimeDelta duration) { |
| 663 DCHECK(media_task_runner_->BelongsToCurrentThread()); |
| 664 SetDuration(duration); |
| 665 } |
| 666 |
| 661 void PipelineImpl::RendererWrapper::OnTextRendererEnded() { | 667 void PipelineImpl::RendererWrapper::OnTextRendererEnded() { |
| 662 DCHECK(media_task_runner_->BelongsToCurrentThread()); | 668 DCHECK(media_task_runner_->BelongsToCurrentThread()); |
| 663 media_log_->AddEvent(media_log_->CreateEvent(MediaLogEvent::TEXT_ENDED)); | 669 media_log_->AddEvent(media_log_->CreateEvent(MediaLogEvent::TEXT_ENDED)); |
| 664 | 670 |
| 665 if (state_ != kPlaying) | 671 if (state_ != kPlaying) |
| 666 return; | 672 return; |
| 667 | 673 |
| 668 DCHECK(!text_renderer_ended_); | 674 DCHECK(!text_renderer_ended_); |
| 669 text_renderer_ended_ = true; | 675 text_renderer_ended_ = true; |
| 670 CheckPlaybackEnded(); | 676 CheckPlaybackEnded(); |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1229 void PipelineImpl::OnSuspendDone() { | 1235 void PipelineImpl::OnSuspendDone() { |
| 1230 DVLOG(3) << __func__; | 1236 DVLOG(3) << __func__; |
| 1231 DCHECK(thread_checker_.CalledOnValidThread()); | 1237 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1232 DCHECK(IsRunning()); | 1238 DCHECK(IsRunning()); |
| 1233 | 1239 |
| 1234 DCHECK(!suspend_cb_.is_null()); | 1240 DCHECK(!suspend_cb_.is_null()); |
| 1235 base::ResetAndReturn(&suspend_cb_).Run(PIPELINE_OK); | 1241 base::ResetAndReturn(&suspend_cb_).Run(PIPELINE_OK); |
| 1236 } | 1242 } |
| 1237 | 1243 |
| 1238 } // namespace media | 1244 } // namespace media |
| OLD | NEW |