Chromium Code Reviews| 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 10 matching lines...) Expand all Loading... | |
| 21 #include "base/metrics/histogram.h" | 21 #include "base/metrics/histogram.h" |
| 22 #include "base/single_thread_task_runner.h" | 22 #include "base/single_thread_task_runner.h" |
| 23 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
| 24 #include "base/task_runner_util.h" | 24 #include "base/task_runner_util.h" |
| 25 #include "base/threading/thread_task_runner_handle.h" | 25 #include "base/threading/thread_task_runner_handle.h" |
| 26 #include "base/trace_event/trace_event.h" | 26 #include "base/trace_event/trace_event.h" |
| 27 #include "build/build_config.h" | 27 #include "build/build_config.h" |
| 28 #include "cc/blink/web_layer_impl.h" | 28 #include "cc/blink/web_layer_impl.h" |
| 29 #include "cc/layers/video_layer.h" | 29 #include "cc/layers/video_layer.h" |
| 30 #include "media/audio/null_audio_sink.h" | 30 #include "media/audio/null_audio_sink.h" |
| 31 #include "media/base/android/url_demuxer_stream_provider.h" | |
| 31 #include "media/base/bind_to_current_loop.h" | 32 #include "media/base/bind_to_current_loop.h" |
| 32 #include "media/base/cdm_context.h" | 33 #include "media/base/cdm_context.h" |
| 33 #include "media/base/limits.h" | 34 #include "media/base/limits.h" |
| 34 #include "media/base/media_log.h" | 35 #include "media/base/media_log.h" |
| 35 #include "media/base/media_switches.h" | 36 #include "media/base/media_switches.h" |
| 36 #include "media/base/text_renderer.h" | 37 #include "media/base/text_renderer.h" |
| 37 #include "media/base/timestamp_constants.h" | 38 #include "media/base/timestamp_constants.h" |
| 38 #include "media/base/video_frame.h" | 39 #include "media/base/video_frame.h" |
| 39 #include "media/blink/texttrack_impl.h" | 40 #include "media/blink/texttrack_impl.h" |
| 40 #include "media/blink/webaudiosourceprovider_impl.h" | 41 #include "media/blink/webaudiosourceprovider_impl.h" |
| 41 #include "media/blink/webcontentdecryptionmodule_impl.h" | 42 #include "media/blink/webcontentdecryptionmodule_impl.h" |
| 42 #include "media/blink/webinbandtexttrack_impl.h" | 43 #include "media/blink/webinbandtexttrack_impl.h" |
| 43 #include "media/blink/webmediaplayer_delegate.h" | 44 #include "media/blink/webmediaplayer_delegate.h" |
| 44 #include "media/blink/webmediaplayer_util.h" | 45 #include "media/blink/webmediaplayer_util.h" |
| 45 #include "media/blink/webmediasource_impl.h" | 46 #include "media/blink/webmediasource_impl.h" |
| 46 #include "media/filters/chunk_demuxer.h" | 47 #include "media/filters/chunk_demuxer.h" |
| 47 #include "media/filters/ffmpeg_demuxer.h" | 48 #include "media/filters/ffmpeg_demuxer.h" |
| 49 #include "media/media_features.h" | |
| 48 #include "third_party/WebKit/public/platform/WebEncryptedMediaTypes.h" | 50 #include "third_party/WebKit/public/platform/WebEncryptedMediaTypes.h" |
| 49 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" | 51 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" |
| 50 #include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient. h" | 52 #include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient. h" |
| 51 #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h" | 53 #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h" |
| 52 #include "third_party/WebKit/public/platform/WebMediaSource.h" | 54 #include "third_party/WebKit/public/platform/WebMediaSource.h" |
| 53 #include "third_party/WebKit/public/platform/WebRect.h" | 55 #include "third_party/WebKit/public/platform/WebRect.h" |
| 54 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 56 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
| 55 #include "third_party/WebKit/public/platform/WebSize.h" | 57 #include "third_party/WebKit/public/platform/WebSize.h" |
| 56 #include "third_party/WebKit/public/platform/WebString.h" | 58 #include "third_party/WebKit/public/platform/WebString.h" |
| 57 #include "third_party/WebKit/public/platform/WebURL.h" | 59 #include "third_party/WebKit/public/platform/WebURL.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 262 << cors_mode << ")"; | 264 << cors_mode << ")"; |
| 263 if (!defer_load_cb_.is_null()) { | 265 if (!defer_load_cb_.is_null()) { |
| 264 defer_load_cb_.Run(base::Bind( | 266 defer_load_cb_.Run(base::Bind( |
| 265 &WebMediaPlayerImpl::DoLoad, AsWeakPtr(), load_type, url, cors_mode)); | 267 &WebMediaPlayerImpl::DoLoad, AsWeakPtr(), load_type, url, cors_mode)); |
| 266 return; | 268 return; |
| 267 } | 269 } |
| 268 DoLoad(load_type, url, cors_mode); | 270 DoLoad(load_type, url, cors_mode); |
| 269 } | 271 } |
| 270 | 272 |
| 271 bool WebMediaPlayerImpl::supportsOverlayFullscreenVideo() { | 273 bool WebMediaPlayerImpl::supportsOverlayFullscreenVideo() { |
| 272 #if defined(OS_ANDROID) | 274 #if BUILDFLAG(FORCE_MOJO_MEDIA_PLAYER_RENDERER) |
| 275 return true; | |
| 276 #elif defined(OS_ANDROID) | |
| 273 // OverlayFullscreenVideo is only used when we're H/W decoding to an | 277 // 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 | 278 // 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 | 279 // any decoders before entering fullscreen, so we won't know whether to use |
| 276 // OverlayFullscreenVideo. In that case we'll default to | 280 // OverlayFullscreenVideo. In that case we'll default to |
| 277 // non-OverlayFullscreenVideo, which still works correctly, but has janky | 281 // non-OverlayFullscreenVideo, which still works correctly, but has janky |
| 278 // orientation changes. | 282 // orientation changes. |
| 279 | 283 |
| 280 // We return a consistent value while in fullscreen to avoid us getting into a | 284 // 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 | 285 // state where some of the OverlayFullscreenVideo adjustments are applied and |
| 282 // some aren't. | 286 // some aren't. |
| (...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1286 media_task_runner_, worker_task_runner_, audio_source_provider_.get(), | 1290 media_task_runner_, worker_task_runner_, audio_source_provider_.get(), |
| 1287 compositor_, request_surface_cb); | 1291 compositor_, request_surface_cb); |
| 1288 } | 1292 } |
| 1289 | 1293 |
| 1290 void WebMediaPlayerImpl::StartPipeline() { | 1294 void WebMediaPlayerImpl::StartPipeline() { |
| 1291 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 1295 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 1292 | 1296 |
| 1293 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb = | 1297 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb = |
| 1294 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnEncryptedMediaInitData); | 1298 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnEncryptedMediaInitData); |
| 1295 | 1299 |
| 1300 #if BUILDFLAG(FORCE_MOJO_MEDIA_PLAYER_RENDERER) | |
| 1301 demuxer_.reset(new UrlDemuxerStreamProvider(GURL())); | |
| 1302 pipeline_controller_.Start(demuxer_.get(), this, true, true); | |
| 1303 return; | |
|
Julien Isorce Samsung
2016/08/08 13:01:58
Hi, not sure what CL is the most up to date with h
| |
| 1304 #endif | |
| 1305 | |
| 1296 // Figure out which demuxer to use. | 1306 // Figure out which demuxer to use. |
| 1297 if (load_type_ != LoadTypeMediaSource) { | 1307 if (load_type_ != LoadTypeMediaSource) { |
| 1298 DCHECK(!chunk_demuxer_); | 1308 DCHECK(!chunk_demuxer_); |
| 1299 DCHECK(data_source_); | 1309 DCHECK(data_source_); |
| 1300 | 1310 |
| 1301 #if !defined(MEDIA_DISABLE_FFMPEG) | 1311 #if !defined(MEDIA_DISABLE_FFMPEG) |
| 1302 Demuxer::MediaTracksUpdatedCB media_tracks_updated_cb = | 1312 Demuxer::MediaTracksUpdatedCB media_tracks_updated_cb = |
| 1303 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnFFmpegMediaTracksUpdated); | 1313 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnFFmpegMediaTracksUpdated); |
| 1304 | 1314 |
| 1305 demuxer_.reset(new FFmpegDemuxer(media_task_runner_, data_source_.get(), | 1315 demuxer_.reset(new FFmpegDemuxer(media_task_runner_, data_source_.get(), |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1638 if (isRemote()) | 1648 if (isRemote()) |
| 1639 return; | 1649 return; |
| 1640 #endif | 1650 #endif |
| 1641 | 1651 |
| 1642 // Idle timeout chosen arbitrarily. | 1652 // Idle timeout chosen arbitrarily. |
| 1643 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), | 1653 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), |
| 1644 this, &WebMediaPlayerImpl::OnPause); | 1654 this, &WebMediaPlayerImpl::OnPause); |
| 1645 } | 1655 } |
| 1646 | 1656 |
| 1647 } // namespace media | 1657 } // namespace media |
| OLD | NEW |