| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_firstInitializationSegmentReceived(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); |
| 104 m_webSourceBuffer->setClient(this); |
| 103 } | 105 } |
| 104 | 106 |
| 105 SourceBuffer::~SourceBuffer() | 107 SourceBuffer::~SourceBuffer() |
| 106 { | 108 { |
| 107 // Oilpan: a SourceBuffer might be finalized without having been | 109 // Oilpan: a SourceBuffer might be finalized without having been |
| 108 // explicitly removed first, hence the asserts below will not | 110 // explicitly removed first, hence the asserts below will not |
| 109 // hold. | 111 // hold. |
| 110 #if !ENABLE(OILPAN) | 112 #if !ENABLE(OILPAN) |
| 111 ASSERT(isRemoved()); | 113 ASSERT(isRemoved()); |
| 112 ASSERT(!m_loader); | 114 ASSERT(!m_loader); |
| 113 ASSERT(!m_stream); | 115 ASSERT(!m_stream); |
| 116 ASSERT(!m_webSourceBuffer); |
| 114 #endif | 117 #endif |
| 115 } | 118 } |
| 116 | 119 |
| 117 const AtomicString& SourceBuffer::segmentsKeyword() | 120 const AtomicString& SourceBuffer::segmentsKeyword() |
| 118 { | 121 { |
| 119 DEFINE_STATIC_LOCAL(const AtomicString, segments, ("segments", AtomicString:
:ConstructFromLiteral)); | 122 DEFINE_STATIC_LOCAL(const AtomicString, segments, ("segments", AtomicString:
:ConstructFromLiteral)); |
| 120 return segments; | 123 return segments; |
| 121 } | 124 } |
| 122 | 125 |
| 123 const AtomicString& SourceBuffer::sequenceKeyword() | 126 const AtomicString& SourceBuffer::sequenceKeyword() |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 return; | 415 return; |
| 413 | 416 |
| 414 abortIfUpdating(); | 417 abortIfUpdating(); |
| 415 | 418 |
| 416 m_webSourceBuffer->removedFromMediaSource(); | 419 m_webSourceBuffer->removedFromMediaSource(); |
| 417 m_webSourceBuffer.clear(); | 420 m_webSourceBuffer.clear(); |
| 418 m_source = nullptr; | 421 m_source = nullptr; |
| 419 m_asyncEventQueue = 0; | 422 m_asyncEventQueue = 0; |
| 420 } | 423 } |
| 421 | 424 |
| 425 void SourceBuffer::initializationSegmentReceived() |
| 426 { |
| 427 ASSERT(m_source); |
| 428 ASSERT(m_updating); |
| 429 |
| 430 // https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.
html#sourcebuffer-init-segment-received |
| 431 // FIXME: Make steps 1-7 synchronous with this call. |
| 432 // FIXME: Augment the interface to this method to implement compliant steps
4-7 here. |
| 433 // Step 3 (if the first initialization segment received flag is true) is |
| 434 // implemented by caller. |
| 435 |
| 436 if (!m_firstInitializationSegmentReceived) { |
| 437 // 5. If active track flag equals true, then run the following steps: |
| 438 // 5.1. Add this SourceBuffer to activeSourceBuffers. |
| 439 // 5.2. Queue a task to fire a simple event named addsourcebuffer at |
| 440 // activesourcebuffers. |
| 441 m_source->setSourceBufferActive(this); |
| 442 |
| 443 // 6. Set first initialization segment received flag to true. |
| 444 m_firstInitializationSegmentReceived = true; |
| 445 } |
| 446 } |
| 447 |
| 422 bool SourceBuffer::hasPendingActivity() const | 448 bool SourceBuffer::hasPendingActivity() const |
| 423 { | 449 { |
| 424 return m_source; | 450 return m_source; |
| 425 } | 451 } |
| 426 | 452 |
| 427 void SourceBuffer::suspend() | 453 void SourceBuffer::suspend() |
| 428 { | 454 { |
| 429 m_appendBufferAsyncPartRunner.suspend(); | 455 m_appendBufferAsyncPartRunner.suspend(); |
| 430 m_removeAsyncPartRunner.suspend(); | 456 m_removeAsyncPartRunner.suspend(); |
| 431 m_appendStreamAsyncPartRunner.suspend(); | 457 m_appendStreamAsyncPartRunner.suspend(); |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 } | 743 } |
| 718 | 744 |
| 719 void SourceBuffer::trace(Visitor* visitor) | 745 void SourceBuffer::trace(Visitor* visitor) |
| 720 { | 746 { |
| 721 visitor->trace(m_source); | 747 visitor->trace(m_source); |
| 722 visitor->trace(m_stream); | 748 visitor->trace(m_stream); |
| 723 EventTargetWithInlineData::trace(visitor); | 749 EventTargetWithInlineData::trace(visitor); |
| 724 } | 750 } |
| 725 | 751 |
| 726 } // namespace blink | 752 } // namespace blink |
| OLD | NEW |