| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 ScriptWrappable::init(this); | 82 ScriptWrappable::init(this); |
| 83 } | 83 } |
| 84 | 84 |
| 85 SourceBuffer::~SourceBuffer() | 85 SourceBuffer::~SourceBuffer() |
| 86 { | 86 { |
| 87 ASSERT(isRemoved()); | 87 ASSERT(isRemoved()); |
| 88 ASSERT(!m_loader); | 88 ASSERT(!m_loader); |
| 89 ASSERT(!m_stream); | 89 ASSERT(!m_stream); |
| 90 } | 90 } |
| 91 | 91 |
| 92 PassRefPtr<TimeRanges> SourceBuffer::buffered(ExceptionState& es) const | 92 PassRefPtr<TimeRanges> SourceBuffer::buffered(ExceptionState& exceptionState) co
nst |
| 93 { | 93 { |
| 94 // Section 3.1 buffered attribute steps. | 94 // Section 3.1 buffered attribute steps. |
| 95 // 1. If this object has been removed from the sourceBuffers attribute of th
e parent media source then throw an | 95 // 1. If this object has been removed from the sourceBuffers attribute of th
e parent media source then throw an |
| 96 // InvalidStateError exception and abort these steps. | 96 // InvalidStateError exception and abort these steps. |
| 97 if (isRemoved()) { | 97 if (isRemoved()) { |
| 98 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 98 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 99 return 0; | 99 return 0; |
| 100 } | 100 } |
| 101 | 101 |
| 102 // 2. Return a new static normalized TimeRanges object for the media segment
s buffered. | 102 // 2. Return a new static normalized TimeRanges object for the media segment
s buffered. |
| 103 return TimeRanges::create(m_webSourceBuffer->buffered()); | 103 return TimeRanges::create(m_webSourceBuffer->buffered()); |
| 104 } | 104 } |
| 105 | 105 |
| 106 double SourceBuffer::timestampOffset() const | 106 double SourceBuffer::timestampOffset() const |
| 107 { | 107 { |
| 108 return m_timestampOffset; | 108 return m_timestampOffset; |
| 109 } | 109 } |
| 110 | 110 |
| 111 void SourceBuffer::setTimestampOffset(double offset, ExceptionState& es) | 111 void SourceBuffer::setTimestampOffset(double offset, ExceptionState& exceptionSt
ate) |
| 112 { | 112 { |
| 113 // Section 3.1 timestampOffset attribute setter steps. | 113 // Section 3.1 timestampOffset attribute setter steps. |
| 114 // 1. Let new timestamp offset equal the new value being assigned to this at
tribute. | 114 // 1. Let new timestamp offset equal the new value being assigned to this at
tribute. |
| 115 // 2. If this object has been removed from the sourceBuffers attribute of th
e parent media source, then throw an | 115 // 2. If this object has been removed from the sourceBuffers attribute of th
e parent media source, then throw an |
| 116 // InvalidStateError exception and abort these steps. | 116 // InvalidStateError exception and abort these steps. |
| 117 // 3. If the updating attribute equals true, then throw an InvalidStateError
exception and abort these steps. | 117 // 3. If the updating attribute equals true, then throw an InvalidStateError
exception and abort these steps. |
| 118 if (isRemoved() || m_updating) { | 118 if (isRemoved() || m_updating) { |
| 119 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 119 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 120 return; | 120 return; |
| 121 } | 121 } |
| 122 | 122 |
| 123 // 4. If the readyState attribute of the parent media source is in the "ende
d" state then run the following steps: | 123 // 4. If the readyState attribute of the parent media source is in the "ende
d" state then run the following steps: |
| 124 // 4.1 Set the readyState attribute of the parent media source to "open" | 124 // 4.1 Set the readyState attribute of the parent media source to "open" |
| 125 // 4.2 Queue a task to fire a simple event named sourceopen at the parent me
dia source. | 125 // 4.2 Queue a task to fire a simple event named sourceopen at the parent me
dia source. |
| 126 m_source->openIfInEndedState(); | 126 m_source->openIfInEndedState(); |
| 127 | 127 |
| 128 // 5. If this object is waiting for the end of a media segment to be appende
d, then throw an InvalidStateError | 128 // 5. If this object is waiting for the end of a media segment to be appende
d, then throw an InvalidStateError |
| 129 // and abort these steps. | 129 // and abort these steps. |
| 130 // | 130 // |
| 131 // FIXME: Add step 6 text when mode attribute is implemented. | 131 // FIXME: Add step 6 text when mode attribute is implemented. |
| 132 if (!m_webSourceBuffer->setTimestampOffset(offset)) { | 132 if (!m_webSourceBuffer->setTimestampOffset(offset)) { |
| 133 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 133 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 134 return; | 134 return; |
| 135 } | 135 } |
| 136 | 136 |
| 137 // 7. Update the attribute to new timestamp offset. | 137 // 7. Update the attribute to new timestamp offset. |
| 138 m_timestampOffset = offset; | 138 m_timestampOffset = offset; |
| 139 } | 139 } |
| 140 | 140 |
| 141 double SourceBuffer::appendWindowStart() const | 141 double SourceBuffer::appendWindowStart() const |
| 142 { | 142 { |
| 143 return m_appendWindowStart; | 143 return m_appendWindowStart; |
| 144 } | 144 } |
| 145 | 145 |
| 146 void SourceBuffer::setAppendWindowStart(double start, ExceptionState& es) | 146 void SourceBuffer::setAppendWindowStart(double start, ExceptionState& exceptionS
tate) |
| 147 { | 147 { |
| 148 // Enforce throwing an exception on restricted double values. | 148 // Enforce throwing an exception on restricted double values. |
| 149 if (std::isnan(start) | 149 if (std::isnan(start) |
| 150 || start == std::numeric_limits<double>::infinity() | 150 || start == std::numeric_limits<double>::infinity() |
| 151 || start == -std::numeric_limits<double>::infinity()) { | 151 || start == -std::numeric_limits<double>::infinity()) { |
| 152 es.throwUninformativeAndGenericDOMException(TypeMismatchError); | 152 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); |
| 153 return; | 153 return; |
| 154 } | 154 } |
| 155 | 155 |
| 156 // Section 3.1 appendWindowStart attribute setter steps. | 156 // Section 3.1 appendWindowStart attribute setter steps. |
| 157 // 1. If this object has been removed from the sourceBuffers attribute of th
e parent media source then throw an | 157 // 1. If this object has been removed from the sourceBuffers attribute of th
e parent media source then throw an |
| 158 // InvalidStateError exception and abort these steps. | 158 // InvalidStateError exception and abort these steps. |
| 159 // 2. If the updating attribute equals true, then throw an InvalidStateError
exception and abort these steps. | 159 // 2. If the updating attribute equals true, then throw an InvalidStateError
exception and abort these steps. |
| 160 if (isRemoved() || m_updating) { | 160 if (isRemoved() || m_updating) { |
| 161 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 161 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 162 return; | 162 return; |
| 163 } | 163 } |
| 164 | 164 |
| 165 // 3. If the new value is less than 0 or greater than or equal to appendWind
owEnd then throw an InvalidAccessError | 165 // 3. If the new value is less than 0 or greater than or equal to appendWind
owEnd then throw an InvalidAccessError |
| 166 // exception and abort these steps. | 166 // exception and abort these steps. |
| 167 if (start < 0 || start >= m_appendWindowEnd) { | 167 if (start < 0 || start >= m_appendWindowEnd) { |
| 168 es.throwUninformativeAndGenericDOMException(InvalidAccessError); | 168 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr
or); |
| 169 return; | 169 return; |
| 170 } | 170 } |
| 171 | 171 |
| 172 m_webSourceBuffer->setAppendWindowStart(start); | 172 m_webSourceBuffer->setAppendWindowStart(start); |
| 173 | 173 |
| 174 // 4. Update the attribute to the new value. | 174 // 4. Update the attribute to the new value. |
| 175 m_appendWindowStart = start; | 175 m_appendWindowStart = start; |
| 176 } | 176 } |
| 177 | 177 |
| 178 double SourceBuffer::appendWindowEnd() const | 178 double SourceBuffer::appendWindowEnd() const |
| 179 { | 179 { |
| 180 return m_appendWindowEnd; | 180 return m_appendWindowEnd; |
| 181 } | 181 } |
| 182 | 182 |
| 183 void SourceBuffer::setAppendWindowEnd(double end, ExceptionState& es) | 183 void SourceBuffer::setAppendWindowEnd(double end, ExceptionState& exceptionState
) |
| 184 { | 184 { |
| 185 // Section 3.1 appendWindowEnd attribute setter steps. | 185 // Section 3.1 appendWindowEnd attribute setter steps. |
| 186 // 1. If this object has been removed from the sourceBuffers attribute of th
e parent media source then throw an | 186 // 1. If this object has been removed from the sourceBuffers attribute of th
e parent media source then throw an |
| 187 // InvalidStateError exception and abort these steps. | 187 // InvalidStateError exception and abort these steps. |
| 188 // 2. If the updating attribute equals true, then throw an InvalidStateError
exception and abort these steps. | 188 // 2. If the updating attribute equals true, then throw an InvalidStateError
exception and abort these steps. |
| 189 if (isRemoved() || m_updating) { | 189 if (isRemoved() || m_updating) { |
| 190 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 190 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 191 return; | 191 return; |
| 192 } | 192 } |
| 193 | 193 |
| 194 // 3. If the new value equals NaN, then throw an InvalidAccessError and abor
t these steps. | 194 // 3. If the new value equals NaN, then throw an InvalidAccessError and abor
t these steps. |
| 195 // 4. If the new value is less than or equal to appendWindowStart then throw
an InvalidAccessError | 195 // 4. If the new value is less than or equal to appendWindowStart then throw
an InvalidAccessError |
| 196 // exception and abort these steps. | 196 // exception and abort these steps. |
| 197 if (std::isnan(end) || end <= m_appendWindowStart) { | 197 if (std::isnan(end) || end <= m_appendWindowStart) { |
| 198 es.throwUninformativeAndGenericDOMException(InvalidAccessError); | 198 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr
or); |
| 199 return; | 199 return; |
| 200 } | 200 } |
| 201 | 201 |
| 202 m_webSourceBuffer->setAppendWindowEnd(end); | 202 m_webSourceBuffer->setAppendWindowEnd(end); |
| 203 | 203 |
| 204 // 5. Update the attribute to the new value. | 204 // 5. Update the attribute to the new value. |
| 205 m_appendWindowEnd = end; | 205 m_appendWindowEnd = end; |
| 206 } | 206 } |
| 207 | 207 |
| 208 void SourceBuffer::appendBuffer(PassRefPtr<ArrayBuffer> data, ExceptionState& es
) | 208 void SourceBuffer::appendBuffer(PassRefPtr<ArrayBuffer> data, ExceptionState& ex
ceptionState) |
| 209 { | 209 { |
| 210 // Section 3.2 appendBuffer() | 210 // Section 3.2 appendBuffer() |
| 211 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data | 211 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data |
| 212 // 1. If data is null then throw an InvalidAccessError exception and abort t
hese steps. | 212 // 1. If data is null then throw an InvalidAccessError exception and abort t
hese steps. |
| 213 if (!data) { | 213 if (!data) { |
| 214 es.throwUninformativeAndGenericDOMException(InvalidAccessError); | 214 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr
or); |
| 215 return; | 215 return; |
| 216 } | 216 } |
| 217 | 217 |
| 218 appendBufferInternal(static_cast<const unsigned char*>(data->data()), data->
byteLength(), es); | 218 appendBufferInternal(static_cast<const unsigned char*>(data->data()), data->
byteLength(), exceptionState); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void SourceBuffer::appendBuffer(PassRefPtr<ArrayBufferView> data, ExceptionState
& es) | 221 void SourceBuffer::appendBuffer(PassRefPtr<ArrayBufferView> data, ExceptionState
& exceptionState) |
| 222 { | 222 { |
| 223 // Section 3.2 appendBuffer() | 223 // Section 3.2 appendBuffer() |
| 224 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data | 224 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data |
| 225 // 1. If data is null then throw an InvalidAccessError exception and abort t
hese steps. | 225 // 1. If data is null then throw an InvalidAccessError exception and abort t
hese steps. |
| 226 if (!data) { | 226 if (!data) { |
| 227 es.throwUninformativeAndGenericDOMException(InvalidAccessError); | 227 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr
or); |
| 228 return; | 228 return; |
| 229 } | 229 } |
| 230 | 230 |
| 231 appendBufferInternal(static_cast<const unsigned char*>(data->baseAddress()),
data->byteLength(), es); | 231 appendBufferInternal(static_cast<const unsigned char*>(data->baseAddress()),
data->byteLength(), exceptionState); |
| 232 } | 232 } |
| 233 | 233 |
| 234 void SourceBuffer::appendStream(PassRefPtr<Stream> stream, ExceptionState& es) | 234 void SourceBuffer::appendStream(PassRefPtr<Stream> stream, ExceptionState& excep
tionState) |
| 235 { | 235 { |
| 236 m_streamMaxSizeValid = false; | 236 m_streamMaxSizeValid = false; |
| 237 appendStreamInternal(stream, es); | 237 appendStreamInternal(stream, exceptionState); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void SourceBuffer::appendStream(PassRefPtr<Stream> stream, unsigned long long ma
xSize, ExceptionState& es) | 240 void SourceBuffer::appendStream(PassRefPtr<Stream> stream, unsigned long long ma
xSize, ExceptionState& exceptionState) |
| 241 { | 241 { |
| 242 m_streamMaxSizeValid = maxSize > 0; | 242 m_streamMaxSizeValid = maxSize > 0; |
| 243 if (m_streamMaxSizeValid) | 243 if (m_streamMaxSizeValid) |
| 244 m_streamMaxSize = maxSize; | 244 m_streamMaxSize = maxSize; |
| 245 appendStreamInternal(stream, es); | 245 appendStreamInternal(stream, exceptionState); |
| 246 } | 246 } |
| 247 | 247 |
| 248 void SourceBuffer::abort(ExceptionState& es) | 248 void SourceBuffer::abort(ExceptionState& exceptionState) |
| 249 { | 249 { |
| 250 // Section 3.2 abort() method steps. | 250 // Section 3.2 abort() method steps. |
| 251 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#widl-SourceBuffer-abort-void | 251 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#widl-SourceBuffer-abort-void |
| 252 // 1. If this object has been removed from the sourceBuffers attribute of th
e parent media source | 252 // 1. If this object has been removed from the sourceBuffers attribute of th
e parent media source |
| 253 // then throw an InvalidStateError exception and abort these steps. | 253 // then throw an InvalidStateError exception and abort these steps. |
| 254 // 2. If the readyState attribute of the parent media source is not in the "
open" state | 254 // 2. If the readyState attribute of the parent media source is not in the "
open" state |
| 255 // then throw an InvalidStateError exception and abort these steps. | 255 // then throw an InvalidStateError exception and abort these steps. |
| 256 if (isRemoved() || !m_source->isOpen()) { | 256 if (isRemoved() || !m_source->isOpen()) { |
| 257 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 257 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 258 return; | 258 return; |
| 259 } | 259 } |
| 260 | 260 |
| 261 // 3. If the sourceBuffer.updating attribute equals true, then run the follo
wing steps: ... | 261 // 3. If the sourceBuffer.updating attribute equals true, then run the follo
wing steps: ... |
| 262 abortIfUpdating(); | 262 abortIfUpdating(); |
| 263 | 263 |
| 264 // 4. Run the reset parser state algorithm. | 264 // 4. Run the reset parser state algorithm. |
| 265 m_webSourceBuffer->abort(); | 265 m_webSourceBuffer->abort(); |
| 266 | 266 |
| 267 // 5. Set appendWindowStart to 0. | 267 // 5. Set appendWindowStart to 0. |
| 268 setAppendWindowStart(0, es); | 268 setAppendWindowStart(0, exceptionState); |
| 269 | 269 |
| 270 // 6. Set appendWindowEnd to positive Infinity. | 270 // 6. Set appendWindowEnd to positive Infinity. |
| 271 setAppendWindowEnd(std::numeric_limits<double>::infinity(), es); | 271 setAppendWindowEnd(std::numeric_limits<double>::infinity(), exceptionState); |
| 272 } | 272 } |
| 273 | 273 |
| 274 void SourceBuffer::remove(double start, double end, ExceptionState& es) | 274 void SourceBuffer::remove(double start, double end, ExceptionState& exceptionSta
te) |
| 275 { | 275 { |
| 276 // Section 3.2 remove() method steps. | 276 // Section 3.2 remove() method steps. |
| 277 // 1. If start is negative or greater than duration, then throw an InvalidAc
cessError exception and abort these steps. | 277 // 1. If start is negative or greater than duration, then throw an InvalidAc
cessError exception and abort these steps. |
| 278 // 2. If end is less than or equal to start, then throw an InvalidAccessErro
r exception and abort these steps. | 278 // 2. If end is less than or equal to start, then throw an InvalidAccessErro
r exception and abort these steps. |
| 279 if (start < 0 || (m_source && (std::isnan(m_source->duration()) || start > m
_source->duration())) || end <= start) { | 279 if (start < 0 || (m_source && (std::isnan(m_source->duration()) || start > m
_source->duration())) || end <= start) { |
| 280 es.throwUninformativeAndGenericDOMException(InvalidAccessError); | 280 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr
or); |
| 281 return; | 281 return; |
| 282 } | 282 } |
| 283 | 283 |
| 284 // 3. If this object has been removed from the sourceBuffers attribute of th
e parent media source then throw an | 284 // 3. If this object has been removed from the sourceBuffers attribute of th
e parent media source then throw an |
| 285 // InvalidStateError exception and abort these steps. | 285 // InvalidStateError exception and abort these steps. |
| 286 // 4. If the updating attribute equals true, then throw an InvalidStateError
exception and abort these steps. | 286 // 4. If the updating attribute equals true, then throw an InvalidStateError
exception and abort these steps. |
| 287 if (isRemoved() || m_updating) { | 287 if (isRemoved() || m_updating) { |
| 288 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 288 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 289 return; | 289 return; |
| 290 } | 290 } |
| 291 | 291 |
| 292 TRACE_EVENT_ASYNC_BEGIN0("media", "SourceBuffer::remove", this); | 292 TRACE_EVENT_ASYNC_BEGIN0("media", "SourceBuffer::remove", this); |
| 293 | 293 |
| 294 // 5. If the readyState attribute of the parent media source is in the "ende
d" state then run the following steps: | 294 // 5. If the readyState attribute of the parent media source is in the "ende
d" state then run the following steps: |
| 295 // 5.1. Set the readyState attribute of the parent media source to "open" | 295 // 5.1. Set the readyState attribute of the parent media source to "open" |
| 296 // 5.2. Queue a task to fire a simple event named sourceopen at the parent m
edia source . | 296 // 5.2. Queue a task to fire a simple event named sourceopen at the parent m
edia source . |
| 297 m_source->openIfInEndedState(); | 297 m_source->openIfInEndedState(); |
| 298 | 298 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 void SourceBuffer::scheduleEvent(const AtomicString& eventName) | 407 void SourceBuffer::scheduleEvent(const AtomicString& eventName) |
| 408 { | 408 { |
| 409 ASSERT(m_asyncEventQueue); | 409 ASSERT(m_asyncEventQueue); |
| 410 | 410 |
| 411 RefPtr<Event> event = Event::create(eventName); | 411 RefPtr<Event> event = Event::create(eventName); |
| 412 event->setTarget(this); | 412 event->setTarget(this); |
| 413 | 413 |
| 414 m_asyncEventQueue->enqueueEvent(event.release()); | 414 m_asyncEventQueue->enqueueEvent(event.release()); |
| 415 } | 415 } |
| 416 | 416 |
| 417 void SourceBuffer::appendBufferInternal(const unsigned char* data, unsigned size
, ExceptionState& es) | 417 void SourceBuffer::appendBufferInternal(const unsigned char* data, unsigned size
, ExceptionState& exceptionState) |
| 418 { | 418 { |
| 419 // Section 3.2 appendBuffer() | 419 // Section 3.2 appendBuffer() |
| 420 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data | 420 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data |
| 421 | 421 |
| 422 // Step 1 is enforced by the caller. | 422 // Step 1 is enforced by the caller. |
| 423 // 2. If this object has been removed from the sourceBuffers attribute of th
e parent media source then throw an InvalidStateError exception and abort these
steps. | 423 // 2. If this object has been removed from the sourceBuffers attribute of th
e parent media source then throw an InvalidStateError exception and abort these
steps. |
| 424 // 3. If the updating attribute equals true, then throw an InvalidStateError
exception and abort these steps. | 424 // 3. If the updating attribute equals true, then throw an InvalidStateError
exception and abort these steps. |
| 425 if (isRemoved() || m_updating) { | 425 if (isRemoved() || m_updating) { |
| 426 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 426 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 427 return; | 427 return; |
| 428 } | 428 } |
| 429 | 429 |
| 430 TRACE_EVENT_ASYNC_BEGIN0("media", "SourceBuffer::appendBuffer", this); | 430 TRACE_EVENT_ASYNC_BEGIN0("media", "SourceBuffer::appendBuffer", this); |
| 431 | 431 |
| 432 // 4. If the readyState attribute of the parent media source is in the "ende
d" state then run the following steps: ... | 432 // 4. If the readyState attribute of the parent media source is in the "ende
d" state then run the following steps: ... |
| 433 m_source->openIfInEndedState(); | 433 m_source->openIfInEndedState(); |
| 434 | 434 |
| 435 // Steps 5-6 | 435 // Steps 5-6 |
| 436 | 436 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 m_pendingRemoveStart = -1; | 498 m_pendingRemoveStart = -1; |
| 499 m_pendingRemoveEnd = -1; | 499 m_pendingRemoveEnd = -1; |
| 500 | 500 |
| 501 // 11. Queue a task to fire a simple event named update at this SourceBuffer
object. | 501 // 11. Queue a task to fire a simple event named update at this SourceBuffer
object. |
| 502 scheduleEvent(EventTypeNames::update); | 502 scheduleEvent(EventTypeNames::update); |
| 503 | 503 |
| 504 // 12. Queue a task to fire a simple event named updateend at this SourceBuf
fer object. | 504 // 12. Queue a task to fire a simple event named updateend at this SourceBuf
fer object. |
| 505 scheduleEvent(EventTypeNames::updateend); | 505 scheduleEvent(EventTypeNames::updateend); |
| 506 } | 506 } |
| 507 | 507 |
| 508 void SourceBuffer::appendStreamInternal(PassRefPtr<Stream> stream, ExceptionStat
e& es) | 508 void SourceBuffer::appendStreamInternal(PassRefPtr<Stream> stream, ExceptionStat
e& exceptionState) |
| 509 { | 509 { |
| 510 // Section 3.2 appendStream() | 510 // Section 3.2 appendStream() |
| 511 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-ma
xSize | 511 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-ma
xSize |
| 512 // 1. If stream is null then throw an InvalidAccessError exception and abort
these steps. | 512 // 1. If stream is null then throw an InvalidAccessError exception and abort
these steps. |
| 513 if (!stream || stream->isNeutered()) { | 513 if (!stream || stream->isNeutered()) { |
| 514 es.throwUninformativeAndGenericDOMException(InvalidAccessError); | 514 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr
or); |
| 515 return; | 515 return; |
| 516 } | 516 } |
| 517 | 517 |
| 518 // 2. Run the prepare append algorithm. | 518 // 2. Run the prepare append algorithm. |
| 519 // Section 3.5.4 Prepare Append Algorithm. | 519 // Section 3.5.4 Prepare Append Algorithm. |
| 520 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-so
urce.html#sourcebuffer-prepare-append | 520 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-so
urce.html#sourcebuffer-prepare-append |
| 521 // 1. If this object has been removed from the sourceBuffers attribute of t
he parent media source then throw an InvalidStateError exception and abort these
steps. | 521 // 1. If this object has been removed from the sourceBuffers attribute of t
he parent media source then throw an InvalidStateError exception and abort these
steps. |
| 522 // 2. If the updating attribute equals true, then throw an InvalidStateErro
r exception and abort these steps. | 522 // 2. If the updating attribute equals true, then throw an InvalidStateErro
r exception and abort these steps. |
| 523 if (isRemoved() || m_updating) { | 523 if (isRemoved() || m_updating) { |
| 524 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 524 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 525 return; | 525 return; |
| 526 } | 526 } |
| 527 | 527 |
| 528 TRACE_EVENT_ASYNC_BEGIN0("media", "SourceBuffer::appendStream", this); | 528 TRACE_EVENT_ASYNC_BEGIN0("media", "SourceBuffer::appendStream", this); |
| 529 | 529 |
| 530 // 3. If the readyState attribute of the parent media source is in the "end
ed" state then run the following steps: ... | 530 // 3. If the readyState attribute of the parent media source is in the "end
ed" state then run the following steps: ... |
| 531 m_source->openIfInEndedState(); | 531 m_source->openIfInEndedState(); |
| 532 | 532 |
| 533 // Steps 4-5 of the prepare append algorithm are handled by m_webSourceBuffe
r. | 533 // Steps 4-5 of the prepare append algorithm are handled by m_webSourceBuffe
r. |
| 534 | 534 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 appendStreamDone(true); | 633 appendStreamDone(true); |
| 634 } | 634 } |
| 635 | 635 |
| 636 void SourceBuffer::didFail(FileError::ErrorCode errorCode) | 636 void SourceBuffer::didFail(FileError::ErrorCode errorCode) |
| 637 { | 637 { |
| 638 LOG(Media, "SourceBuffer::didFail(%d) %p", errorCode, this); | 638 LOG(Media, "SourceBuffer::didFail(%d) %p", errorCode, this); |
| 639 appendStreamDone(false); | 639 appendStreamDone(false); |
| 640 } | 640 } |
| 641 | 641 |
| 642 } // namespace WebCore | 642 } // namespace WebCore |
| OLD | NEW |