| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 243 |
| 244 media_log_->AddEvent( | 244 media_log_->AddEvent( |
| 245 media_log_->CreateEvent(MediaLogEvent::WEBMEDIAPLAYER_CREATED)); | 245 media_log_->CreateEvent(MediaLogEvent::WEBMEDIAPLAYER_CREATED)); |
| 246 | 246 |
| 247 if (params.initial_cdm()) | 247 if (params.initial_cdm()) |
| 248 SetCdm(params.initial_cdm()); | 248 SetCdm(params.initial_cdm()); |
| 249 | 249 |
| 250 // TODO(xhwang): When we use an external Renderer, many methods won't work, | 250 // TODO(xhwang): When we use an external Renderer, many methods won't work, |
| 251 // e.g. GetCurrentFrameFromCompositor(). See http://crbug.com/434861 | 251 // e.g. GetCurrentFrameFromCompositor(). See http://crbug.com/434861 |
| 252 | 252 |
| 253 // Use the null sink if no sink was provided. | 253 // Use the null sink if no valid sink was provided. |
| 254 audio_source_provider_ = new WebAudioSourceProviderImpl( | 254 audio_source_provider_ = new WebAudioSourceProviderImpl( |
| 255 params.audio_renderer_sink().get() | 255 params.audio_renderer_sink().get() && |
| 256 params.audio_renderer_sink() |
| 257 ->GetOutputDeviceInfo() |
| 258 .device_status() == OUTPUT_DEVICE_STATUS_OK |
| 256 ? params.audio_renderer_sink() | 259 ? params.audio_renderer_sink() |
| 257 : new NullAudioSink(media_task_runner_)); | 260 : new NullAudioSink(media_task_runner_)); |
| 258 } | 261 } |
| 259 | 262 |
| 260 WebMediaPlayerImpl::~WebMediaPlayerImpl() { | 263 WebMediaPlayerImpl::~WebMediaPlayerImpl() { |
| 261 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 264 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 262 | 265 |
| 263 suppress_destruction_errors_ = true; | 266 suppress_destruction_errors_ = true; |
| 264 if (delegate_) { | 267 if (delegate_) { |
| 265 delegate_->PlayerGone(delegate_id_); | 268 delegate_->PlayerGone(delegate_id_); |
| (...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1836 pipeline_metadata_.natural_size, | 1839 pipeline_metadata_.natural_size, |
| 1837 base::Bind(&GetCurrentTimeInternal, this))); | 1840 base::Bind(&GetCurrentTimeInternal, this))); |
| 1838 watch_time_reporter_->OnVolumeChange(volume_); | 1841 watch_time_reporter_->OnVolumeChange(volume_); |
| 1839 if (delegate_ && delegate_->IsHidden()) | 1842 if (delegate_ && delegate_->IsHidden()) |
| 1840 watch_time_reporter_->OnHidden(); | 1843 watch_time_reporter_->OnHidden(); |
| 1841 else | 1844 else |
| 1842 watch_time_reporter_->OnShown(); | 1845 watch_time_reporter_->OnShown(); |
| 1843 } | 1846 } |
| 1844 | 1847 |
| 1845 } // namespace media | 1848 } // namespace media |
| OLD | NEW |