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

Side by Side 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, 5 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
« no previous file with comments | « media/blink/multibuffer_data_source.cc ('k') | media/blink/webmediaplayer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "third_party/WebKit/public/platform/WebMediaSource.h" 50 #include "third_party/WebKit/public/platform/WebMediaSource.h"
51 #include "third_party/WebKit/public/platform/WebRect.h" 51 #include "third_party/WebKit/public/platform/WebRect.h"
52 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 52 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
53 #include "third_party/WebKit/public/platform/WebSize.h" 53 #include "third_party/WebKit/public/platform/WebSize.h"
54 #include "third_party/WebKit/public/platform/WebString.h" 54 #include "third_party/WebKit/public/platform/WebString.h"
55 #include "third_party/WebKit/public/platform/WebURL.h" 55 #include "third_party/WebKit/public/platform/WebURL.h"
56 #include "third_party/WebKit/public/web/WebFrame.h" 56 #include "third_party/WebKit/public/web/WebFrame.h"
57 #include "third_party/WebKit/public/web/WebLocalFrame.h" 57 #include "third_party/WebKit/public/web/WebLocalFrame.h"
58 #include "third_party/WebKit/public/web/WebView.h" 58 #include "third_party/WebKit/public/web/WebView.h"
59 59
60 #if defined(OS_ANDROID)
61 #include "media/base/android/media_codec_util.h"
62 #endif
63
60 using blink::WebCanvas; 64 using blink::WebCanvas;
61 using blink::WebMediaPlayer; 65 using blink::WebMediaPlayer;
62 using blink::WebRect; 66 using blink::WebRect;
63 using blink::WebSize; 67 using blink::WebSize;
64 using blink::WebString; 68 using blink::WebString;
65 using gpu::gles2::GLES2Interface; 69 using gpu::gles2::GLES2Interface;
66 70
67 #define STATIC_ASSERT_ENUM(a, b) \ 71 #define STATIC_ASSERT_ENUM(a, b) \
68 static_assert(static_cast<int>(a) == static_cast<int>(b), \ 72 static_assert(static_cast<int>(a) == static_cast<int>(b), \
69 "mismatching enums: " #a) 73 "mismatching enums: " #a)
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 1230
1227 void WebMediaPlayerImpl::setPoster(const blink::WebURL& poster) { 1231 void WebMediaPlayerImpl::setPoster(const blink::WebURL& poster) {
1228 cast_impl_.setPoster(poster); 1232 cast_impl_.setPoster(poster);
1229 } 1233 }
1230 #endif // defined(OS_ANDROID) // WMPI_CAST 1234 #endif // defined(OS_ANDROID) // WMPI_CAST
1231 1235
1232 void WebMediaPlayerImpl::DataSourceInitialized(bool success) { 1236 void WebMediaPlayerImpl::DataSourceInitialized(bool success) {
1233 DVLOG(1) << __FUNCTION__; 1237 DVLOG(1) << __FUNCTION__;
1234 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1238 DCHECK(main_task_runner_->BelongsToCurrentThread());
1235 1239
1240 #if defined(OS_ANDROID)
1241 // We can't play HLS URLs with WebMediaPlayerImpl, so in cases where they are
1242 // encountered, instruct the HTML media element to create a new WebMediaPlayer
1243 // instance with the correct URL to trigger WebMediaPlayerAndroid creation.
1244 //
1245 // TODO(tguilbert): Remove this code path once we have the ability to host a
1246 // MediaPlayer within a Mojo media renderer. http://crbug.com/580626
1247 if (data_source_) {
1248 const GURL url_after_redirects = data_source_->GetUrlAfterRedirects();
1249 if (MediaCodecUtil::IsHLSPath(url_after_redirects)) {
1250 client_->requestReload(url_after_redirects);
1251 // |this| may be destructed, do nothing after this.
1252 return;
1253 }
1254 }
1255 #endif
1256
1236 if (!success) { 1257 if (!success) {
1237 SetNetworkState(WebMediaPlayer::NetworkStateFormatError); 1258 SetNetworkState(WebMediaPlayer::NetworkStateFormatError);
1238 1259
1239 // Not really necessary, since the pipeline was never started, but it at 1260 // Not really necessary, since the pipeline was never started, but it at
1240 // least this makes sure that the error handling code is in sync. 1261 // least this makes sure that the error handling code is in sync.
1241 UpdatePlayState(); 1262 UpdatePlayState();
1242 1263
1243 return; 1264 return;
1244 } 1265 }
1245 1266
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 if (isRemote()) 1667 if (isRemote())
1647 return; 1668 return;
1648 #endif 1669 #endif
1649 1670
1650 // Idle timeout chosen arbitrarily. 1671 // Idle timeout chosen arbitrarily.
1651 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), 1672 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5),
1652 this, &WebMediaPlayerImpl::OnPause); 1673 this, &WebMediaPlayerImpl::OnPause);
1653 } 1674 }
1654 1675
1655 } // namespace media 1676 } // namespace media
OLDNEW
« 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