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

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

Issue 552943002: MSE: Start letting SourceBuffer begin to do initialization segment received algorithm (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated to be part 1 of a 3-sided blink->chromium->blink set of changes Created 6 years, 3 months 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_asyncEventQueue(asyncEventQueue) 86 , m_asyncEventQueue(asyncEventQueue)
87 , m_mode(segmentsKeyword()) 87 , m_mode(segmentsKeyword())
88 , m_updating(false) 88 , m_updating(false)
89 , m_timestampOffset(0) 89 , m_timestampOffset(0)
90 , m_appendWindowStart(0) 90 , m_appendWindowStart(0)
91 , m_appendWindowEnd(std::numeric_limits<double>::infinity()) 91 , m_appendWindowEnd(std::numeric_limits<double>::infinity())
92 , m_firstInitializationSegment(false)
92 , m_pendingAppendDataOffset(0) 93 , m_pendingAppendDataOffset(0)
93 , m_appendBufferAsyncPartRunner(this, &SourceBuffer::appendBufferAsyncPart) 94 , m_appendBufferAsyncPartRunner(this, &SourceBuffer::appendBufferAsyncPart)
94 , m_pendingRemoveStart(-1) 95 , m_pendingRemoveStart(-1)
95 , m_pendingRemoveEnd(-1) 96 , m_pendingRemoveEnd(-1)
96 , m_removeAsyncPartRunner(this, &SourceBuffer::removeAsyncPart) 97 , m_removeAsyncPartRunner(this, &SourceBuffer::removeAsyncPart)
97 , m_streamMaxSizeValid(false) 98 , m_streamMaxSizeValid(false)
98 , m_streamMaxSize(0) 99 , m_streamMaxSize(0)
99 , m_appendStreamAsyncPartRunner(this, &SourceBuffer::appendStreamAsyncPart) 100 , m_appendStreamAsyncPartRunner(this, &SourceBuffer::appendStreamAsyncPart)
100 { 101 {
101 ASSERT(m_webSourceBuffer); 102 ASSERT(m_webSourceBuffer);
102 ASSERT(m_source); 103 ASSERT(m_source);
103 ScriptWrappable::init(this); 104 ScriptWrappable::init(this);
105 m_webSourceBuffer->setClient(this);
104 } 106 }
105 107
106 SourceBuffer::~SourceBuffer() 108 SourceBuffer::~SourceBuffer()
107 { 109 {
108 // Oilpan: a SourceBuffer might be finalized without having been 110 // Oilpan: a SourceBuffer might be finalized without having been
109 // explicitly removed first, hence the asserts below will not 111 // explicitly removed first, hence the asserts below will not
110 // hold. 112 // hold.
111 #if !ENABLE(OILPAN) 113 #if !ENABLE(OILPAN)
112 ASSERT(isRemoved()); 114 ASSERT(isRemoved());
113 ASSERT(!m_loader); 115 ASSERT(!m_loader);
114 ASSERT(!m_stream); 116 ASSERT(!m_stream);
117 ASSERT(!m_webSourceBuffer);
115 #endif 118 #endif
116 } 119 }
117 120
118 const AtomicString& SourceBuffer::segmentsKeyword() 121 const AtomicString& SourceBuffer::segmentsKeyword()
119 { 122 {
120 DEFINE_STATIC_LOCAL(const AtomicString, segments, ("segments", AtomicString: :ConstructFromLiteral)); 123 DEFINE_STATIC_LOCAL(const AtomicString, segments, ("segments", AtomicString: :ConstructFromLiteral));
121 return segments; 124 return segments;
122 } 125 }
123 126
124 const AtomicString& SourceBuffer::sequenceKeyword() 127 const AtomicString& SourceBuffer::sequenceKeyword()
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 return; 416 return;
414 417
415 abortIfUpdating(); 418 abortIfUpdating();
416 419
417 m_webSourceBuffer->removedFromMediaSource(); 420 m_webSourceBuffer->removedFromMediaSource();
418 m_webSourceBuffer.clear(); 421 m_webSourceBuffer.clear();
419 m_source = nullptr; 422 m_source = nullptr;
420 m_asyncEventQueue = 0; 423 m_asyncEventQueue = 0;
421 } 424 }
422 425
426 void SourceBuffer::initializationSegmentReceived()
427 {
428 ASSERT(m_source);
429 ASSERT(m_updating);
430
431 // https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source. html#sourcebuffer-init-segment-received
432 // FIXME: Make steps 1-7 synchronous with this call.
433 // FIXME: Augment the interface to this method to implement compliant steps 4-7 here.
434 // Step 3 (if the first initialization segment flag is true) is implemented
435 // by caller.
436
437 if (!m_firstInitializationSegment) {
acolwell GONE FROM CHROMIUM 2014/09/10 17:16:27 nit: s/m_first/m_receivedFirst/ to avoid confusion
wolenetz 2014/09/10 21:18:22 Done as s/Segment/SegmentReceived/ to match the sp
438 // 5. If active track flag equals true, then run the following steps:
439 // 5.1. Add this SourceBuffer to activeSourceBuffers.
440 // 5.2. Queue a task to fire a simple event named addsourcebuffer at
441 // activesourcebuffers.
442 m_source->setSourceBufferActive(this);
443
444 // 6. Set first initialization segment flag to true.
445 m_firstInitializationSegment = true;
446 }
447 }
448
423 bool SourceBuffer::hasPendingActivity() const 449 bool SourceBuffer::hasPendingActivity() const
424 { 450 {
425 return m_source; 451 return m_source;
426 } 452 }
427 453
428 void SourceBuffer::suspend() 454 void SourceBuffer::suspend()
429 { 455 {
430 m_appendBufferAsyncPartRunner.suspend(); 456 m_appendBufferAsyncPartRunner.suspend();
431 m_removeAsyncPartRunner.suspend(); 457 m_removeAsyncPartRunner.suspend();
432 m_appendStreamAsyncPartRunner.suspend(); 458 m_appendStreamAsyncPartRunner.suspend();
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 } 744 }
719 745
720 void SourceBuffer::trace(Visitor* visitor) 746 void SourceBuffer::trace(Visitor* visitor)
721 { 747 {
722 visitor->trace(m_source); 748 visitor->trace(m_source);
723 visitor->trace(m_stream); 749 visitor->trace(m_stream);
724 EventTargetWithInlineData::trace(visitor); 750 EventTargetWithInlineData::trace(visitor);
725 } 751 }
726 752
727 } // namespace blink 753 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698