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

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 WIP 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);
118 #else
119 if (m_webSourceBuffer)
acolwell GONE FROM CHROMIUM 2014/09/09 22:23:21 nit: I don't think you'll need this. You should al
wolenetz 2014/09/10 00:42:29 Done.
120 m_webSourceBuffer->setClient(0);
115 #endif 121 #endif
116 } 122 }
117 123
118 const AtomicString& SourceBuffer::segmentsKeyword() 124 const AtomicString& SourceBuffer::segmentsKeyword()
119 { 125 {
120 DEFINE_STATIC_LOCAL(const AtomicString, segments, ("segments", AtomicString: :ConstructFromLiteral)); 126 DEFINE_STATIC_LOCAL(const AtomicString, segments, ("segments", AtomicString: :ConstructFromLiteral));
121 return segments; 127 return segments;
122 } 128 }
123 129
124 const AtomicString& SourceBuffer::sequenceKeyword() 130 const AtomicString& SourceBuffer::sequenceKeyword()
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 } 414 }
409 415
410 void SourceBuffer::removedFromMediaSource() 416 void SourceBuffer::removedFromMediaSource()
411 { 417 {
412 if (isRemoved()) 418 if (isRemoved())
413 return; 419 return;
414 420
415 abortIfUpdating(); 421 abortIfUpdating();
416 422
417 m_webSourceBuffer->removedFromMediaSource(); 423 m_webSourceBuffer->removedFromMediaSource();
424 m_webSourceBuffer->setClient(0);
acolwell GONE FROM CHROMIUM 2014/09/09 22:23:21 nit: Seems like this could be part of removedFromM
wolenetz 2014/09/10 00:42:29 Done.
418 m_webSourceBuffer.clear(); 425 m_webSourceBuffer.clear();
419 m_source = nullptr; 426 m_source = nullptr;
420 m_asyncEventQueue = 0; 427 m_asyncEventQueue = 0;
421 } 428 }
422 429
430 void SourceBuffer::initializationSegmentReceived()
431 {
432 ASSERT(m_source);
433 ASSERT(m_updating);
434
435 // https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source. html#sourcebuffer-init-segment-received
436 // FIXME: Make steps 1-7 synchronous with this call.
437 // FIXME: Augment the interface to this method to implement compliant steps 4-7 here.
438 // Step 3 (if the first initialization segment flag is true) is implemented
439 // by caller.
440
441 if (!m_firstInitializationSegment) {
442 // 5. If active track flag equals true, then run the following steps:
443 // 5.1. Add this SourceBuffer to activeSourceBuffers.
444 // 5.2. Queue a task to fire a simple event named addsourcebuffer at
445 // activesourcebuffers.
446 m_source->setSourceBufferActive(this);
447
448 // 6. Set first initialization segment flag to true.
449 m_firstInitializationSegment = true;
450 }
451 }
452
423 bool SourceBuffer::hasPendingActivity() const 453 bool SourceBuffer::hasPendingActivity() const
424 { 454 {
425 return m_source; 455 return m_source;
426 } 456 }
427 457
428 void SourceBuffer::suspend() 458 void SourceBuffer::suspend()
429 { 459 {
430 m_appendBufferAsyncPartRunner.suspend(); 460 m_appendBufferAsyncPartRunner.suspend();
431 m_removeAsyncPartRunner.suspend(); 461 m_removeAsyncPartRunner.suspend();
432 m_appendStreamAsyncPartRunner.suspend(); 462 m_appendStreamAsyncPartRunner.suspend();
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 } 748 }
719 749
720 void SourceBuffer::trace(Visitor* visitor) 750 void SourceBuffer::trace(Visitor* visitor)
721 { 751 {
722 visitor->trace(m_source); 752 visitor->trace(m_source);
723 visitor->trace(m_stream); 753 visitor->trace(m_stream);
724 EventTargetWithInlineData::trace(visitor); 754 EventTargetWithInlineData::trace(visitor);
725 } 755 }
726 756
727 } // namespace blink 757 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698