Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(973)

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 2387293007: Register MediaPlayerRenderer service (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/blink/webmediaplayer_impl.cc
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc
index 7c67743e982b430e3c7794a1e1d2a3310806ee3c..fef477e09dd685622bf1299fe9ee19e795f7970b 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -34,6 +34,7 @@
#include "media/base/media_content_type.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"
@@ -47,6 +48,7 @@
#include "media/blink/webmediasource_impl.h"
#include "media/filters/chunk_demuxer.h"
#include "media/filters/ffmpeg_demuxer.h"
+#include "media/media_features.h"
#include "third_party/WebKit/public/platform/WebEncryptedMediaTypes.h"
#include "third_party/WebKit/public/platform/WebMediaPlayerClient.h"
#include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient.h"
@@ -1222,6 +1224,11 @@ void WebMediaPlayerImpl::OnVideoNaturalSizeChange(const gfx::Size& size) {
pipeline_metadata_.natural_size = rotated_size;
client_->sizeChanged();
+
+ // Re-create the WatchTimeReporter, since it was created using an initial
+ // video size of (0,0).
+ if (use_fallback_path_)
liberato (no reviews please) 2016/10/07 20:17:38 if we aren't doing this on every natural size chan
tguilbert 2016/10/11 18:54:33 Ok. I need to do an HLS related UMA cleanup anyway
+ CreateWatchTimeReporter();
}
void WebMediaPlayerImpl::OnVideoOpacityChange(bool opaque) {
@@ -1352,13 +1359,18 @@ void WebMediaPlayerImpl::SetDeviceScaleFactor(float scale_factor) {
void WebMediaPlayerImpl::setPoster(const blink::WebURL& poster) {
cast_impl_.setPoster(poster);
}
+
+void WebMediaPlayerImpl::EnableFallbackMediaPlayer(const GURL& url) {
liberato (no reviews please) 2016/10/07 20:17:37 this is very implementation-detail-like for an ext
tguilbert 2016/10/11 18:54:33 Right now, as of this patch, |use_fallback_path_|
+ fallback_url_ = url;
liberato (no reviews please) 2016/10/06 14:55:46 what's the difference between this and the one use
tguilbert 2016/10/11 18:54:33 None. Updated :)
+ use_fallback_path_ = true;
+}
#endif // defined(OS_ANDROID) // WMPI_CAST
void WebMediaPlayerImpl::DataSourceInitialized(bool success) {
DVLOG(1) << __func__;
DCHECK(main_task_runner_->BelongsToCurrentThread());
-#if defined(OS_ANDROID)
+#if defined(OS_ANDROID) && !BUILDFLAG(ENABLE_MOJO_MEDIA_PLAYER_RENDERER)
// We can't play HLS URLs with WebMediaPlayerImpl, so in cases where they are
// encountered, instruct the HTML media element to create a new WebMediaPlayer
// instance with the correct URL to trigger WebMediaPlayerAndroid creation.
@@ -1414,6 +1426,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()) {
@@ -1461,6 +1474,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|?
+ pipeline_controller_.Start(demuxer_.get(), this, false, false);
+ return;
+ }
+
// Figure out which demuxer to use.
if (load_type_ != LoadTypeMediaSource) {
DCHECK(!chunk_demuxer_);

Powered by Google App Engine
This is Rietveld 408576698