Chromium Code Reviews| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 { | 76 { |
| 77 SourceBuffer* sourceBuffer = new SourceBuffer(webSourceBuffer, source, async EventQueue); | 77 SourceBuffer* sourceBuffer = new SourceBuffer(webSourceBuffer, source, async EventQueue); |
| 78 sourceBuffer->suspendIfNeeded(); | 78 sourceBuffer->suspendIfNeeded(); |
| 79 return sourceBuffer; | 79 return sourceBuffer; |
| 80 } | 80 } |
| 81 | 81 |
| 82 SourceBuffer::SourceBuffer(PassOwnPtr<WebSourceBuffer> webSourceBuffer, MediaSou rce* source, GenericEventQueue* asyncEventQueue) | 82 SourceBuffer::SourceBuffer(PassOwnPtr<WebSourceBuffer> webSourceBuffer, MediaSou rce* source, GenericEventQueue* asyncEventQueue) |
| 83 : ActiveDOMObject(source->executionContext()) | 83 : ActiveDOMObject(source->executionContext()) |
| 84 , m_webSourceBuffer(webSourceBuffer) | 84 , m_webSourceBuffer(webSourceBuffer) |
| 85 , m_source(source) | 85 , m_source(source) |
| 86 , m_trackDefaults(TrackDefaultList::create()) | |
|
haraken
2014/12/16 01:16:16
Do we need to create an empty vector? Can we just
sof
2014/12/16 07:24:36
Don't think the IDL allows for that in practice, a
philipj_slow
2014/12/16 09:55:48
Right, that is the topic of the spec bug Matthew f
| |
| 86 , m_asyncEventQueue(asyncEventQueue) | 87 , m_asyncEventQueue(asyncEventQueue) |
| 87 , m_mode(segmentsKeyword()) | 88 , m_mode(segmentsKeyword()) |
| 88 , m_updating(false) | 89 , m_updating(false) |
| 89 , m_timestampOffset(0) | 90 , m_timestampOffset(0) |
| 90 , m_appendWindowStart(0) | 91 , m_appendWindowStart(0) |
| 91 , m_appendWindowEnd(std::numeric_limits<double>::infinity()) | 92 , m_appendWindowEnd(std::numeric_limits<double>::infinity()) |
| 92 , m_firstInitializationSegmentReceived(false) | 93 , m_firstInitializationSegmentReceived(false) |
| 93 , m_pendingAppendDataOffset(0) | 94 , m_pendingAppendDataOffset(0) |
| 94 , m_appendBufferAsyncPartRunner(this, &SourceBuffer::appendBufferAsyncPart) | 95 , m_appendBufferAsyncPartRunner(this, &SourceBuffer::appendBufferAsyncPart) |
| 95 , m_pendingRemoveStart(-1) | 96 , m_pendingRemoveStart(-1) |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 359 | 360 |
| 360 // 7.4. Queue a task to fire a simple event named updatestart at this Source Buffer object. | 361 // 7.4. Queue a task to fire a simple event named updatestart at this Source Buffer object. |
| 361 scheduleEvent(EventTypeNames::updatestart); | 362 scheduleEvent(EventTypeNames::updatestart); |
| 362 | 363 |
| 363 // 7.5. Return control to the caller and run the rest of the steps asynchron ously. | 364 // 7.5. Return control to the caller and run the rest of the steps asynchron ously. |
| 364 m_pendingRemoveStart = start; | 365 m_pendingRemoveStart = start; |
| 365 m_pendingRemoveEnd = end; | 366 m_pendingRemoveEnd = end; |
| 366 m_removeAsyncPartRunner.runAsync(); | 367 m_removeAsyncPartRunner.runAsync(); |
| 367 } | 368 } |
| 368 | 369 |
| 370 void SourceBuffer::setTrackDefaults(TrackDefaultList* trackDefaults, ExceptionSt ate& exceptionState) | |
| 371 { | |
| 372 // Per 02 Dec 2014 Editor's Draft | |
| 373 // http://w3c.github.io/media-source/#widl-SourceBuffer-trackDefaults | |
| 374 // 1. If this object has been removed from the sourceBuffers attribute of | |
| 375 // the parent media source, then throw an InvalidStateError exception | |
| 376 // and abort these steps. | |
| 377 // 2. If the updating attribute equals true, then throw an InvalidStateError | |
| 378 // exception and abort these steps. | |
| 379 if (throwExceptionIfRemovedOrUpdating(isRemoved(), m_updating, exceptionStat e)) | |
| 380 return; | |
| 381 | |
| 382 // 3. Update the attribute to the new value. | |
| 383 m_trackDefaults = trackDefaults; | |
| 384 } | |
| 385 | |
| 369 void SourceBuffer::abortIfUpdating() | 386 void SourceBuffer::abortIfUpdating() |
| 370 { | 387 { |
| 371 // Section 3.2 abort() method step 3 substeps. | 388 // Section 3.2 abort() method step 3 substeps. |
| 372 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou rce.html#widl-SourceBuffer-abort-void | 389 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou rce.html#widl-SourceBuffer-abort-void |
| 373 | 390 |
| 374 if (!m_updating) | 391 if (!m_updating) |
| 375 return; | 392 return; |
| 376 | 393 |
| 377 const char* traceEventName = 0; | 394 const char* traceEventName = 0; |
| 378 if (!m_pendingAppendData.isEmpty()) { | 395 if (!m_pendingAppendData.isEmpty()) { |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 739 void SourceBuffer::didFail(FileError::ErrorCode errorCode) | 756 void SourceBuffer::didFail(FileError::ErrorCode errorCode) |
| 740 { | 757 { |
| 741 WTF_LOG(Media, "SourceBuffer::didFail(%d) %p", errorCode, this); | 758 WTF_LOG(Media, "SourceBuffer::didFail(%d) %p", errorCode, this); |
| 742 appendStreamDone(false); | 759 appendStreamDone(false); |
| 743 } | 760 } |
| 744 | 761 |
| 745 void SourceBuffer::trace(Visitor* visitor) | 762 void SourceBuffer::trace(Visitor* visitor) |
| 746 { | 763 { |
| 747 visitor->trace(m_source); | 764 visitor->trace(m_source); |
| 748 visitor->trace(m_stream); | 765 visitor->trace(m_stream); |
| 766 visitor->trace(m_trackDefaults); | |
| 749 visitor->trace(m_asyncEventQueue); | 767 visitor->trace(m_asyncEventQueue); |
| 750 EventTargetWithInlineData::trace(visitor); | 768 EventTargetWithInlineData::trace(visitor); |
| 751 } | 769 } |
| 752 | 770 |
| 753 } // namespace blink | 771 } // namespace blink |
| OLD | NEW |