| OLD | NEW |
| 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 Loading... |
| 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 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 | 1215 |
| 1212 void WebMediaPlayerImpl::setPoster(const blink::WebURL& poster) { | 1216 void WebMediaPlayerImpl::setPoster(const blink::WebURL& poster) { |
| 1213 cast_impl_.setPoster(poster); | 1217 cast_impl_.setPoster(poster); |
| 1214 } | 1218 } |
| 1215 #endif // defined(OS_ANDROID) // WMPI_CAST | 1219 #endif // defined(OS_ANDROID) // WMPI_CAST |
| 1216 | 1220 |
| 1217 void WebMediaPlayerImpl::DataSourceInitialized(bool success) { | 1221 void WebMediaPlayerImpl::DataSourceInitialized(bool success) { |
| 1218 DVLOG(1) << __FUNCTION__; | 1222 DVLOG(1) << __FUNCTION__; |
| 1219 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 1223 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 1220 | 1224 |
| 1225 #if defined(OS_ANDROID) |
| 1226 // We can't play HLS URLs with WebMediaPlayerImpl, so in cases where they are |
| 1227 // encountered, instruct the HTML media element to create a new WebMediaPlayer |
| 1228 // instance with the correct URL to trigger WebMediaPlayerAndroid creation. |
| 1229 // |
| 1230 // TODO(tguilbert): Remove this code path once we have the ability to host a |
| 1231 // MediaPlayer within a Mojo media renderer. http://crbug.com/580626 |
| 1232 if (data_source_) { |
| 1233 const GURL url_after_redirects = data_source_->GetUrlAfterRedirects(); |
| 1234 if (MediaCodecUtil::IsHLSPath(url_after_redirects)) { |
| 1235 client_->requestReload(url_after_redirects); |
| 1236 // |this| may be destructed, do nothing after this. |
| 1237 return; |
| 1238 } |
| 1239 } |
| 1240 #endif |
| 1241 |
| 1221 if (!success) { | 1242 if (!success) { |
| 1222 SetNetworkState(WebMediaPlayer::NetworkStateFormatError); | 1243 SetNetworkState(WebMediaPlayer::NetworkStateFormatError); |
| 1223 | 1244 |
| 1224 // Not really necessary, since the pipeline was never started, but it at | 1245 // Not really necessary, since the pipeline was never started, but it at |
| 1225 // least this makes sure that the error handling code is in sync. | 1246 // least this makes sure that the error handling code is in sync. |
| 1226 UpdatePlayState(); | 1247 UpdatePlayState(); |
| 1227 | 1248 |
| 1228 return; | 1249 return; |
| 1229 } | 1250 } |
| 1230 | 1251 |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1634 if (isRemote()) | 1655 if (isRemote()) |
| 1635 return; | 1656 return; |
| 1636 #endif | 1657 #endif |
| 1637 | 1658 |
| 1638 // Idle timeout chosen arbitrarily. | 1659 // Idle timeout chosen arbitrarily. |
| 1639 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), | 1660 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), |
| 1640 this, &WebMediaPlayerImpl::OnPause); | 1661 this, &WebMediaPlayerImpl::OnPause); |
| 1641 } | 1662 } |
| 1642 | 1663 |
| 1643 } // namespace media | 1664 } // namespace media |
| OLD | NEW |