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