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

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: Cleanup. 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 12835699e8efdc29328e6d7341ae6cafe0b9977e..047a462040bc10d83542ea1f6952005776744992 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;
@@ -1222,6 +1226,24 @@ 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 reponse_origin_url = data_source_->GetResponseOriginURL();
+ if (MediaCodecUtil::IsHLSPath(reponse_origin_url)) {
+ alternative_source_url_ = reponse_origin_url;
+ SetNetworkState(WebMediaPlayer::NetworkStateFormatError);
+ UpdatePlayState();
+ return;
+ }
+ }
+#endif
+
if (!success) {
SetNetworkState(WebMediaPlayer::NetworkStateFormatError);
@@ -1644,4 +1666,8 @@ void WebMediaPlayerImpl::ScheduleIdlePauseTimer() {
this, &WebMediaPlayerImpl::OnPause);
}
+blink::WebURL WebMediaPlayerImpl::alternativeSourceURL() const {
+ return blink::WebURL(alternative_source_url_);
+}
+
} // namespace media

Powered by Google App Engine
This is Rietveld 408576698