Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: Source/modules/mediasource/SourceBuffer.cpp

Issue 754463008: MSE: Implement SourceBuffer.trackDefaults (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@Implement_TrackDefaultList_object
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(HeapVector<Member<TrackDefault>>( ), ASSERT_NO_EXCEPTION))
haraken 2014/12/04 15:33:09 This looks unsafe to me. The HeapVector is created
philipj_slow 2014/12/04 16:17:53 Alternatively, change the spec to let trackDefault
wolenetz 2014/12/12 22:15:06 UAF/unsafety: TrackDefaultList::create passes thro
philipj_slow 2014/12/15 09:02:38 AFAICT, this is safe, the TrackDefaultList constru
wolenetz 2014/12/15 23:49:20 With patch set 3, this becomes academic: I'm still
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
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
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 EventTargetWithInlineData::trace(visitor); 767 EventTargetWithInlineData::trace(visitor);
750 } 768 }
751 769
752 } // namespace blink 770 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698