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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/blink/webmediaplayer_impl.h" 5 #include "media/blink/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "third_party/WebKit/public/platform/WebMediaSource.h" 52 #include "third_party/WebKit/public/platform/WebMediaSource.h"
53 #include "third_party/WebKit/public/platform/WebRect.h" 53 #include "third_party/WebKit/public/platform/WebRect.h"
54 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 54 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
55 #include "third_party/WebKit/public/platform/WebSize.h" 55 #include "third_party/WebKit/public/platform/WebSize.h"
56 #include "third_party/WebKit/public/platform/WebString.h" 56 #include "third_party/WebKit/public/platform/WebString.h"
57 #include "third_party/WebKit/public/platform/WebURL.h" 57 #include "third_party/WebKit/public/platform/WebURL.h"
58 #include "third_party/WebKit/public/web/WebFrame.h" 58 #include "third_party/WebKit/public/web/WebFrame.h"
59 #include "third_party/WebKit/public/web/WebLocalFrame.h" 59 #include "third_party/WebKit/public/web/WebLocalFrame.h"
60 #include "third_party/WebKit/public/web/WebView.h" 60 #include "third_party/WebKit/public/web/WebView.h"
61 61
62 #if defined(OS_ANDROID)
63 #include "media/base/android/media_codec_util.h"
64 #endif
65
62 using blink::WebCanvas; 66 using blink::WebCanvas;
63 using blink::WebMediaPlayer; 67 using blink::WebMediaPlayer;
64 using blink::WebRect; 68 using blink::WebRect;
65 using blink::WebSize; 69 using blink::WebSize;
66 using blink::WebString; 70 using blink::WebString;
67 using gpu::gles2::GLES2Interface; 71 using gpu::gles2::GLES2Interface;
68 72
69 #define STATIC_ASSERT_ENUM(a, b) \ 73 #define STATIC_ASSERT_ENUM(a, b) \
70 static_assert(static_cast<int>(a) == static_cast<int>(b), \ 74 static_assert(static_cast<int>(a) == static_cast<int>(b), \
71 "mismatching enums: " #a) 75 "mismatching enums: " #a)
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 1213
1210 void WebMediaPlayerImpl::setPoster(const blink::WebURL& poster) { 1214 void WebMediaPlayerImpl::setPoster(const blink::WebURL& poster) {
1211 cast_impl_.setPoster(poster); 1215 cast_impl_.setPoster(poster);
1212 } 1216 }
1213 #endif // defined(OS_ANDROID) // WMPI_CAST 1217 #endif // defined(OS_ANDROID) // WMPI_CAST
1214 1218
1215 void WebMediaPlayerImpl::DataSourceInitialized(bool success) { 1219 void WebMediaPlayerImpl::DataSourceInitialized(bool success) {
1216 DVLOG(1) << __FUNCTION__; 1220 DVLOG(1) << __FUNCTION__;
1217 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1221 DCHECK(main_task_runner_->BelongsToCurrentThread());
1218 1222
1223 #if defined(OS_ANDROID)
1224 // We can't play HLS URLs with WebMediaPlayerImpl, so in cases where they are
1225 // encountered, instruct the HTML media element to create a new WebMediaPlayer
1226 // instance with the correct URL to trigger WebMediaPlayerAndroid creation.
1227 //
1228 // TODO(tguilbert): Remove this code path once we have the ability to host a
1229 // MediaPlayer within a Mojo media renderer. http://crbug.com/580626
1230 if (data_source_) {
1231 const GURL url_after_redirects = data_source_->GetUrlAfterRedirects();
1232 if (MediaCodecUtil::IsHLSPath(url_after_redirects)) {
1233 client_->requestReload(url_after_redirects);
1234 // |this| may be destructed, do nothing after this.
1235 return;
1236 }
1237 }
1238 #endif
1239
1219 if (!success) { 1240 if (!success) {
1220 SetNetworkState(WebMediaPlayer::NetworkStateFormatError); 1241 SetNetworkState(WebMediaPlayer::NetworkStateFormatError);
1221 1242
1222 // Not really necessary, since the pipeline was never started, but it at 1243 // Not really necessary, since the pipeline was never started, but it at
1223 // least this makes sure that the error handling code is in sync. 1244 // least this makes sure that the error handling code is in sync.
1224 UpdatePlayState(); 1245 UpdatePlayState();
1225 1246
1226 return; 1247 return;
1227 } 1248 }
1228 1249
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 if (isRemote()) 1653 if (isRemote())
1633 return; 1654 return;
1634 #endif 1655 #endif
1635 1656
1636 // Idle timeout chosen arbitrarily. 1657 // Idle timeout chosen arbitrarily.
1637 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), 1658 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5),
1638 this, &WebMediaPlayerImpl::OnPause); 1659 this, &WebMediaPlayerImpl::OnPause);
1639 } 1660 }
1640 1661
1641 } // namespace media 1662 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698