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

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 2046253002: When HLS redirects are encountered recreate WebMediaPlayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Explicit option. Created 4 years, 6 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 55f0bb4d99353073a1ff048adbf3a11e138aefe7..a1a375e164341e02055d8f548ce3a00ad0e02004 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -59,6 +59,10 @@
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebView.h"
+#if defined(OS_ANDROID)
+#include "media/base/android/media_codec_util.h"
+#endif
+
using blink::WebCanvas;
using blink::WebMediaPlayer;
using blink::WebRect;
@@ -1216,6 +1220,23 @@ void WebMediaPlayerImpl::DataSourceInitialized(bool success) {
DVLOG(1) << __FUNCTION__;
DCHECK(main_task_runner_->BelongsToCurrentThread());
+#if defined(OS_ANDROID)
+ // 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.
+ //
+ // 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_) {
+ const GURL url_after_redirects = data_source_->GetUrlAfterRedirects();
+ if (MediaCodecUtil::IsHLSPath(url_after_redirects)) {
+ client_->requestReload(url_after_redirects);
+ // |this| may be destructed, do nothing after this.
+ return;
+ }
+ }
+#endif
+
if (!success) {
SetNetworkState(WebMediaPlayer::NetworkStateFormatError);

Powered by Google App Engine
This is Rietveld 408576698