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 24 matching lines...) Expand all Loading... |
35 #include "core/dom/ExceptionCode.h" | 35 #include "core/dom/ExceptionCode.h" |
36 #include "core/dom/ExecutionContext.h" | 36 #include "core/dom/ExecutionContext.h" |
37 #include "core/events/Event.h" | 37 #include "core/events/Event.h" |
38 #include "core/events/GenericEventQueue.h" | 38 #include "core/events/GenericEventQueue.h" |
39 #include "core/fileapi/FileReaderLoader.h" | 39 #include "core/fileapi/FileReaderLoader.h" |
40 #include "core/fileapi/Stream.h" | 40 #include "core/fileapi/Stream.h" |
41 #include "core/html/TimeRanges.h" | 41 #include "core/html/TimeRanges.h" |
42 #include "modules/mediasource/MediaSource.h" | 42 #include "modules/mediasource/MediaSource.h" |
43 #include "platform/Logging.h" | 43 #include "platform/Logging.h" |
44 #include "platform/TraceEvent.h" | 44 #include "platform/TraceEvent.h" |
| 45 #include "public/platform/WebSourceBuffer.h" |
45 #include "wtf/ArrayBuffer.h" | 46 #include "wtf/ArrayBuffer.h" |
46 #include "wtf/ArrayBufferView.h" | 47 #include "wtf/ArrayBufferView.h" |
47 #include "wtf/MathExtras.h" | 48 #include "wtf/MathExtras.h" |
48 | 49 |
49 #include <limits> | 50 #include <limits> |
50 | 51 |
| 52 using blink::WebSourceBuffer; |
| 53 |
51 namespace WebCore { | 54 namespace WebCore { |
52 | 55 |
53 PassRefPtr<SourceBuffer> SourceBuffer::create(PassOwnPtr<SourceBufferPrivate> so
urceBufferPrivate, MediaSource* source, GenericEventQueue* asyncEventQueue) | 56 PassRefPtr<SourceBuffer> SourceBuffer::create(PassOwnPtr<WebSourceBuffer> webSou
rceBuffer, MediaSource* source, GenericEventQueue* asyncEventQueue) |
54 { | 57 { |
55 RefPtr<SourceBuffer> sourceBuffer(adoptRef(new SourceBuffer(sourceBufferPriv
ate, source, asyncEventQueue))); | 58 RefPtr<SourceBuffer> sourceBuffer(adoptRef(new SourceBuffer(webSourceBuffer,
source, asyncEventQueue))); |
56 sourceBuffer->suspendIfNeeded(); | 59 sourceBuffer->suspendIfNeeded(); |
57 return sourceBuffer.release(); | 60 return sourceBuffer.release(); |
58 } | 61 } |
59 | 62 |
60 SourceBuffer::SourceBuffer(PassOwnPtr<SourceBufferPrivate> sourceBufferPrivate,
MediaSource* source, GenericEventQueue* asyncEventQueue) | 63 SourceBuffer::SourceBuffer(PassOwnPtr<WebSourceBuffer> webSourceBuffer, MediaSou
rce* source, GenericEventQueue* asyncEventQueue) |
61 : ActiveDOMObject(source->executionContext()) | 64 : ActiveDOMObject(source->executionContext()) |
62 , m_private(sourceBufferPrivate) | 65 , m_webSourceBuffer(webSourceBuffer) |
63 , m_source(source) | 66 , m_source(source) |
64 , m_asyncEventQueue(asyncEventQueue) | 67 , m_asyncEventQueue(asyncEventQueue) |
65 , m_updating(false) | 68 , m_updating(false) |
66 , m_timestampOffset(0) | 69 , m_timestampOffset(0) |
67 , m_appendWindowStart(0) | 70 , m_appendWindowStart(0) |
68 , m_appendWindowEnd(std::numeric_limits<double>::infinity()) | 71 , m_appendWindowEnd(std::numeric_limits<double>::infinity()) |
69 , m_appendBufferAsyncPartRunner(this, &SourceBuffer::appendBufferAsyncPart) | 72 , m_appendBufferAsyncPartRunner(this, &SourceBuffer::appendBufferAsyncPart) |
70 , m_pendingRemoveStart(-1) | 73 , m_pendingRemoveStart(-1) |
71 , m_pendingRemoveEnd(-1) | 74 , m_pendingRemoveEnd(-1) |
72 , m_removeAsyncPartRunner(this, &SourceBuffer::removeAsyncPart) | 75 , m_removeAsyncPartRunner(this, &SourceBuffer::removeAsyncPart) |
73 , m_streamMaxSizeValid(false) | 76 , m_streamMaxSizeValid(false) |
74 , m_streamMaxSize(0) | 77 , m_streamMaxSize(0) |
75 , m_appendStreamAsyncPartRunner(this, &SourceBuffer::appendStreamAsyncPart) | 78 , m_appendStreamAsyncPartRunner(this, &SourceBuffer::appendStreamAsyncPart) |
76 { | 79 { |
77 ASSERT(m_private); | 80 ASSERT(m_webSourceBuffer); |
78 ASSERT(m_source); | 81 ASSERT(m_source); |
79 ScriptWrappable::init(this); | 82 ScriptWrappable::init(this); |
80 } | 83 } |
81 | 84 |
82 SourceBuffer::~SourceBuffer() | 85 SourceBuffer::~SourceBuffer() |
83 { | 86 { |
84 ASSERT(isRemoved()); | 87 ASSERT(isRemoved()); |
85 ASSERT(!m_loader); | 88 ASSERT(!m_loader); |
86 ASSERT(!m_stream); | 89 ASSERT(!m_stream); |
87 } | 90 } |
88 | 91 |
89 PassRefPtr<TimeRanges> SourceBuffer::buffered(ExceptionState& es) const | 92 PassRefPtr<TimeRanges> SourceBuffer::buffered(ExceptionState& es) const |
90 { | 93 { |
91 // Section 3.1 buffered attribute steps. | 94 // Section 3.1 buffered attribute steps. |
92 // 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 |
93 // InvalidStateError exception and abort these steps. | 96 // InvalidStateError exception and abort these steps. |
94 if (isRemoved()) { | 97 if (isRemoved()) { |
95 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 98 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
96 return 0; | 99 return 0; |
97 } | 100 } |
98 | 101 |
99 // 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. |
100 return m_private->buffered(); | 103 return TimeRanges::create(m_webSourceBuffer->buffered()); |
101 } | 104 } |
102 | 105 |
103 double SourceBuffer::timestampOffset() const | 106 double SourceBuffer::timestampOffset() const |
104 { | 107 { |
105 return m_timestampOffset; | 108 return m_timestampOffset; |
106 } | 109 } |
107 | 110 |
108 void SourceBuffer::setTimestampOffset(double offset, ExceptionState& es) | 111 void SourceBuffer::setTimestampOffset(double offset, ExceptionState& es) |
109 { | 112 { |
110 // Section 3.1 timestampOffset attribute setter steps. | 113 // Section 3.1 timestampOffset attribute setter steps. |
111 // 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. |
112 // 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 |
113 // InvalidStateError exception and abort these steps. | 116 // InvalidStateError exception and abort these steps. |
114 // 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. |
115 if (isRemoved() || m_updating) { | 118 if (isRemoved() || m_updating) { |
116 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 119 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
117 return; | 120 return; |
118 } | 121 } |
119 | 122 |
120 // 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: |
121 // 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" |
122 // 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. |
123 m_source->openIfInEndedState(); | 126 m_source->openIfInEndedState(); |
124 | 127 |
125 // 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 |
126 // and abort these steps. | 129 // and abort these steps. |
127 // | 130 // |
128 // FIXME: Add step 6 text when mode attribute is implemented. | 131 // FIXME: Add step 6 text when mode attribute is implemented. |
129 if (!m_private->setTimestampOffset(offset)) { | 132 if (!m_webSourceBuffer->setTimestampOffset(offset)) { |
130 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 133 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
131 return; | 134 return; |
132 } | 135 } |
133 | 136 |
134 // 7. Update the attribute to new timestamp offset. | 137 // 7. Update the attribute to new timestamp offset. |
135 m_timestampOffset = offset; | 138 m_timestampOffset = offset; |
136 } | 139 } |
137 | 140 |
138 double SourceBuffer::appendWindowStart() const | 141 double SourceBuffer::appendWindowStart() const |
139 { | 142 { |
(...skipping 19 matching lines...) Expand all Loading... |
159 return; | 162 return; |
160 } | 163 } |
161 | 164 |
162 // 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 |
163 // exception and abort these steps. | 166 // exception and abort these steps. |
164 if (start < 0 || start >= m_appendWindowEnd) { | 167 if (start < 0 || start >= m_appendWindowEnd) { |
165 es.throwUninformativeAndGenericDOMException(InvalidAccessError); | 168 es.throwUninformativeAndGenericDOMException(InvalidAccessError); |
166 return; | 169 return; |
167 } | 170 } |
168 | 171 |
169 m_private->setAppendWindowStart(start); | 172 m_webSourceBuffer->setAppendWindowStart(start); |
170 | 173 |
171 // 4. Update the attribute to the new value. | 174 // 4. Update the attribute to the new value. |
172 m_appendWindowStart = start; | 175 m_appendWindowStart = start; |
173 } | 176 } |
174 | 177 |
175 double SourceBuffer::appendWindowEnd() const | 178 double SourceBuffer::appendWindowEnd() const |
176 { | 179 { |
177 return m_appendWindowEnd; | 180 return m_appendWindowEnd; |
178 } | 181 } |
179 | 182 |
180 void SourceBuffer::setAppendWindowEnd(double end, ExceptionState& es) | 183 void SourceBuffer::setAppendWindowEnd(double end, ExceptionState& es) |
181 { | 184 { |
182 // Section 3.1 appendWindowEnd attribute setter steps. | 185 // Section 3.1 appendWindowEnd attribute setter steps. |
183 // 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 |
184 // InvalidStateError exception and abort these steps. | 187 // InvalidStateError exception and abort these steps. |
185 // 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. |
186 if (isRemoved() || m_updating) { | 189 if (isRemoved() || m_updating) { |
187 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 190 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
188 return; | 191 return; |
189 } | 192 } |
190 | 193 |
191 // 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. |
192 // 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 |
193 // exception and abort these steps. | 196 // exception and abort these steps. |
194 if (std::isnan(end) || end <= m_appendWindowStart) { | 197 if (std::isnan(end) || end <= m_appendWindowStart) { |
195 es.throwUninformativeAndGenericDOMException(InvalidAccessError); | 198 es.throwUninformativeAndGenericDOMException(InvalidAccessError); |
196 return; | 199 return; |
197 } | 200 } |
198 | 201 |
199 m_private->setAppendWindowEnd(end); | 202 m_webSourceBuffer->setAppendWindowEnd(end); |
200 | 203 |
201 // 5. Update the attribute to the new value. | 204 // 5. Update the attribute to the new value. |
202 m_appendWindowEnd = end; | 205 m_appendWindowEnd = end; |
203 } | 206 } |
204 | 207 |
205 void SourceBuffer::appendBuffer(PassRefPtr<ArrayBuffer> data, ExceptionState& es
) | 208 void SourceBuffer::appendBuffer(PassRefPtr<ArrayBuffer> data, ExceptionState& es
) |
206 { | 209 { |
207 // Section 3.2 appendBuffer() | 210 // Section 3.2 appendBuffer() |
208 // 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 |
209 // 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. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // then throw an InvalidStateError exception and abort these steps. | 255 // then throw an InvalidStateError exception and abort these steps. |
253 if (isRemoved() || !m_source->isOpen()) { | 256 if (isRemoved() || !m_source->isOpen()) { |
254 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 257 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
255 return; | 258 return; |
256 } | 259 } |
257 | 260 |
258 // 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: ... |
259 abortIfUpdating(); | 262 abortIfUpdating(); |
260 | 263 |
261 // 4. Run the reset parser state algorithm. | 264 // 4. Run the reset parser state algorithm. |
262 m_private->abort(); | 265 m_webSourceBuffer->abort(); |
263 | 266 |
264 // 5. Set appendWindowStart to 0. | 267 // 5. Set appendWindowStart to 0. |
265 setAppendWindowStart(0, es); | 268 setAppendWindowStart(0, es); |
266 | 269 |
267 // 6. Set appendWindowEnd to positive Infinity. | 270 // 6. Set appendWindowEnd to positive Infinity. |
268 setAppendWindowEnd(std::numeric_limits<double>::infinity(), es); | 271 setAppendWindowEnd(std::numeric_limits<double>::infinity(), es); |
269 } | 272 } |
270 | 273 |
271 void SourceBuffer::remove(double start, double end, ExceptionState& es) | 274 void SourceBuffer::remove(double start, double end, ExceptionState& es) |
272 { | 275 { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 TRACE_EVENT_ASYNC_END0("media", traceEventName, this); | 350 TRACE_EVENT_ASYNC_END0("media", traceEventName, this); |
348 } | 351 } |
349 | 352 |
350 void SourceBuffer::removedFromMediaSource() | 353 void SourceBuffer::removedFromMediaSource() |
351 { | 354 { |
352 if (isRemoved()) | 355 if (isRemoved()) |
353 return; | 356 return; |
354 | 357 |
355 abortIfUpdating(); | 358 abortIfUpdating(); |
356 | 359 |
357 m_private->removedFromMediaSource(); | 360 m_webSourceBuffer->removedFromMediaSource(); |
| 361 m_webSourceBuffer.clear(); |
358 m_source = 0; | 362 m_source = 0; |
359 m_asyncEventQueue = 0; | 363 m_asyncEventQueue = 0; |
360 } | 364 } |
361 | 365 |
362 bool SourceBuffer::hasPendingActivity() const | 366 bool SourceBuffer::hasPendingActivity() const |
363 { | 367 { |
364 return m_source; | 368 return m_source; |
365 } | 369 } |
366 | 370 |
367 void SourceBuffer::suspend() | 371 void SourceBuffer::suspend() |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 TRACE_EVENT_ASYNC_STEP0("media", "SourceBuffer::appendBuffer", this, "append
ing"); | 456 TRACE_EVENT_ASYNC_STEP0("media", "SourceBuffer::appendBuffer", this, "append
ing"); |
453 | 457 |
454 // Section 3.5.4 Buffer Append Algorithm | 458 // Section 3.5.4 Buffer Append Algorithm |
455 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#sourcebuffer-buffer-append | 459 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#sourcebuffer-buffer-append |
456 | 460 |
457 // 1. Run the segment parser loop algorithm. | 461 // 1. Run the segment parser loop algorithm. |
458 // Step 2 doesn't apply since we run Step 1 synchronously here. | 462 // Step 2 doesn't apply since we run Step 1 synchronously here. |
459 size_t appendSize = m_pendingAppendData.size(); | 463 size_t appendSize = m_pendingAppendData.size(); |
460 if (!appendSize) { | 464 if (!appendSize) { |
461 // Resize buffer for 0 byte appends so we always have a valid pointer. | 465 // Resize buffer for 0 byte appends so we always have a valid pointer. |
462 // We need to convey all appends, even 0 byte ones to |m_private| so | 466 // We need to convey all appends, even 0 byte ones to |m_webSourceBuffer
| |
463 // that it can clear its end of stream state if necessary. | 467 // so that it can clear its end of stream state if necessary. |
464 m_pendingAppendData.resize(1); | 468 m_pendingAppendData.resize(1); |
465 } | 469 } |
466 m_private->append(m_pendingAppendData.data(), appendSize); | 470 m_webSourceBuffer->append(m_pendingAppendData.data(), appendSize); |
467 | 471 |
468 // 3. Set the updating attribute to false. | 472 // 3. Set the updating attribute to false. |
469 m_updating = false; | 473 m_updating = false; |
470 m_pendingAppendData.clear(); | 474 m_pendingAppendData.clear(); |
471 | 475 |
472 // 4. Queue a task to fire a simple event named update at this SourceBuffer
object. | 476 // 4. Queue a task to fire a simple event named update at this SourceBuffer
object. |
473 scheduleEvent(EventTypeNames::update); | 477 scheduleEvent(EventTypeNames::update); |
474 | 478 |
475 // 5. Queue a task to fire a simple event named updateend at this SourceBuff
er object. | 479 // 5. Queue a task to fire a simple event named updateend at this SourceBuff
er object. |
476 scheduleEvent(EventTypeNames::updateend); | 480 scheduleEvent(EventTypeNames::updateend); |
477 TRACE_EVENT_ASYNC_END0("media", "SourceBuffer::appendBuffer", this); | 481 TRACE_EVENT_ASYNC_END0("media", "SourceBuffer::appendBuffer", this); |
478 } | 482 } |
479 | 483 |
480 void SourceBuffer::removeAsyncPart() | 484 void SourceBuffer::removeAsyncPart() |
481 { | 485 { |
482 ASSERT(m_updating); | 486 ASSERT(m_updating); |
483 ASSERT(m_pendingRemoveStart >= 0); | 487 ASSERT(m_pendingRemoveStart >= 0); |
484 ASSERT(m_pendingRemoveStart < m_pendingRemoveEnd); | 488 ASSERT(m_pendingRemoveStart < m_pendingRemoveEnd); |
485 | 489 |
486 // Section 3.2 remove() method steps | 490 // Section 3.2 remove() method steps |
487 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#widl-SourceBuffer-remove-void-double-start-double-end | 491 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#widl-SourceBuffer-remove-void-double-start-double-end |
488 | 492 |
489 // 9. Run the coded frame removal algorithm with start and end as the start
and end of the removal range. | 493 // 9. Run the coded frame removal algorithm with start and end as the start
and end of the removal range. |
490 m_private->remove(m_pendingRemoveStart, m_pendingRemoveEnd); | 494 m_webSourceBuffer->remove(m_pendingRemoveStart, m_pendingRemoveEnd); |
491 | 495 |
492 // 10. Set the updating attribute to false. | 496 // 10. Set the updating attribute to false. |
493 m_updating = false; | 497 m_updating = false; |
494 m_pendingRemoveStart = -1; | 498 m_pendingRemoveStart = -1; |
495 m_pendingRemoveEnd = -1; | 499 m_pendingRemoveEnd = -1; |
496 | 500 |
497 // 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. |
498 scheduleEvent(EventTypeNames::update); | 502 scheduleEvent(EventTypeNames::update); |
499 | 503 |
500 // 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. |
(...skipping 18 matching lines...) Expand all Loading... |
519 if (isRemoved() || m_updating) { | 523 if (isRemoved() || m_updating) { |
520 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 524 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
521 return; | 525 return; |
522 } | 526 } |
523 | 527 |
524 TRACE_EVENT_ASYNC_BEGIN0("media", "SourceBuffer::appendStream", this); | 528 TRACE_EVENT_ASYNC_BEGIN0("media", "SourceBuffer::appendStream", this); |
525 | 529 |
526 // 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: ... |
527 m_source->openIfInEndedState(); | 531 m_source->openIfInEndedState(); |
528 | 532 |
529 // Steps 4-5 of the prepare append algorithm are handled by m_private. | 533 // Steps 4-5 of the prepare append algorithm are handled by m_webSourceBuffe
r. |
530 | 534 |
531 // 3. Set the updating attribute to true. | 535 // 3. Set the updating attribute to true. |
532 m_updating = true; | 536 m_updating = true; |
533 | 537 |
534 // 4. Queue a task to fire a simple event named updatestart at this SourceBu
ffer object. | 538 // 4. Queue a task to fire a simple event named updatestart at this SourceBu
ffer object. |
535 scheduleEvent(EventTypeNames::updatestart); | 539 scheduleEvent(EventTypeNames::updatestart); |
536 | 540 |
537 // 5. Asynchronously run the stream append loop algorithm with stream and ma
xSize. | 541 // 5. Asynchronously run the stream append loop algorithm with stream and ma
xSize. |
538 | 542 |
539 stream->neuter(); | 543 stream->neuter(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 // 3. Queue a task to fire a simple event named error at this SourceBuff
er object. | 586 // 3. Queue a task to fire a simple event named error at this SourceBuff
er object. |
583 scheduleEvent(EventTypeNames::error); | 587 scheduleEvent(EventTypeNames::error); |
584 | 588 |
585 // 4. Queue a task to fire a simple event named updateend at this Source
Buffer object. | 589 // 4. Queue a task to fire a simple event named updateend at this Source
Buffer object. |
586 scheduleEvent(EventTypeNames::updateend); | 590 scheduleEvent(EventTypeNames::updateend); |
587 TRACE_EVENT_ASYNC_END0("media", "SourceBuffer::appendStream", this); | 591 TRACE_EVENT_ASYNC_END0("media", "SourceBuffer::appendStream", this); |
588 return; | 592 return; |
589 } | 593 } |
590 | 594 |
591 // Section 3.5.6 Stream Append Loop | 595 // Section 3.5.6 Stream Append Loop |
592 // Steps 1-11 are handled by appendStreamAsyncPart(), |m_loader|, and |m_pri
vate|. | 596 // Steps 1-11 are handled by appendStreamAsyncPart(), |m_loader|, and |m_web
SourceBuffer|. |
593 // 12. Loop Done: Set the updating attribute to false. | 597 // 12. Loop Done: Set the updating attribute to false. |
594 m_updating = false; | 598 m_updating = false; |
595 | 599 |
596 // 13. Queue a task to fire a simple event named update at this SourceBuffer
object. | 600 // 13. Queue a task to fire a simple event named update at this SourceBuffer
object. |
597 scheduleEvent(EventTypeNames::update); | 601 scheduleEvent(EventTypeNames::update); |
598 | 602 |
599 // 14. Queue a task to fire a simple event named updateend at this SourceBuf
fer object. | 603 // 14. Queue a task to fire a simple event named updateend at this SourceBuf
fer object. |
600 scheduleEvent(EventTypeNames::updateend); | 604 scheduleEvent(EventTypeNames::updateend); |
601 TRACE_EVENT_ASYNC_END0("media", "SourceBuffer::appendStream", this); | 605 TRACE_EVENT_ASYNC_END0("media", "SourceBuffer::appendStream", this); |
602 } | 606 } |
(...skipping 10 matching lines...) Expand all Loading... |
613 { | 617 { |
614 LOG(Media, "SourceBuffer::didStartLoading() %p", this); | 618 LOG(Media, "SourceBuffer::didStartLoading() %p", this); |
615 } | 619 } |
616 | 620 |
617 void SourceBuffer::didReceiveDataForClient(const char* data, unsigned dataLength
) | 621 void SourceBuffer::didReceiveDataForClient(const char* data, unsigned dataLength
) |
618 { | 622 { |
619 LOG(Media, "SourceBuffer::didReceiveDataForClient(%d) %p", dataLength, this)
; | 623 LOG(Media, "SourceBuffer::didReceiveDataForClient(%d) %p", dataLength, this)
; |
620 ASSERT(m_updating); | 624 ASSERT(m_updating); |
621 ASSERT(m_loader); | 625 ASSERT(m_loader); |
622 | 626 |
623 m_private->append(reinterpret_cast<const unsigned char*>(data), dataLength); | 627 m_webSourceBuffer->append(reinterpret_cast<const unsigned char*>(data), data
Length); |
624 } | 628 } |
625 | 629 |
626 void SourceBuffer::didFinishLoading() | 630 void SourceBuffer::didFinishLoading() |
627 { | 631 { |
628 LOG(Media, "SourceBuffer::didFinishLoading() %p", this); | 632 LOG(Media, "SourceBuffer::didFinishLoading() %p", this); |
629 appendStreamDone(true); | 633 appendStreamDone(true); |
630 } | 634 } |
631 | 635 |
632 void SourceBuffer::didFail(FileError::ErrorCode errorCode) | 636 void SourceBuffer::didFail(FileError::ErrorCode errorCode) |
633 { | 637 { |
634 LOG(Media, "SourceBuffer::didFail(%d) %p", errorCode, this); | 638 LOG(Media, "SourceBuffer::didFail(%d) %p", errorCode, this); |
635 appendStreamDone(false); | 639 appendStreamDone(false); |
636 } | 640 } |
637 | 641 |
638 } // namespace WebCore | 642 } // namespace WebCore |
OLD | NEW |