| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 delegate_id_ = delegate_->AddObserver(this); | 253 delegate_id_ = delegate_->AddObserver(this); |
| 254 | 254 |
| 255 media_log_->AddEvent( | 255 media_log_->AddEvent( |
| 256 media_log_->CreateEvent(MediaLogEvent::WEBMEDIAPLAYER_CREATED)); | 256 media_log_->CreateEvent(MediaLogEvent::WEBMEDIAPLAYER_CREATED)); |
| 257 | 257 |
| 258 if (params.initial_cdm()) | 258 if (params.initial_cdm()) |
| 259 SetCdm(params.initial_cdm()); | 259 SetCdm(params.initial_cdm()); |
| 260 | 260 |
| 261 // TODO(xhwang): When we use an external Renderer, many methods won't work, | 261 // TODO(xhwang): When we use an external Renderer, many methods won't work, |
| 262 // e.g. GetCurrentFrameFromCompositor(). See http://crbug.com/434861 | 262 // e.g. GetCurrentFrameFromCompositor(). See http://crbug.com/434861 |
| 263 | 263 audio_source_provider_ = |
| 264 // Use the null sink if no valid sink was provided. | 264 new WebAudioSourceProviderImpl(params.audio_renderer_sink(), media_log_); |
| 265 audio_source_provider_ = new WebAudioSourceProviderImpl( | |
| 266 params.audio_renderer_sink().get() && | |
| 267 params.audio_renderer_sink() | |
| 268 ->GetOutputDeviceInfo() | |
| 269 .device_status() == OUTPUT_DEVICE_STATUS_OK | |
| 270 ? params.audio_renderer_sink() | |
| 271 : new NullAudioSink(media_task_runner_)); | |
| 272 } | 265 } |
| 273 | 266 |
| 274 WebMediaPlayerImpl::~WebMediaPlayerImpl() { | 267 WebMediaPlayerImpl::~WebMediaPlayerImpl() { |
| 275 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 268 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 276 | 269 |
| 277 suppress_destruction_errors_ = true; | 270 suppress_destruction_errors_ = true; |
| 278 if (delegate_) { | 271 if (delegate_) { |
| 279 delegate_->PlayerGone(delegate_id_); | 272 delegate_->PlayerGone(delegate_id_); |
| 280 delegate_->RemoveObserver(delegate_id_); | 273 delegate_->RemoveObserver(delegate_id_); |
| 281 } | 274 } |
| (...skipping 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1955 pipeline_metadata_.natural_size, | 1948 pipeline_metadata_.natural_size, |
| 1956 base::Bind(&GetCurrentTimeInternal, this))); | 1949 base::Bind(&GetCurrentTimeInternal, this))); |
| 1957 watch_time_reporter_->OnVolumeChange(volume_); | 1950 watch_time_reporter_->OnVolumeChange(volume_); |
| 1958 if (delegate_ && delegate_->IsHidden()) | 1951 if (delegate_ && delegate_->IsHidden()) |
| 1959 watch_time_reporter_->OnHidden(); | 1952 watch_time_reporter_->OnHidden(); |
| 1960 else | 1953 else |
| 1961 watch_time_reporter_->OnShown(); | 1954 watch_time_reporter_->OnShown(); |
| 1962 } | 1955 } |
| 1963 | 1956 |
| 1964 } // namespace media | 1957 } // namespace media |
| OLD | NEW |