| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // 5.4 Replace the ranges in intersection ranges with the new intersecti
on ranges. | 137 // 5.4 Replace the ranges in intersection ranges with the new intersecti
on ranges. |
| 138 intersectionRanges->intersectWith(sourceRanges); | 138 intersectionRanges->intersectWith(sourceRanges); |
| 139 } | 139 } |
| 140 | 140 |
| 141 return intersectionRanges.release(); | 141 return intersectionRanges.release(); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void MediaSourceBase::setDuration(double duration, ExceptionState& es) | 144 void MediaSourceBase::setDuration(double duration, ExceptionState& es) |
| 145 { | 145 { |
| 146 if (duration < 0.0 || std::isnan(duration)) { | 146 if (duration < 0.0 || std::isnan(duration)) { |
| 147 es.throwDOMException(InvalidAccessError); | 147 es.throwUninformativeAndGenericDOMException(InvalidAccessError); |
| 148 return; | 148 return; |
| 149 } | 149 } |
| 150 if (!isOpen()) { | 150 if (!isOpen()) { |
| 151 es.throwDOMException(InvalidStateError); | 151 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
| 152 return; | 152 return; |
| 153 } | 153 } |
| 154 | 154 |
| 155 // Synchronously process duration change algorithm to enforce any required | 155 // Synchronously process duration change algorithm to enforce any required |
| 156 // seek is started prior to returning. | 156 // seek is started prior to returning. |
| 157 m_attachedElement->durationChanged(duration); | 157 m_attachedElement->durationChanged(duration); |
| 158 m_private->setDuration(duration); | 158 m_private->setDuration(duration); |
| 159 } | 159 } |
| 160 | 160 |
| 161 | 161 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 181 | 181 |
| 182 void MediaSourceBase::endOfStream(const AtomicString& error, ExceptionState& es) | 182 void MediaSourceBase::endOfStream(const AtomicString& error, ExceptionState& es) |
| 183 { | 183 { |
| 184 DEFINE_STATIC_LOCAL(const AtomicString, network, ("network", AtomicString::C
onstructFromLiteral)); | 184 DEFINE_STATIC_LOCAL(const AtomicString, network, ("network", AtomicString::C
onstructFromLiteral)); |
| 185 DEFINE_STATIC_LOCAL(const AtomicString, decode, ("decode", AtomicString::Con
structFromLiteral)); | 185 DEFINE_STATIC_LOCAL(const AtomicString, decode, ("decode", AtomicString::Con
structFromLiteral)); |
| 186 | 186 |
| 187 // 3.1 http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-sour
ce.html#dom-endofstream | 187 // 3.1 http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-sour
ce.html#dom-endofstream |
| 188 // 1. If the readyState attribute is not in the "open" state then throw an | 188 // 1. If the readyState attribute is not in the "open" state then throw an |
| 189 // InvalidStateError exception and abort these steps. | 189 // InvalidStateError exception and abort these steps. |
| 190 if (!isOpen()) { | 190 if (!isOpen()) { |
| 191 es.throwDOMException(InvalidStateError); | 191 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
| 192 return; | 192 return; |
| 193 } | 193 } |
| 194 | 194 |
| 195 MediaSourcePrivate::EndOfStreamStatus eosStatus = MediaSourcePrivate::EosNoE
rror; | 195 MediaSourcePrivate::EndOfStreamStatus eosStatus = MediaSourcePrivate::EosNoE
rror; |
| 196 | 196 |
| 197 if (error.isNull() || error.isEmpty()) { | 197 if (error.isNull() || error.isEmpty()) { |
| 198 eosStatus = MediaSourcePrivate::EosNoError; | 198 eosStatus = MediaSourcePrivate::EosNoError; |
| 199 } else if (error == network) { | 199 } else if (error == network) { |
| 200 eosStatus = MediaSourcePrivate::EosNetworkError; | 200 eosStatus = MediaSourcePrivate::EosNetworkError; |
| 201 } else if (error == decode) { | 201 } else if (error == decode) { |
| 202 eosStatus = MediaSourcePrivate::EosDecodeError; | 202 eosStatus = MediaSourcePrivate::EosDecodeError; |
| 203 } else { | 203 } else { |
| 204 es.throwDOMException(InvalidAccessError); | 204 es.throwUninformativeAndGenericDOMException(InvalidAccessError); |
| 205 return; | 205 return; |
| 206 } | 206 } |
| 207 | 207 |
| 208 // 2. Change the readyState attribute value to "ended". | 208 // 2. Change the readyState attribute value to "ended". |
| 209 setReadyState(endedKeyword()); | 209 setReadyState(endedKeyword()); |
| 210 m_private->markEndOfStream(eosStatus); | 210 m_private->markEndOfStream(eosStatus); |
| 211 } | 211 } |
| 212 | 212 |
| 213 bool MediaSourceBase::isOpen() const | 213 bool MediaSourceBase::isOpen() const |
| 214 { | 214 { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 OwnPtr<SourceBufferPrivate> sourceBufferPrivate; | 264 OwnPtr<SourceBufferPrivate> sourceBufferPrivate; |
| 265 switch (m_private->addSourceBuffer(type, codecs, &sourceBufferPrivate)) { | 265 switch (m_private->addSourceBuffer(type, codecs, &sourceBufferPrivate)) { |
| 266 case MediaSourcePrivate::Ok: { | 266 case MediaSourcePrivate::Ok: { |
| 267 return sourceBufferPrivate.release(); | 267 return sourceBufferPrivate.release(); |
| 268 } | 268 } |
| 269 case MediaSourcePrivate::NotSupported: | 269 case MediaSourcePrivate::NotSupported: |
| 270 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/m
edia-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type | 270 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/m
edia-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type |
| 271 // Step 2: If type contains a MIME type ... that is not supported with t
he types | 271 // Step 2: If type contains a MIME type ... that is not supported with t
he types |
| 272 // specified for the other SourceBuffer objects in sourceBuffers, then t
hrow | 272 // specified for the other SourceBuffer objects in sourceBuffers, then t
hrow |
| 273 // a NotSupportedError exception and abort these steps. | 273 // a NotSupportedError exception and abort these steps. |
| 274 es.throwDOMException(NotSupportedError); | 274 es.throwUninformativeAndGenericDOMException(NotSupportedError); |
| 275 return nullptr; | 275 return nullptr; |
| 276 case MediaSourcePrivate::ReachedIdLimit: | 276 case MediaSourcePrivate::ReachedIdLimit: |
| 277 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/m
edia-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type | 277 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/m
edia-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type |
| 278 // Step 3: If the user agent can't handle any more SourceBuffer objects
then throw | 278 // Step 3: If the user agent can't handle any more SourceBuffer objects
then throw |
| 279 // a QuotaExceededError exception and abort these steps. | 279 // a QuotaExceededError exception and abort these steps. |
| 280 es.throwDOMException(QuotaExceededError); | 280 es.throwUninformativeAndGenericDOMException(QuotaExceededError); |
| 281 return nullptr; | 281 return nullptr; |
| 282 } | 282 } |
| 283 | 283 |
| 284 ASSERT_NOT_REACHED(); | 284 ASSERT_NOT_REACHED(); |
| 285 return nullptr; | 285 return nullptr; |
| 286 } | 286 } |
| 287 | 287 |
| 288 void MediaSourceBase::scheduleEvent(const AtomicString& eventName) | 288 void MediaSourceBase::scheduleEvent(const AtomicString& eventName) |
| 289 { | 289 { |
| 290 ASSERT(m_asyncEventQueue); | 290 ASSERT(m_asyncEventQueue); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 309 { | 309 { |
| 310 return &m_eventTargetData; | 310 return &m_eventTargetData; |
| 311 } | 311 } |
| 312 | 312 |
| 313 URLRegistry& MediaSourceBase::registry() const | 313 URLRegistry& MediaSourceBase::registry() const |
| 314 { | 314 { |
| 315 return MediaSourceRegistry::registry(); | 315 return MediaSourceRegistry::registry(); |
| 316 } | 316 } |
| 317 | 317 |
| 318 } | 318 } |
| OLD | NEW |