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 2285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2296 if (IsRemote()) | 2296 if (IsRemote()) |
2297 return; | 2297 return; |
2298 #endif | 2298 #endif |
2299 | 2299 |
2300 // Idle timeout chosen arbitrarily. | 2300 // Idle timeout chosen arbitrarily. |
2301 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), | 2301 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), |
2302 this, &WebMediaPlayerImpl::OnPause); | 2302 this, &WebMediaPlayerImpl::OnPause); |
2303 } | 2303 } |
2304 | 2304 |
2305 void WebMediaPlayerImpl::CreateWatchTimeReporter() { | 2305 void WebMediaPlayerImpl::CreateWatchTimeReporter() { |
| 2306 if (!HasVideo() && !HasAudio()) |
| 2307 return; |
| 2308 |
2306 // Create the watch time reporter and synchronize its initial state. | 2309 // Create the watch time reporter and synchronize its initial state. |
2307 watch_time_reporter_.reset( | 2310 watch_time_reporter_.reset( |
2308 new WatchTimeReporter(HasAudio(), HasVideo(), !!chunk_demuxer_, | 2311 new WatchTimeReporter(HasAudio(), HasVideo(), !!chunk_demuxer_, |
2309 is_encrypted_, embedded_media_experience_enabled_, | 2312 is_encrypted_, embedded_media_experience_enabled_, |
2310 media_log_.get(), pipeline_metadata_.natural_size, | 2313 media_log_.get(), pipeline_metadata_.natural_size, |
2311 base::Bind(&GetCurrentTimeInternal, this))); | 2314 base::Bind(&GetCurrentTimeInternal, this))); |
2312 watch_time_reporter_->OnVolumeChange(volume_); | 2315 watch_time_reporter_->OnVolumeChange(volume_); |
2313 if (delegate_->IsFrameHidden()) | 2316 if (delegate_->IsFrameHidden()) |
2314 watch_time_reporter_->OnHidden(); | 2317 watch_time_reporter_->OnHidden(); |
2315 else | 2318 else |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2547 } | 2550 } |
2548 | 2551 |
2549 #undef UMA_HISTOGRAM_VIDEO_HEIGHT | 2552 #undef UMA_HISTOGRAM_VIDEO_HEIGHT |
2550 | 2553 |
2551 void WebMediaPlayerImpl::SetTickClockForTest(base::TickClock* tick_clock) { | 2554 void WebMediaPlayerImpl::SetTickClockForTest(base::TickClock* tick_clock) { |
2552 tick_clock_.reset(tick_clock); | 2555 tick_clock_.reset(tick_clock); |
2553 buffered_data_source_host_.SetTickClockForTest(tick_clock); | 2556 buffered_data_source_host_.SetTickClockForTest(tick_clock); |
2554 } | 2557 } |
2555 | 2558 |
2556 } // namespace media | 2559 } // namespace media |
OLD | NEW |