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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } else if (!flush_cb_.is_null()) { | 79 } else if (!flush_cb_.is_null()) { |
80 base::ResetAndReturn(&flush_cb_).Run(); | 80 base::ResetAndReturn(&flush_cb_).Run(); |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 void RendererImpl::Initialize( | 84 void RendererImpl::Initialize( |
85 DemuxerStreamProvider* demuxer_stream_provider, | 85 DemuxerStreamProvider* demuxer_stream_provider, |
86 const PipelineStatusCB& init_cb, | 86 const PipelineStatusCB& init_cb, |
87 const StatisticsCB& statistics_cb, | 87 const StatisticsCB& statistics_cb, |
88 const BufferingStateCB& buffering_state_cb, | 88 const BufferingStateCB& buffering_state_cb, |
| 89 const NaturalSizeChangedCB& natural_size_changed_cb, |
89 const base::Closure& ended_cb, | 90 const base::Closure& ended_cb, |
90 const PipelineStatusCB& error_cb, | 91 const PipelineStatusCB& error_cb, |
91 const base::Closure& waiting_for_decryption_key_cb) { | 92 const base::Closure& waiting_for_decryption_key_cb) { |
92 DVLOG(1) << __FUNCTION__; | 93 DVLOG(1) << __FUNCTION__; |
93 DCHECK(task_runner_->BelongsToCurrentThread()); | 94 DCHECK(task_runner_->BelongsToCurrentThread()); |
94 DCHECK_EQ(state_, STATE_UNINITIALIZED); | 95 DCHECK_EQ(state_, STATE_UNINITIALIZED); |
95 DCHECK(!init_cb.is_null()); | 96 DCHECK(!init_cb.is_null()); |
96 DCHECK(!statistics_cb.is_null()); | 97 DCHECK(!statistics_cb.is_null()); |
97 DCHECK(!buffering_state_cb.is_null()); | 98 DCHECK(!buffering_state_cb.is_null()); |
98 DCHECK(!ended_cb.is_null()); | 99 DCHECK(!ended_cb.is_null()); |
99 DCHECK(!error_cb.is_null()); | 100 DCHECK(!error_cb.is_null()); |
100 DCHECK(demuxer_stream_provider->GetStream(DemuxerStream::AUDIO) || | 101 DCHECK(demuxer_stream_provider->GetStream(DemuxerStream::AUDIO) || |
101 demuxer_stream_provider->GetStream(DemuxerStream::VIDEO)); | 102 demuxer_stream_provider->GetStream(DemuxerStream::VIDEO)); |
102 | 103 |
103 demuxer_stream_provider_ = demuxer_stream_provider; | 104 demuxer_stream_provider_ = demuxer_stream_provider; |
104 statistics_cb_ = statistics_cb; | 105 statistics_cb_ = statistics_cb; |
105 buffering_state_cb_ = buffering_state_cb; | 106 buffering_state_cb_ = buffering_state_cb; |
| 107 natural_size_changed_cb_ = natural_size_changed_cb; |
106 ended_cb_ = ended_cb; | 108 ended_cb_ = ended_cb; |
107 error_cb_ = error_cb; | 109 error_cb_ = error_cb; |
108 init_cb_ = init_cb; | 110 init_cb_ = init_cb; |
109 waiting_for_decryption_key_cb_ = waiting_for_decryption_key_cb; | 111 waiting_for_decryption_key_cb_ = waiting_for_decryption_key_cb; |
110 | 112 |
111 if (HasEncryptedStream() && !cdm_context_) { | 113 if (HasEncryptedStream() && !cdm_context_) { |
112 state_ = STATE_INIT_PENDING_CDM; | 114 state_ = STATE_INIT_PENDING_CDM; |
113 return; | 115 return; |
114 } | 116 } |
115 | 117 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 video_renderer_.reset(); | 353 video_renderer_.reset(); |
352 task_runner_->PostTask(FROM_HERE, base::Bind(done_cb, PIPELINE_OK)); | 354 task_runner_->PostTask(FROM_HERE, base::Bind(done_cb, PIPELINE_OK)); |
353 return; | 355 return; |
354 } | 356 } |
355 | 357 |
356 video_renderer_->Initialize( | 358 video_renderer_->Initialize( |
357 demuxer_stream_provider_->GetStream(DemuxerStream::VIDEO), done_cb, | 359 demuxer_stream_provider_->GetStream(DemuxerStream::VIDEO), done_cb, |
358 cdm_context_, base::Bind(&RendererImpl::OnUpdateStatistics, weak_this_), | 360 cdm_context_, base::Bind(&RendererImpl::OnUpdateStatistics, weak_this_), |
359 base::Bind(&RendererImpl::OnBufferingStateChanged, weak_this_, | 361 base::Bind(&RendererImpl::OnBufferingStateChanged, weak_this_, |
360 &video_buffering_state_), | 362 &video_buffering_state_), |
| 363 natural_size_changed_cb_, |
361 base::Bind(&RendererImpl::OnVideoRendererEnded, weak_this_), | 364 base::Bind(&RendererImpl::OnVideoRendererEnded, weak_this_), |
362 base::Bind(&RendererImpl::OnError, weak_this_), | 365 base::Bind(&RendererImpl::OnError, weak_this_), |
363 base::Bind(&RendererImpl::GetWallClockTimes, base::Unretained(this)), | 366 base::Bind(&RendererImpl::GetWallClockTimes, base::Unretained(this)), |
364 waiting_for_decryption_key_cb_); | 367 waiting_for_decryption_key_cb_); |
365 } | 368 } |
366 | 369 |
367 void RendererImpl::OnVideoRendererInitializeDone(PipelineStatus status) { | 370 void RendererImpl::OnVideoRendererInitializeDone(PipelineStatus status) { |
368 DVLOG(1) << __FUNCTION__ << ": " << status; | 371 DVLOG(1) << __FUNCTION__ << ": " << status; |
369 DCHECK(task_runner_->BelongsToCurrentThread()); | 372 DCHECK(task_runner_->BelongsToCurrentThread()); |
370 | 373 |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 } | 663 } |
661 | 664 |
662 // After OnError() returns, the pipeline may destroy |this|. | 665 // After OnError() returns, the pipeline may destroy |this|. |
663 base::ResetAndReturn(&error_cb_).Run(error); | 666 base::ResetAndReturn(&error_cb_).Run(error); |
664 | 667 |
665 if (!flush_cb_.is_null()) | 668 if (!flush_cb_.is_null()) |
666 base::ResetAndReturn(&flush_cb_).Run(); | 669 base::ResetAndReturn(&flush_cb_).Run(); |
667 } | 670 } |
668 | 671 |
669 } // namespace media | 672 } // namespace media |
OLD | NEW |