| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/blink/webmediaplayer_impl.h" | 5 #include "media/blink/webmediaplayer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 buffering_strategy_(MultibufferDataSource::BUFFERING_STRATEGY_NORMAL), | 191 buffering_strategy_(MultibufferDataSource::BUFFERING_STRATEGY_NORMAL), |
| 192 main_task_runner_(base::ThreadTaskRunnerHandle::Get()), | 192 main_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
| 193 media_task_runner_(params.media_task_runner()), | 193 media_task_runner_(params.media_task_runner()), |
| 194 worker_task_runner_(params.worker_task_runner()), | 194 worker_task_runner_(params.worker_task_runner()), |
| 195 media_log_(params.media_log()), | 195 media_log_(params.media_log()), |
| 196 pipeline_(media_task_runner_, media_log_.get()), | 196 pipeline_(media_task_runner_, media_log_.get()), |
| 197 pipeline_controller_( | 197 pipeline_controller_( |
| 198 &pipeline_, | 198 &pipeline_, |
| 199 base::Bind(&WebMediaPlayerImpl::CreateRenderer, | 199 base::Bind(&WebMediaPlayerImpl::CreateRenderer, |
| 200 base::Unretained(this)), | 200 base::Unretained(this)), |
| 201 base::Bind(&WebMediaPlayerImpl::OnPipelineStarted, AsWeakPtr()), |
| 201 base::Bind(&WebMediaPlayerImpl::OnPipelineSeeked, AsWeakPtr()), | 202 base::Bind(&WebMediaPlayerImpl::OnPipelineSeeked, AsWeakPtr()), |
| 202 base::Bind(&WebMediaPlayerImpl::OnPipelineSuspended, AsWeakPtr()), | 203 base::Bind(&WebMediaPlayerImpl::OnPipelineSuspended, AsWeakPtr()), |
| 203 base::Bind(&WebMediaPlayerImpl::OnError, AsWeakPtr())), | 204 base::Bind(&WebMediaPlayerImpl::OnError, AsWeakPtr())), |
| 204 load_type_(LoadTypeURL), | 205 load_type_(LoadTypeURL), |
| 205 opaque_(false), | 206 opaque_(false), |
| 206 playback_rate_(0.0), | 207 playback_rate_(0.0), |
| 207 paused_(true), | 208 paused_(true), |
| 208 seeking_(false), | 209 seeking_(false), |
| 209 pending_suspend_resume_cycle_(false), | 210 pending_suspend_resume_cycle_(false), |
| 210 ended_(false), | 211 ended_(false), |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 | 1032 |
| 1032 pending_cdm_ = nullptr; | 1033 pending_cdm_ = nullptr; |
| 1033 if (set_cdm_result_) { | 1034 if (set_cdm_result_) { |
| 1034 set_cdm_result_->completeWithError( | 1035 set_cdm_result_->completeWithError( |
| 1035 blink::WebContentDecryptionModuleExceptionNotSupportedError, 0, | 1036 blink::WebContentDecryptionModuleExceptionNotSupportedError, 0, |
| 1036 "Unable to set MediaKeys object"); | 1037 "Unable to set MediaKeys object"); |
| 1037 set_cdm_result_.reset(); | 1038 set_cdm_result_.reset(); |
| 1038 } | 1039 } |
| 1039 } | 1040 } |
| 1040 | 1041 |
| 1042 void WebMediaPlayerImpl::OnPipelineStarted(PipelineStatus status) { |
| 1043 // Notify HTMLMediaElement that pipeline has started. |
| 1044 // client_->PipelineStarted(); |
| 1045 } |
| 1046 |
| 1041 void WebMediaPlayerImpl::OnPipelineSeeked(bool time_updated) { | 1047 void WebMediaPlayerImpl::OnPipelineSeeked(bool time_updated) { |
| 1042 seeking_ = false; | 1048 seeking_ = false; |
| 1043 seek_time_ = base::TimeDelta(); | 1049 seek_time_ = base::TimeDelta(); |
| 1044 if (paused_) { | 1050 if (paused_) { |
| 1045 #if defined(OS_ANDROID) // WMPI_CAST | 1051 #if defined(OS_ANDROID) // WMPI_CAST |
| 1046 if (isRemote()) { | 1052 if (isRemote()) { |
| 1047 paused_time_ = base::TimeDelta::FromSecondsD(cast_impl_.currentTime()); | 1053 paused_time_ = base::TimeDelta::FromSecondsD(cast_impl_.currentTime()); |
| 1048 } else { | 1054 } else { |
| 1049 paused_time_ = pipeline_.GetMediaTime(); | 1055 paused_time_ = pipeline_.GetMediaTime(); |
| 1050 } | 1056 } |
| (...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1979 watch_time_reporter_->OnShown(); | 1985 watch_time_reporter_->OnShown(); |
| 1980 } | 1986 } |
| 1981 | 1987 |
| 1982 bool WebMediaPlayerImpl::IsHidden() const { | 1988 bool WebMediaPlayerImpl::IsHidden() const { |
| 1983 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 1989 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 1984 | 1990 |
| 1985 return delegate_ && delegate_->IsHidden(); | 1991 return delegate_ && delegate_->IsHidden(); |
| 1986 } | 1992 } |
| 1987 | 1993 |
| 1988 } // namespace media | 1994 } // namespace media |
| OLD | NEW |