| 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 DVLOG(1) << __FUNCTION__ << "(" << load_type << ", " << url << ", " | 261 DVLOG(1) << __FUNCTION__ << "(" << load_type << ", " << url << ", " |
| 262 << cors_mode << ")"; | 262 << cors_mode << ")"; |
| 263 if (!defer_load_cb_.is_null()) { | 263 if (!defer_load_cb_.is_null()) { |
| 264 defer_load_cb_.Run(base::Bind( | 264 defer_load_cb_.Run(base::Bind( |
| 265 &WebMediaPlayerImpl::DoLoad, AsWeakPtr(), load_type, url, cors_mode)); | 265 &WebMediaPlayerImpl::DoLoad, AsWeakPtr(), load_type, url, cors_mode)); |
| 266 return; | 266 return; |
| 267 } | 267 } |
| 268 DoLoad(load_type, url, cors_mode); | 268 DoLoad(load_type, url, cors_mode); |
| 269 } | 269 } |
| 270 | 270 |
| 271 bool WebMediaPlayerImpl::supportsOverlayFullscreenVideo() { | 271 WebMediaPlayer::OverlayFullscreenVideoMode |
| 272 WebMediaPlayerImpl::getOverlayFullscreenVideoMode() { |
| 272 #if defined(OS_ANDROID) | 273 #if defined(OS_ANDROID) |
| 273 // OverlayFullscreenVideo is only used when we're H/W decoding to an | 274 // OverlayFullscreenVideo is only used when we're H/W decoding to an |
| 274 // SurfaceView underlay on Android. It's possible that we haven't initialized | 275 // SurfaceView underlay on Android. It's possible that we haven't initialized |
| 275 // any decoders before entering fullscreen, so we won't know whether to use | 276 // any decoders before entering fullscreen, so we won't know whether to use |
| 276 // OverlayFullscreenVideo. In that case we'll default to | 277 // OverlayFullscreenVideo. In that case we'll default to |
| 277 // non-OverlayFullscreenVideo, which still works correctly, but has janky | 278 // non-OverlayFullscreenVideo, which still works correctly, but has janky |
| 278 // orientation changes. | 279 // orientation changes. |
| 279 | 280 |
| 280 // We return a consistent value while in fullscreen to avoid us getting into a | 281 // We return a consistent value while in fullscreen to avoid us getting into a |
| 281 // state where some of the OverlayFullscreenVideo adjustments are applied and | 282 // state where some of the OverlayFullscreenVideo adjustments are applied and |
| 282 // some aren't. | 283 // some aren't. |
| 283 // TODO(watk): Implement dynamic OverlayFullscreenVideo switching in blink. | 284 // TODO(watk): Implement dynamic OverlayFullscreenVideo switching in blink. |
| 284 if (!fullscreen_) { | 285 if (!fullscreen_) { |
| 285 supports_overlay_fullscreen_video_ = | 286 supports_overlay_fullscreen_video_ = |
| 286 decoder_requires_restart_for_fullscreen_; | 287 decoder_requires_restart_for_fullscreen_; |
| 287 } | 288 } |
| 288 return supports_overlay_fullscreen_video_; | 289 return supports_overlay_fullscreen_video_ |
| 290 ? WebMediaPlayer::OverlayFullscreenVideoMode::VideoLayerVisible |
| 291 : WebMediaPlayer::OverlayFullscreenVideoMode::Disabled; |
| 289 #else | 292 #else |
| 290 return false; | 293 return WebMediaPlayer::OverlayFullscreenVideoMode::Disabled; |
| 291 #endif | 294 #endif |
| 292 } | 295 } |
| 293 | 296 |
| 294 void WebMediaPlayerImpl::enteredFullscreen() { | 297 void WebMediaPlayerImpl::enteredFullscreen() { |
| 295 fullscreen_ = true; | 298 fullscreen_ = true; |
| 296 if (decoder_requires_restart_for_fullscreen_) | 299 if (decoder_requires_restart_for_fullscreen_) |
| 297 ScheduleRestart(); | 300 ScheduleRestart(); |
| 298 } | 301 } |
| 299 | 302 |
| 300 void WebMediaPlayerImpl::exitedFullscreen() { | 303 void WebMediaPlayerImpl::exitedFullscreen() { |
| (...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1632 if (isRemote()) | 1635 if (isRemote()) |
| 1633 return; | 1636 return; |
| 1634 #endif | 1637 #endif |
| 1635 | 1638 |
| 1636 // Idle timeout chosen arbitrarily. | 1639 // Idle timeout chosen arbitrarily. |
| 1637 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), | 1640 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), |
| 1638 this, &WebMediaPlayerImpl::OnPause); | 1641 this, &WebMediaPlayerImpl::OnPause); |
| 1639 } | 1642 } |
| 1640 | 1643 |
| 1641 } // namespace media | 1644 } // namespace media |
| OLD | NEW |