OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 #include "core/layout/compositing/PaintLayerCompositor.h" | 75 #include "core/layout/compositing/PaintLayerCompositor.h" |
76 #include "core/loader/FrameLoader.h" | 76 #include "core/loader/FrameLoader.h" |
77 #include "core/page/ChromeClient.h" | 77 #include "core/page/ChromeClient.h" |
78 #include "platform/Histogram.h" | 78 #include "platform/Histogram.h" |
79 #include "platform/LayoutTestSupport.h" | 79 #include "platform/LayoutTestSupport.h" |
80 #include "platform/RuntimeEnabledFeatures.h" | 80 #include "platform/RuntimeEnabledFeatures.h" |
81 #include "platform/UserGestureIndicator.h" | 81 #include "platform/UserGestureIndicator.h" |
82 #include "platform/audio/AudioBus.h" | 82 #include "platform/audio/AudioBus.h" |
83 #include "platform/audio/AudioSourceProviderClient.h" | 83 #include "platform/audio/AudioSourceProviderClient.h" |
84 #include "platform/graphics/GraphicsLayer.h" | 84 #include "platform/graphics/GraphicsLayer.h" |
| 85 #include "platform/json/JSONValues.h" |
85 #include "platform/mediastream/MediaStreamDescriptor.h" | 86 #include "platform/mediastream/MediaStreamDescriptor.h" |
86 #include "platform/network/NetworkStateNotifier.h" | 87 #include "platform/network/NetworkStateNotifier.h" |
87 #include "platform/network/ParsedContentType.h" | 88 #include "platform/network/ParsedContentType.h" |
88 #include "platform/network/mime/ContentType.h" | 89 #include "platform/network/mime/ContentType.h" |
89 #include "platform/network/mime/MIMETypeFromURL.h" | 90 #include "platform/network/mime/MIMETypeFromURL.h" |
90 #include "platform/weborigin/SecurityOrigin.h" | 91 #include "platform/weborigin/SecurityOrigin.h" |
91 #include "public/platform/Platform.h" | 92 #include "public/platform/Platform.h" |
92 #include "public/platform/WebAudioSourceProvider.h" | 93 #include "public/platform/WebAudioSourceProvider.h" |
93 #include "public/platform/WebContentDecryptionModule.h" | 94 #include "public/platform/WebContentDecryptionModule.h" |
94 #include "public/platform/WebInbandTextTrack.h" | 95 #include "public/platform/WebInbandTextTrack.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 Document* document) { | 215 Document* document) { |
215 DocumentElementSetMap& map = DocumentToElementSetMap(); | 216 DocumentElementSetMap& map = DocumentToElementSetMap(); |
216 auto it = map.Find(document); | 217 auto it = map.Find(document); |
217 DCHECK(it != map.end()); | 218 DCHECK(it != map.end()); |
218 WeakMediaElementSet* set = it->value; | 219 WeakMediaElementSet* set = it->value; |
219 set->erase(element); | 220 set->erase(element); |
220 if (set->IsEmpty()) | 221 if (set->IsEmpty()) |
221 map.erase(it); | 222 map.erase(it); |
222 } | 223 } |
223 | 224 |
| 225 std::unique_ptr<JSONObject> BuildSimpleErrorMessage(const String& error) { |
| 226 DEFINE_STATIC_LOCAL(const String, element_error_label, ("MediaElementError")); |
| 227 std::unique_ptr<JSONObject> json_message = JSONObject::Create(); |
| 228 std::unique_ptr<JSONArray> errors = JSONArray::Create(); |
| 229 errors->PushString(error); |
| 230 json_message->SetArray(element_error_label, std::move(errors)); |
| 231 return json_message; |
| 232 } |
| 233 |
| 234 std::unique_ptr<JSONObject> BuildErrorMessage( |
| 235 const std::map<std::string, std::vector<std::string>>& messages) { |
| 236 std::unique_ptr<JSONObject> json_messages = JSONObject::Create(); |
| 237 for (const auto& entry : messages) { |
| 238 std::unique_ptr<JSONArray> errors = JSONArray::Create(); |
| 239 for (const auto& error : entry.second) |
| 240 errors->PushString(WebString::FromUTF8(error)); |
| 241 json_messages->SetArray(WebString::FromUTF8(entry.first), |
| 242 std::move(errors)); |
| 243 } |
| 244 |
| 245 return json_messages; |
| 246 } |
| 247 |
224 class AudioSourceProviderClientLockScope { | 248 class AudioSourceProviderClientLockScope { |
225 STACK_ALLOCATED(); | 249 STACK_ALLOCATED(); |
226 | 250 |
227 public: | 251 public: |
228 AudioSourceProviderClientLockScope(HTMLMediaElement& element) | 252 AudioSourceProviderClientLockScope(HTMLMediaElement& element) |
229 : client_(element.AudioSourceNode()) { | 253 : client_(element.AudioSourceNode()) { |
230 if (client_) | 254 if (client_) |
231 client_->lock(); | 255 client_->lock(); |
232 } | 256 } |
233 ~AudioSourceProviderClientLockScope() { | 257 ~AudioSourceProviderClientLockScope() { |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 LoadResource(WebMediaPlayerSource(WebMediaStream(src_object_)), String()); | 1132 LoadResource(WebMediaPlayerSource(WebMediaStream(src_object_)), String()); |
1109 } | 1133 } |
1110 | 1134 |
1111 void HTMLMediaElement::LoadSourceFromAttribute() { | 1135 void HTMLMediaElement::LoadSourceFromAttribute() { |
1112 load_state_ = kLoadingFromSrcAttr; | 1136 load_state_ = kLoadingFromSrcAttr; |
1113 const AtomicString& src_value = FastGetAttribute(srcAttr); | 1137 const AtomicString& src_value = FastGetAttribute(srcAttr); |
1114 | 1138 |
1115 // If the src attribute's value is the empty string ... jump down to the | 1139 // If the src attribute's value is the empty string ... jump down to the |
1116 // failed step below | 1140 // failed step below |
1117 if (src_value.IsEmpty()) { | 1141 if (src_value.IsEmpty()) { |
1118 MediaLoadingFailed(WebMediaPlayer::kNetworkStateFormatError); | 1142 BLINK_MEDIA_LOG << "LoadSourceFromAttribute(" << (void*)this |
1119 BLINK_MEDIA_LOG << "loadSourceFromAttribute(" << (void*)this | |
1120 << "), empty 'src'"; | 1143 << "), empty 'src'"; |
| 1144 MediaLoadingFailed(WebMediaPlayer::kNetworkStateFormatError, |
| 1145 BuildSimpleErrorMessage("Empty src attribute")); |
1121 return; | 1146 return; |
1122 } | 1147 } |
1123 | 1148 |
1124 KURL media_url = GetDocument().CompleteURL(src_value); | 1149 KURL media_url = GetDocument().CompleteURL(src_value); |
1125 if (!IsSafeToLoadURL(media_url, kComplain)) { | 1150 if (!IsSafeToLoadURL(media_url, kComplain)) { |
1126 MediaLoadingFailed(WebMediaPlayer::kNetworkStateFormatError); | 1151 MediaLoadingFailed( |
| 1152 WebMediaPlayer::kNetworkStateFormatError, |
| 1153 BuildSimpleErrorMessage("Media load rejected by URL safety check")); |
1127 return; | 1154 return; |
1128 } | 1155 } |
1129 | 1156 |
1130 // No type is available when the url comes from the 'src' attribute so | 1157 // No type is available when the url comes from the 'src' attribute so |
1131 // MediaPlayer will have to pick a media engine based on the file extension. | 1158 // MediaPlayer will have to pick a media engine based on the file extension. |
1132 LoadResource(WebMediaPlayerSource(WebURL(media_url)), String()); | 1159 LoadResource(WebMediaPlayerSource(WebURL(media_url)), String()); |
1133 } | 1160 } |
1134 | 1161 |
1135 void HTMLMediaElement::LoadNextSourceChild() { | 1162 void HTMLMediaElement::LoadNextSourceChild() { |
1136 String content_type; | 1163 String content_type; |
(...skipping 16 matching lines...) Expand all Loading... |
1153 KURL url; | 1180 KURL url; |
1154 if (source.IsURL()) { | 1181 if (source.IsURL()) { |
1155 url = source.GetAsURL(); | 1182 url = source.GetAsURL(); |
1156 DCHECK(IsSafeToLoadURL(url, kComplain)); | 1183 DCHECK(IsSafeToLoadURL(url, kComplain)); |
1157 BLINK_MEDIA_LOG << "loadResource(" << (void*)this << ", " | 1184 BLINK_MEDIA_LOG << "loadResource(" << (void*)this << ", " |
1158 << UrlForLoggingMedia(url) << ", " << content_type << ")"; | 1185 << UrlForLoggingMedia(url) << ", " << content_type << ")"; |
1159 } | 1186 } |
1160 | 1187 |
1161 LocalFrame* frame = GetDocument().GetFrame(); | 1188 LocalFrame* frame = GetDocument().GetFrame(); |
1162 if (!frame) { | 1189 if (!frame) { |
1163 MediaLoadingFailed(WebMediaPlayer::kNetworkStateFormatError); | 1190 MediaLoadingFailed(WebMediaPlayer::kNetworkStateFormatError, |
| 1191 BuildSimpleErrorMessage( |
| 1192 "Resource load failure: document has no frame")); |
1164 return; | 1193 return; |
1165 } | 1194 } |
1166 | 1195 |
1167 // The resource fetch algorithm | 1196 // The resource fetch algorithm |
1168 SetNetworkState(kNetworkLoading); | 1197 SetNetworkState(kNetworkLoading); |
1169 | 1198 |
1170 // Set m_currentSrc *before* changing to the cache url, the fact that we are | 1199 // Set m_currentSrc *before* changing to the cache url, the fact that we are |
1171 // loading from the app cache is an internal detail not exposed through the | 1200 // loading from the app cache is an internal detail not exposed through the |
1172 // media element API. | 1201 // media element API. |
1173 current_src_ = url; | 1202 current_src_ = url; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1211 // including MediaSource blob URLs. | 1240 // including MediaSource blob URLs. |
1212 if (!source.IsMediaStream() && !url.ProtocolIs("blob") && | 1241 if (!source.IsMediaStream() && !url.ProtocolIs("blob") && |
1213 EffectivePreloadType() == WebMediaPlayer::kPreloadNone) { | 1242 EffectivePreloadType() == WebMediaPlayer::kPreloadNone) { |
1214 BLINK_MEDIA_LOG << "loadResource(" << (void*)this | 1243 BLINK_MEDIA_LOG << "loadResource(" << (void*)this |
1215 << ") : Delaying load because preload == 'none'"; | 1244 << ") : Delaying load because preload == 'none'"; |
1216 DeferLoad(); | 1245 DeferLoad(); |
1217 } else { | 1246 } else { |
1218 StartPlayerLoad(); | 1247 StartPlayerLoad(); |
1219 } | 1248 } |
1220 } else { | 1249 } else { |
1221 MediaLoadingFailed(WebMediaPlayer::kNetworkStateFormatError); | 1250 MediaLoadingFailed( |
| 1251 WebMediaPlayer::kNetworkStateFormatError, |
| 1252 BuildSimpleErrorMessage(attempt_load |
| 1253 ? "Unable to load URL due to content type" |
| 1254 : "Unable to attach MediaSource")); |
1222 } | 1255 } |
1223 | 1256 |
1224 // If there is no poster to display, allow the media engine to render video | 1257 // If there is no poster to display, allow the media engine to render video |
1225 // frames as soon as they are available. | 1258 // frames as soon as they are available. |
1226 UpdateDisplayState(); | 1259 UpdateDisplayState(); |
1227 | 1260 |
1228 if (GetLayoutObject()) | 1261 if (GetLayoutObject()) |
1229 GetLayoutObject()->UpdateFromElement(); | 1262 GetLayoutObject()->UpdateFromElement(); |
1230 } | 1263 } |
1231 | 1264 |
(...skipping 25 matching lines...) Expand all Loading... |
1257 request_url.SetPass(String()); | 1290 request_url.SetPass(String()); |
1258 | 1291 |
1259 KURL kurl(kParsedURLString, request_url); | 1292 KURL kurl(kParsedURLString, request_url); |
1260 source = WebMediaPlayerSource(WebURL(kurl)); | 1293 source = WebMediaPlayerSource(WebURL(kurl)); |
1261 } | 1294 } |
1262 | 1295 |
1263 LocalFrame* frame = GetDocument().GetFrame(); | 1296 LocalFrame* frame = GetDocument().GetFrame(); |
1264 // TODO(srirama.m): Figure out how frame can be null when | 1297 // TODO(srirama.m): Figure out how frame can be null when |
1265 // coming from executeDeferredLoad() | 1298 // coming from executeDeferredLoad() |
1266 if (!frame) { | 1299 if (!frame) { |
1267 MediaLoadingFailed(WebMediaPlayer::kNetworkStateFormatError); | 1300 MediaLoadingFailed( |
| 1301 WebMediaPlayer::kNetworkStateFormatError, |
| 1302 BuildSimpleErrorMessage("Player load failure: document has no frame")); |
1268 return; | 1303 return; |
1269 } | 1304 } |
1270 | 1305 |
1271 web_media_player_ = | 1306 web_media_player_ = |
1272 frame->Loader().Client()->CreateWebMediaPlayer(*this, source, this); | 1307 frame->Loader().Client()->CreateWebMediaPlayer(*this, source, this); |
1273 if (!web_media_player_) { | 1308 if (!web_media_player_) { |
1274 MediaLoadingFailed(WebMediaPlayer::kNetworkStateFormatError); | 1309 MediaLoadingFailed(WebMediaPlayer::kNetworkStateFormatError, |
| 1310 BuildSimpleErrorMessage( |
| 1311 "Player load failure: error creating media player")); |
1275 return; | 1312 return; |
1276 } | 1313 } |
1277 | 1314 |
1278 if (GetLayoutObject()) | 1315 if (GetLayoutObject()) |
1279 GetLayoutObject()->SetShouldDoFullPaintInvalidation(); | 1316 GetLayoutObject()->SetShouldDoFullPaintInvalidation(); |
1280 // Make sure if we create/re-create the WebMediaPlayer that we update our | 1317 // Make sure if we create/re-create the WebMediaPlayer that we update our |
1281 // wrapper. | 1318 // wrapper. |
1282 audio_source_provider_.Wrap(web_media_player_->GetAudioSourceProvider()); | 1319 audio_source_provider_.Wrap(web_media_player_->GetAudioSourceProvider()); |
1283 web_media_player_->SetVolume(EffectiveMediaVolume()); | 1320 web_media_player_->SetVolume(EffectiveMediaVolume()); |
1284 | 1321 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 // 6.18 - Set the element's delaying-the-load-event flag to false. This stops | 1544 // 6.18 - Set the element's delaying-the-load-event flag to false. This stops |
1508 // delaying the load event. | 1545 // delaying the load event. |
1509 SetShouldDelayLoadEvent(false); | 1546 SetShouldDelayLoadEvent(false); |
1510 | 1547 |
1511 UpdateDisplayState(); | 1548 UpdateDisplayState(); |
1512 | 1549 |
1513 if (GetLayoutObject()) | 1550 if (GetLayoutObject()) |
1514 GetLayoutObject()->UpdateFromElement(); | 1551 GetLayoutObject()->UpdateFromElement(); |
1515 } | 1552 } |
1516 | 1553 |
1517 void HTMLMediaElement::NoneSupported() { | 1554 void HTMLMediaElement::NoneSupported(std::unique_ptr<JSONObject> messages) { |
1518 BLINK_MEDIA_LOG << "noneSupported(" << (void*)this << ")"; | 1555 BLINK_MEDIA_LOG << "NoneSupported(" << (void*)this << ", messages='" |
| 1556 << messages->ToJSONString() << "')"; |
1519 | 1557 |
1520 StopPeriodicTimers(); | 1558 StopPeriodicTimers(); |
1521 load_state_ = kWaitingForSource; | 1559 load_state_ = kWaitingForSource; |
1522 current_source_node_ = nullptr; | 1560 current_source_node_ = nullptr; |
1523 | 1561 |
1524 // 4.8.12.5 | 1562 // 4.8.12.5 |
1525 // The dedicated media source failure steps are the following steps: | 1563 // The dedicated media source failure steps are the following steps: |
1526 | 1564 |
1527 // 1 - Set the error attribute to a new MediaError object whose code attribute | 1565 // 1 - Set the error attribute to a new MediaError object whose code attribute |
1528 // is set to MEDIA_ERR_SRC_NOT_SUPPORTED. | 1566 // is set to MEDIA_ERR_SRC_NOT_SUPPORTED. |
1529 error_ = MediaError::Create(MediaError::kMediaErrSrcNotSupported); | 1567 error_ = |
| 1568 MediaError::Create(MediaError::kMediaErrSrcNotSupported, messages.get()); |
1530 | 1569 |
1531 // 2 - Forget the media element's media-resource-specific text tracks. | 1570 // 2 - Forget the media element's media-resource-specific text tracks. |
1532 ForgetResourceSpecificTracks(); | 1571 ForgetResourceSpecificTracks(); |
1533 | 1572 |
1534 // 3 - Set the element's networkState attribute to the NETWORK_NO_SOURCE | 1573 // 3 - Set the element's networkState attribute to the NETWORK_NO_SOURCE |
1535 // value. | 1574 // value. |
1536 SetNetworkState(kNetworkNoSource); | 1575 SetNetworkState(kNetworkNoSource); |
1537 | 1576 |
1538 // 4 - Set the element's show poster flag to true. | 1577 // 4 - Set the element's show poster flag to true. |
1539 UpdateDisplayState(); | 1578 UpdateDisplayState(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 for (HTMLSourceElement* source = | 1627 for (HTMLSourceElement* source = |
1589 Traversal<HTMLSourceElement>::FirstChild(*this); | 1628 Traversal<HTMLSourceElement>::FirstChild(*this); |
1590 source; source = Traversal<HTMLSourceElement>::NextSibling(*source)) | 1629 source; source = Traversal<HTMLSourceElement>::NextSibling(*source)) |
1591 source->CancelPendingErrorEvent(); | 1630 source->CancelPendingErrorEvent(); |
1592 } | 1631 } |
1593 | 1632 |
1594 void HTMLMediaElement::NetworkStateChanged() { | 1633 void HTMLMediaElement::NetworkStateChanged() { |
1595 SetNetworkState(GetWebMediaPlayer()->GetNetworkState()); | 1634 SetNetworkState(GetWebMediaPlayer()->GetNetworkState()); |
1596 } | 1635 } |
1597 | 1636 |
1598 void HTMLMediaElement::MediaLoadingFailed(WebMediaPlayer::NetworkState error) { | 1637 void HTMLMediaElement::MediaLoadingFailed( |
| 1638 WebMediaPlayer::NetworkState error, |
| 1639 std::unique_ptr<JSONObject> messages) { |
| 1640 BLINK_MEDIA_LOG << "MediaLoadingFailed(" << (void*)this << ", " |
| 1641 << static_cast<int>(error) << ", messages='" |
| 1642 << messages->ToJSONString() << "')"; |
| 1643 |
1599 StopPeriodicTimers(); | 1644 StopPeriodicTimers(); |
1600 | 1645 |
1601 // If we failed while trying to load a <source> element, the movie was never | 1646 // If we failed while trying to load a <source> element, the movie was never |
1602 // parsed, and there are more <source> children, schedule the next one | 1647 // parsed, and there are more <source> children, schedule the next one |
1603 if (ready_state_ < kHaveMetadata && | 1648 if (ready_state_ < kHaveMetadata && |
1604 load_state_ == kLoadingFromSourceElement) { | 1649 load_state_ == kLoadingFromSourceElement) { |
1605 // resource selection algorithm | 1650 // resource selection algorithm |
1606 // Step 9.Otherwise.9 - Failed with elements: Queue a task, using the DOM | 1651 // Step 9.Otherwise.9 - Failed with elements: Queue a task, using the DOM |
1607 // manipulation task source, to fire a simple event named error at the | 1652 // manipulation task source, to fire a simple event named error at the |
1608 // candidate element. | 1653 // candidate element. |
(...skipping 19 matching lines...) Expand all Loading... |
1628 BLINK_MEDIA_LOG << "mediaLoadingFailed(" << (void*)this | 1673 BLINK_MEDIA_LOG << "mediaLoadingFailed(" << (void*)this |
1629 << ") - no more <source> elements, waiting"; | 1674 << ") - no more <source> elements, waiting"; |
1630 WaitForSourceChange(); | 1675 WaitForSourceChange(); |
1631 } | 1676 } |
1632 | 1677 |
1633 return; | 1678 return; |
1634 } | 1679 } |
1635 | 1680 |
1636 if (error == WebMediaPlayer::kNetworkStateNetworkError && | 1681 if (error == WebMediaPlayer::kNetworkStateNetworkError && |
1637 ready_state_ >= kHaveMetadata) { | 1682 ready_state_ >= kHaveMetadata) { |
1638 MediaEngineError(MediaError::Create(MediaError::kMediaErrNetwork)); | 1683 MediaEngineError( |
| 1684 MediaError::Create(MediaError::kMediaErrNetwork, messages.get())); |
1639 } else if (error == WebMediaPlayer::kNetworkStateDecodeError) { | 1685 } else if (error == WebMediaPlayer::kNetworkStateDecodeError) { |
1640 MediaEngineError(MediaError::Create(MediaError::kMediaErrDecode)); | 1686 MediaEngineError( |
| 1687 MediaError::Create(MediaError::kMediaErrDecode, messages.get())); |
1641 } else if ((error == WebMediaPlayer::kNetworkStateFormatError || | 1688 } else if ((error == WebMediaPlayer::kNetworkStateFormatError || |
1642 error == WebMediaPlayer::kNetworkStateNetworkError) && | 1689 error == WebMediaPlayer::kNetworkStateNetworkError) && |
1643 load_state_ == kLoadingFromSrcAttr) { | 1690 load_state_ == kLoadingFromSrcAttr) { |
1644 NoneSupported(); | 1691 if (!messages->size()) { |
| 1692 // Generate a more meaningful error message to differentiate the two types |
| 1693 // of MEDIA_SRC_ERR_NOT_SUPPORTED. |
| 1694 NoneSupported(BuildSimpleErrorMessage( |
| 1695 error == WebMediaPlayer::kNetworkStateFormatError ? "Format error" |
| 1696 : "Network error")); |
| 1697 } else { |
| 1698 NoneSupported(std::move(messages)); |
| 1699 } |
1645 } | 1700 } |
1646 | 1701 |
1647 UpdateDisplayState(); | 1702 UpdateDisplayState(); |
1648 } | 1703 } |
1649 | 1704 |
1650 void HTMLMediaElement::SetNetworkState(WebMediaPlayer::NetworkState state) { | 1705 void HTMLMediaElement::SetNetworkState(WebMediaPlayer::NetworkState state) { |
1651 BLINK_MEDIA_LOG << "setNetworkState(" << (void*)this << ", " | 1706 BLINK_MEDIA_LOG << "setNetworkState(" << (void*)this << ", " |
1652 << static_cast<int>(state) << ") - current state is " | 1707 << static_cast<int>(state) << ") - current state is " |
1653 << static_cast<int>(network_state_); | 1708 << static_cast<int>(network_state_); |
1654 | 1709 |
1655 if (state == WebMediaPlayer::kNetworkStateEmpty) { | 1710 if (state == WebMediaPlayer::kNetworkStateEmpty) { |
1656 // Just update the cached state and leave, we can't do anything. | 1711 // Just update the cached state and leave, we can't do anything. |
1657 SetNetworkState(kNetworkEmpty); | 1712 SetNetworkState(kNetworkEmpty); |
1658 return; | 1713 return; |
1659 } | 1714 } |
1660 | 1715 |
1661 if (state == WebMediaPlayer::kNetworkStateFormatError || | 1716 if (state == WebMediaPlayer::kNetworkStateFormatError || |
1662 state == WebMediaPlayer::kNetworkStateNetworkError || | 1717 state == WebMediaPlayer::kNetworkStateNetworkError || |
1663 state == WebMediaPlayer::kNetworkStateDecodeError) { | 1718 state == WebMediaPlayer::kNetworkStateDecodeError) { |
1664 MediaLoadingFailed(state); | 1719 MediaLoadingFailed( |
| 1720 state, BuildErrorMessage(web_media_player_->GetErrorMessages())); |
1665 return; | 1721 return; |
1666 } | 1722 } |
1667 | 1723 |
1668 if (state == WebMediaPlayer::kNetworkStateIdle) { | 1724 if (state == WebMediaPlayer::kNetworkStateIdle) { |
1669 if (network_state_ > kNetworkIdle) { | 1725 if (network_state_ > kNetworkIdle) { |
1670 ChangeNetworkStateFromLoadingToIdle(); | 1726 ChangeNetworkStateFromLoadingToIdle(); |
1671 SetShouldDelayLoadEvent(false); | 1727 SetShouldDelayLoadEvent(false); |
1672 } else { | 1728 } else { |
1673 SetNetworkState(kNetworkIdle); | 1729 SetNetworkState(kNetworkIdle); |
1674 } | 1730 } |
(...skipping 2593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4268 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); | 4324 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); |
4269 } | 4325 } |
4270 | 4326 |
4271 void HTMLMediaElement::ViewportFillDebouncerTimerFired(TimerBase*) { | 4327 void HTMLMediaElement::ViewportFillDebouncerTimerFired(TimerBase*) { |
4272 mostly_filling_viewport_ = true; | 4328 mostly_filling_viewport_ = true; |
4273 if (web_media_player_) | 4329 if (web_media_player_) |
4274 web_media_player_->BecameDominantVisibleContent(mostly_filling_viewport_); | 4330 web_media_player_->BecameDominantVisibleContent(mostly_filling_viewport_); |
4275 } | 4331 } |
4276 | 4332 |
4277 } // namespace blink | 4333 } // namespace blink |
OLD | NEW |