| 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 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "modules/mediasource/SourceBuffer.h" | 32 #include "modules/mediasource/SourceBuffer.h" |
| 33 | 33 |
| 34 #include "bindings/core/v8/ExceptionMessages.h" | 34 #include "bindings/core/v8/ExceptionMessages.h" |
| 35 #include "bindings/core/v8/ExceptionState.h" | 35 #include "bindings/core/v8/ExceptionState.h" |
| 36 #include "core/dom/DOMArrayBuffer.h" |
| 37 #include "core/dom/DOMArrayBufferView.h" |
| 36 #include "core/dom/ExceptionCode.h" | 38 #include "core/dom/ExceptionCode.h" |
| 37 #include "core/dom/ExecutionContext.h" | 39 #include "core/dom/ExecutionContext.h" |
| 38 #include "core/events/Event.h" | 40 #include "core/events/Event.h" |
| 39 #include "core/events/GenericEventQueue.h" | 41 #include "core/events/GenericEventQueue.h" |
| 40 #include "core/fileapi/FileReaderLoader.h" | 42 #include "core/fileapi/FileReaderLoader.h" |
| 41 #include "core/html/TimeRanges.h" | 43 #include "core/html/TimeRanges.h" |
| 42 #include "core/streams/Stream.h" | 44 #include "core/streams/Stream.h" |
| 43 #include "modules/mediasource/MediaSource.h" | 45 #include "modules/mediasource/MediaSource.h" |
| 44 #include "platform/Logging.h" | 46 #include "platform/Logging.h" |
| 45 #include "platform/TraceEvent.h" | 47 #include "platform/TraceEvent.h" |
| 46 #include "public/platform/WebSourceBuffer.h" | 48 #include "public/platform/WebSourceBuffer.h" |
| 47 #include "wtf/ArrayBuffer.h" | |
| 48 #include "wtf/ArrayBufferView.h" | |
| 49 #include "wtf/MathExtras.h" | 49 #include "wtf/MathExtras.h" |
| 50 | 50 |
| 51 #include <limits> | 51 #include <limits> |
| 52 | 52 |
| 53 using blink::WebSourceBuffer; | 53 using blink::WebSourceBuffer; |
| 54 | 54 |
| 55 namespace blink { | 55 namespace blink { |
| 56 | 56 |
| 57 namespace { | 57 namespace { |
| 58 | 58 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
indexExceedsMinimumBound("value", end, m_appendWindowStart)); | 258 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
indexExceedsMinimumBound("value", end, m_appendWindowStart)); |
| 259 return; | 259 return; |
| 260 } | 260 } |
| 261 | 261 |
| 262 m_webSourceBuffer->setAppendWindowEnd(end); | 262 m_webSourceBuffer->setAppendWindowEnd(end); |
| 263 | 263 |
| 264 // 5. Update the attribute to the new value. | 264 // 5. Update the attribute to the new value. |
| 265 m_appendWindowEnd = end; | 265 m_appendWindowEnd = end; |
| 266 } | 266 } |
| 267 | 267 |
| 268 void SourceBuffer::appendBuffer(PassRefPtr<ArrayBuffer> data, ExceptionState& ex
ceptionState) | 268 void SourceBuffer::appendBuffer(PassRefPtr<DOMArrayBuffer> data, ExceptionState&
exceptionState) |
| 269 { | 269 { |
| 270 // Section 3.2 appendBuffer() | 270 // Section 3.2 appendBuffer() |
| 271 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data | 271 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data |
| 272 appendBufferInternal(static_cast<const unsigned char*>(data->data()), data->
byteLength(), exceptionState); | 272 appendBufferInternal(static_cast<const unsigned char*>(data->data()), data->
byteLength(), exceptionState); |
| 273 } | 273 } |
| 274 | 274 |
| 275 void SourceBuffer::appendBuffer(PassRefPtr<ArrayBufferView> data, ExceptionState
& exceptionState) | 275 void SourceBuffer::appendBuffer(PassRefPtr<DOMArrayBufferView> data, ExceptionSt
ate& exceptionState) |
| 276 { | 276 { |
| 277 // Section 3.2 appendBuffer() | 277 // Section 3.2 appendBuffer() |
| 278 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data | 278 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data |
| 279 appendBufferInternal(static_cast<const unsigned char*>(data->baseAddress()),
data->byteLength(), exceptionState); | 279 appendBufferInternal(static_cast<const unsigned char*>(data->baseAddress()),
data->byteLength(), exceptionState); |
| 280 } | 280 } |
| 281 | 281 |
| 282 void SourceBuffer::appendStream(PassRefPtrWillBeRawPtr<Stream> stream, Exception
State& exceptionState) | 282 void SourceBuffer::appendStream(PassRefPtrWillBeRawPtr<Stream> stream, Exception
State& exceptionState) |
| 283 { | 283 { |
| 284 m_streamMaxSizeValid = false; | 284 m_streamMaxSizeValid = false; |
| 285 appendStreamInternal(stream, exceptionState); | 285 appendStreamInternal(stream, exceptionState); |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 } | 743 } |
| 744 | 744 |
| 745 void SourceBuffer::trace(Visitor* visitor) | 745 void SourceBuffer::trace(Visitor* visitor) |
| 746 { | 746 { |
| 747 visitor->trace(m_source); | 747 visitor->trace(m_source); |
| 748 visitor->trace(m_stream); | 748 visitor->trace(m_stream); |
| 749 EventTargetWithInlineData::trace(visitor); | 749 EventTargetWithInlineData::trace(visitor); |
| 750 } | 750 } |
| 751 | 751 |
| 752 } // namespace blink | 752 } // namespace blink |
| OLD | NEW |