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