OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer_impl.h" | 5 #include "media/renderers/renderer_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_ABORT); | 74 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_ABORT); |
75 else if (!flush_cb_.is_null()) | 75 else if (!flush_cb_.is_null()) |
76 base::ResetAndReturn(&flush_cb_).Run(); | 76 base::ResetAndReturn(&flush_cb_).Run(); |
77 } | 77 } |
78 | 78 |
79 void RendererImpl::Initialize( | 79 void RendererImpl::Initialize( |
80 DemuxerStreamProvider* demuxer_stream_provider, | 80 DemuxerStreamProvider* demuxer_stream_provider, |
81 const PipelineStatusCB& init_cb, | 81 const PipelineStatusCB& init_cb, |
82 const StatisticsCB& statistics_cb, | 82 const StatisticsCB& statistics_cb, |
83 const BufferingStateCB& buffering_state_cb, | 83 const BufferingStateCB& buffering_state_cb, |
| 84 const PaintCB& paint_cb, |
84 const base::Closure& ended_cb, | 85 const base::Closure& ended_cb, |
85 const PipelineStatusCB& error_cb, | 86 const PipelineStatusCB& error_cb, |
86 const base::Closure& waiting_for_decryption_key_cb) { | 87 const base::Closure& waiting_for_decryption_key_cb) { |
87 DVLOG(1) << __FUNCTION__; | 88 DVLOG(1) << __FUNCTION__; |
88 DCHECK(task_runner_->BelongsToCurrentThread()); | 89 DCHECK(task_runner_->BelongsToCurrentThread()); |
89 DCHECK_EQ(state_, STATE_UNINITIALIZED); | 90 DCHECK_EQ(state_, STATE_UNINITIALIZED); |
90 DCHECK(!init_cb.is_null()); | 91 DCHECK(!init_cb.is_null()); |
91 DCHECK(!statistics_cb.is_null()); | 92 DCHECK(!statistics_cb.is_null()); |
92 DCHECK(!buffering_state_cb.is_null()); | 93 DCHECK(!buffering_state_cb.is_null()); |
| 94 DCHECK(!paint_cb.is_null()); |
93 DCHECK(!ended_cb.is_null()); | 95 DCHECK(!ended_cb.is_null()); |
94 DCHECK(!error_cb.is_null()); | 96 DCHECK(!error_cb.is_null()); |
95 DCHECK(demuxer_stream_provider->GetStream(DemuxerStream::AUDIO) || | 97 DCHECK(demuxer_stream_provider->GetStream(DemuxerStream::AUDIO) || |
96 demuxer_stream_provider->GetStream(DemuxerStream::VIDEO)); | 98 demuxer_stream_provider->GetStream(DemuxerStream::VIDEO)); |
97 | 99 |
98 demuxer_stream_provider_ = demuxer_stream_provider; | 100 demuxer_stream_provider_ = demuxer_stream_provider; |
99 statistics_cb_ = statistics_cb; | 101 statistics_cb_ = statistics_cb; |
100 buffering_state_cb_ = buffering_state_cb; | 102 buffering_state_cb_ = buffering_state_cb; |
| 103 paint_cb_ = paint_cb; |
101 ended_cb_ = ended_cb; | 104 ended_cb_ = ended_cb; |
102 error_cb_ = error_cb; | 105 error_cb_ = error_cb; |
103 init_cb_ = init_cb; | 106 init_cb_ = init_cb; |
104 waiting_for_decryption_key_cb_ = waiting_for_decryption_key_cb; | 107 waiting_for_decryption_key_cb_ = waiting_for_decryption_key_cb; |
105 | 108 |
106 state_ = STATE_INITIALIZING; | 109 state_ = STATE_INITIALIZING; |
107 InitializeAudioRenderer(); | 110 InitializeAudioRenderer(); |
108 } | 111 } |
109 | 112 |
110 void RendererImpl::SetCdm(CdmContext* cdm_context, | 113 void RendererImpl::SetCdm(CdmContext* cdm_context, |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 task_runner_->PostTask(FROM_HERE, base::Bind(done_cb, PIPELINE_OK)); | 330 task_runner_->PostTask(FROM_HERE, base::Bind(done_cb, PIPELINE_OK)); |
328 return; | 331 return; |
329 } | 332 } |
330 | 333 |
331 video_renderer_->Initialize( | 334 video_renderer_->Initialize( |
332 demuxer_stream_provider_->GetStream(DemuxerStream::VIDEO), done_cb, | 335 demuxer_stream_provider_->GetStream(DemuxerStream::VIDEO), done_cb, |
333 base::Bind(&RendererImpl::SetDecryptorReadyCallback, weak_this_), | 336 base::Bind(&RendererImpl::SetDecryptorReadyCallback, weak_this_), |
334 base::Bind(&RendererImpl::OnUpdateStatistics, weak_this_), | 337 base::Bind(&RendererImpl::OnUpdateStatistics, weak_this_), |
335 base::Bind(&RendererImpl::OnBufferingStateChanged, weak_this_, | 338 base::Bind(&RendererImpl::OnBufferingStateChanged, weak_this_, |
336 &video_buffering_state_), | 339 &video_buffering_state_), |
| 340 base::ResetAndReturn(&paint_cb_), |
337 base::Bind(&RendererImpl::OnVideoRendererEnded, weak_this_), | 341 base::Bind(&RendererImpl::OnVideoRendererEnded, weak_this_), |
338 base::Bind(&RendererImpl::OnError, weak_this_), | 342 base::Bind(&RendererImpl::OnError, weak_this_), |
339 base::Bind(&RendererImpl::GetWallClockTime, base::Unretained(this)), | 343 base::Bind(&RendererImpl::GetWallClockTime, base::Unretained(this)), |
340 waiting_for_decryption_key_cb_); | 344 waiting_for_decryption_key_cb_); |
341 } | 345 } |
342 | 346 |
343 void RendererImpl::OnVideoRendererInitializeDone(PipelineStatus status) { | 347 void RendererImpl::OnVideoRendererInitializeDone(PipelineStatus status) { |
344 DVLOG(1) << __FUNCTION__ << ": " << status; | 348 DVLOG(1) << __FUNCTION__ << ": " << status; |
345 DCHECK(task_runner_->BelongsToCurrentThread()); | 349 DCHECK(task_runner_->BelongsToCurrentThread()); |
346 | 350 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 } | 630 } |
627 | 631 |
628 // After OnError() returns, the pipeline may destroy |this|. | 632 // After OnError() returns, the pipeline may destroy |this|. |
629 base::ResetAndReturn(&error_cb_).Run(error); | 633 base::ResetAndReturn(&error_cb_).Run(error); |
630 | 634 |
631 if (!flush_cb_.is_null()) | 635 if (!flush_cb_.is_null()) |
632 base::ResetAndReturn(&flush_cb_).Run(); | 636 base::ResetAndReturn(&flush_cb_).Run(); |
633 } | 637 } |
634 | 638 |
635 } // namespace media | 639 } // namespace media |
OLD | NEW |