| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 | 70 |
| 71 SourceBuffer* MediaSource::addSourceBuffer(const String& type, ExceptionState& e
s) | 71 SourceBuffer* MediaSource::addSourceBuffer(const String& type, ExceptionState& e
s) |
| 72 { | 72 { |
| 73 LOG(Media, "MediaSource::addSourceBuffer(%s) %p", type.ascii().data(), this)
; | 73 LOG(Media, "MediaSource::addSourceBuffer(%s) %p", type.ascii().data(), this)
; |
| 74 | 74 |
| 75 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media
-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type | 75 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media
-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type |
| 76 // 1. If type is null or an empty then throw an InvalidAccessError exception
and | 76 // 1. If type is null or an empty then throw an InvalidAccessError exception
and |
| 77 // abort these steps. | 77 // abort these steps. |
| 78 if (type.isNull() || type.isEmpty()) { | 78 if (type.isNull() || type.isEmpty()) { |
| 79 es.throwDOMException(InvalidAccessError); | 79 es.throwUninformativeAndGenericDOMException(InvalidAccessError); |
| 80 return 0; | 80 return 0; |
| 81 } | 81 } |
| 82 | 82 |
| 83 // 2. If type contains a MIME type that is not supported ..., then throw a | 83 // 2. If type contains a MIME type that is not supported ..., then throw a |
| 84 // NotSupportedError exception and abort these steps. | 84 // NotSupportedError exception and abort these steps. |
| 85 if (!isTypeSupported(type)) { | 85 if (!isTypeSupported(type)) { |
| 86 es.throwDOMException(NotSupportedError); | 86 es.throwUninformativeAndGenericDOMException(NotSupportedError); |
| 87 return 0; | 87 return 0; |
| 88 } | 88 } |
| 89 | 89 |
| 90 // 4. If the readyState attribute is not in the "open" state then throw an | 90 // 4. If the readyState attribute is not in the "open" state then throw an |
| 91 // InvalidStateError exception and abort these steps. | 91 // InvalidStateError exception and abort these steps. |
| 92 if (!isOpen()) { | 92 if (!isOpen()) { |
| 93 es.throwDOMException(InvalidStateError); | 93 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
| 94 return 0; | 94 return 0; |
| 95 } | 95 } |
| 96 | 96 |
| 97 // 5. Create a new SourceBuffer object and associated resources. | 97 // 5. Create a new SourceBuffer object and associated resources. |
| 98 ContentType contentType(type); | 98 ContentType contentType(type); |
| 99 Vector<String> codecs = contentType.codecs(); | 99 Vector<String> codecs = contentType.codecs(); |
| 100 OwnPtr<SourceBufferPrivate> sourceBufferPrivate = createSourceBufferPrivate(
contentType.type(), codecs, es); | 100 OwnPtr<SourceBufferPrivate> sourceBufferPrivate = createSourceBufferPrivate(
contentType.type(), codecs, es); |
| 101 | 101 |
| 102 if (!sourceBufferPrivate) { | 102 if (!sourceBufferPrivate) { |
| 103 ASSERT(es.code() == NotSupportedError || es.code() == QuotaExceededError
); | 103 ASSERT(es.code() == NotSupportedError || es.code() == QuotaExceededError
); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 116 | 116 |
| 117 void MediaSource::removeSourceBuffer(SourceBuffer* buffer, ExceptionState& es) | 117 void MediaSource::removeSourceBuffer(SourceBuffer* buffer, ExceptionState& es) |
| 118 { | 118 { |
| 119 LOG(Media, "MediaSource::removeSourceBuffer() %p", this); | 119 LOG(Media, "MediaSource::removeSourceBuffer() %p", this); |
| 120 RefPtr<SourceBuffer> protect(buffer); | 120 RefPtr<SourceBuffer> protect(buffer); |
| 121 | 121 |
| 122 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media
-source.html#widl-MediaSource-removeSourceBuffer-void-SourceBuffer-sourceBuffer | 122 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media
-source.html#widl-MediaSource-removeSourceBuffer-void-SourceBuffer-sourceBuffer |
| 123 // 1. If sourceBuffer is null then throw an InvalidAccessError exception and | 123 // 1. If sourceBuffer is null then throw an InvalidAccessError exception and |
| 124 // abort these steps. | 124 // abort these steps. |
| 125 if (!buffer) { | 125 if (!buffer) { |
| 126 es.throwDOMException(InvalidAccessError); | 126 es.throwUninformativeAndGenericDOMException(InvalidAccessError); |
| 127 return; | 127 return; |
| 128 } | 128 } |
| 129 | 129 |
| 130 // 2. If sourceBuffer specifies an object that is not in sourceBuffers then | 130 // 2. If sourceBuffer specifies an object that is not in sourceBuffers then |
| 131 // throw a NotFoundError exception and abort these steps. | 131 // throw a NotFoundError exception and abort these steps. |
| 132 if (!m_sourceBuffers->length() || !m_sourceBuffers->contains(buffer)) { | 132 if (!m_sourceBuffers->length() || !m_sourceBuffers->contains(buffer)) { |
| 133 es.throwDOMException(NotFoundError); | 133 es.throwUninformativeAndGenericDOMException(NotFoundError); |
| 134 return; | 134 return; |
| 135 } | 135 } |
| 136 | 136 |
| 137 // 3. If the sourceBuffer.updating attribute equals true, then run the follo
wing steps: ... | 137 // 3. If the sourceBuffer.updating attribute equals true, then run the follo
wing steps: ... |
| 138 buffer->abortIfUpdating(); | 138 buffer->abortIfUpdating(); |
| 139 | 139 |
| 140 // Steps 4-9 are related to updating audioTracks, videoTracks, and textTrack
s which aren't implmented yet. | 140 // Steps 4-9 are related to updating audioTracks, videoTracks, and textTrack
s which aren't implmented yet. |
| 141 // FIXME(91649): support track selection | 141 // FIXME(91649): support track selection |
| 142 | 142 |
| 143 // 10. If sourceBuffer is in activeSourceBuffers, then remove sourceBuffer f
rom activeSourceBuffers ... | 143 // 10. If sourceBuffer is in activeSourceBuffers, then remove sourceBuffer f
rom activeSourceBuffers ... |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // 6. Return true. | 207 // 6. Return true. |
| 208 return MIMETypeRegistry::isSupportedMediaSourceMIMEType(contentType.type(),
codecs); | 208 return MIMETypeRegistry::isSupportedMediaSourceMIMEType(contentType.type(),
codecs); |
| 209 } | 209 } |
| 210 | 210 |
| 211 const AtomicString& MediaSource::interfaceName() const | 211 const AtomicString& MediaSource::interfaceName() const |
| 212 { | 212 { |
| 213 return eventNames().interfaceForMediaSource; | 213 return eventNames().interfaceForMediaSource; |
| 214 } | 214 } |
| 215 | 215 |
| 216 } // namespace WebCore | 216 } // namespace WebCore |
| OLD | NEW |