Chromium Code Reviews| Index: media/blink/webmediaplayer_impl.cc |
| diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc |
| index cdebe7739579127cc1db0a4aadd49269324e37b7..49c26da74bf9a8c4f9b4a768cc63ef750a194a1f 100644 |
| --- a/media/blink/webmediaplayer_impl.cc |
| +++ b/media/blink/webmediaplayer_impl.cc |
| @@ -35,6 +35,7 @@ |
| #include "media/base/media_keys.h" |
| #include "media/base/media_log.h" |
| #include "media/base/media_switches.h" |
| +#include "media/base/media_url_demuxer.h" |
| #include "media/base/text_renderer.h" |
| #include "media/base/timestamp_constants.h" |
| #include "media/base/video_frame.h" |
| @@ -48,6 +49,7 @@ |
| #include "media/blink/webmediasource_impl.h" |
| #include "media/filters/chunk_demuxer.h" |
| #include "media/filters/ffmpeg_demuxer.h" |
| +#include "media/media_features.h" |
|
tguilbert
2016/10/11 18:54:33
Will remove.
tguilbert
2016/10/12 21:46:25
Done.
|
| #include "third_party/WebKit/public/platform/WebEncryptedMediaTypes.h" |
| #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" |
| #include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient.h" |
| @@ -226,6 +228,7 @@ WebMediaPlayerImpl::WebMediaPlayerImpl( |
| overlay_surface_id_(SurfaceManager::kNoSurfaceID), |
| suppress_destruction_errors_(false), |
| can_suspend_state_(CanSuspendState::UNKNOWN), |
| + use_fallback_path_(false), |
| is_encrypted_(false), |
| underflow_count_(0) { |
| DCHECK(!adjust_allocated_memory_cb_.is_null()); |
| @@ -353,6 +356,9 @@ void WebMediaPlayerImpl::DoLoad(LoadType load_type, |
| // Set subresource URL for crash reporting. |
| base::debug::SetCrashKeyValue("subresource_url", gurl.spec()); |
| + if (use_fallback_path_) |
| + fallback_url_ = gurl; |
| + |
| load_type_ = load_type; |
| SetNetworkState(WebMediaPlayer::NetworkStateLoading); |
| @@ -1373,6 +1379,10 @@ void WebMediaPlayerImpl::SetDeviceScaleFactor(float scale_factor) { |
| void WebMediaPlayerImpl::setPoster(const blink::WebURL& poster) { |
| cast_impl_.setPoster(poster); |
| } |
| + |
| +void WebMediaPlayerImpl::SetUseFallbackPath(bool use_fallback_path) { |
| + use_fallback_path = true; |
| +} |
| #endif // defined(OS_ANDROID) // WMPI_CAST |
| void WebMediaPlayerImpl::DataSourceInitialized(bool success) { |
| @@ -1386,7 +1396,7 @@ void WebMediaPlayerImpl::DataSourceInitialized(bool success) { |
| // |
| // TODO(tguilbert): Remove this code path once we have the ability to host a |
| // MediaPlayer within a Mojo media renderer. http://crbug.com/580626 |
| - if (data_source_) { |
| + if (data_source_ && !use_fallback_path_) { |
| const GURL url_after_redirects = data_source_->GetUrlAfterRedirects(); |
| if (MediaCodecUtil::IsHLSPath(url_after_redirects)) { |
| client_->requestReload(url_after_redirects); |
| @@ -1435,6 +1445,7 @@ void WebMediaPlayerImpl::OnSurfaceRequested( |
| const SurfaceCreatedCB& surface_created_cb) { |
| DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| DCHECK(surface_manager_); |
| + DCHECK(!use_fallback_path_); |
| // A null callback indicates that the decoder is going away. |
| if (surface_created_cb.is_null()) { |
| @@ -1482,6 +1493,15 @@ void WebMediaPlayerImpl::StartPipeline() { |
| Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb = |
| BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnEncryptedMediaInitData); |
| + if (use_fallback_path_) { |
| + demuxer_.reset(new MediaUrlDemuxer(media_task_runner_, fallback_url_)); |
| + |
| + // TODO(tguilbert): For reviewers -- What are the proper values for |
| + // |is_streaming| and |is_static|? |
|
liberato (no reviews please)
2016/10/12 15:15:18
false, false i think is fine. i think that it mat
tguilbert
2016/10/12 21:46:25
Done.
|
| + pipeline_controller_.Start(demuxer_.get(), this, false, false); |
| + return; |
| + } |
| + |
| // Figure out which demuxer to use. |
| if (load_type_ != LoadTypeMediaSource) { |
| DCHECK(!chunk_demuxer_); |