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

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 2095053003: Merge M52: "When HLS redirects are encountered recreate WebMediaPlayer." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: 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
« no previous file with comments | « media/blink/multibuffer_data_source.cc ('k') | media/blink/webmediaplayer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/webmediaplayer_impl.cc
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc
index f9576714f7344cdacfdfe82d41dac78e5f068a9f..a959d29615257fe45d36029eb7ae334adb0ca29d 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -57,6 +57,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;
@@ -1233,6 +1237,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);
« no previous file with comments | « media/blink/multibuffer_data_source.cc ('k') | media/blink/webmediaplayer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698