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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 if (!webSourceBuffer) { | 148 if (!webSourceBuffer) { |
149 ASSERT(exceptionState.code() == NotSupportedError || exceptionState.code
() == QuotaExceededError); | 149 ASSERT(exceptionState.code() == NotSupportedError || exceptionState.code
() == QuotaExceededError); |
150 // 2. If type contains a MIME type that is not supported ..., then throw
a NotSupportedError exception and abort these steps. | 150 // 2. If type contains a MIME type that is not supported ..., then throw
a NotSupportedError exception and abort these steps. |
151 // 3. If the user agent can't handle any more SourceBuffer objects then
throw a QuotaExceededError exception and abort these steps | 151 // 3. If the user agent can't handle any more SourceBuffer objects then
throw a QuotaExceededError exception and abort these steps |
152 return 0; | 152 return 0; |
153 } | 153 } |
154 | 154 |
155 SourceBuffer* buffer = SourceBuffer::create(webSourceBuffer.release(), this,
m_asyncEventQueue.get()); | 155 SourceBuffer* buffer = SourceBuffer::create(webSourceBuffer.release(), this,
m_asyncEventQueue.get()); |
156 // 6. Add the new object to sourceBuffers and fire a addsourcebuffer on that
object. | 156 // 6. Add the new object to sourceBuffers and fire a addsourcebuffer on that
object. |
157 m_sourceBuffers->add(buffer); | 157 m_sourceBuffers->add(buffer); |
158 // FIXME: Remove the following once Chromium calls WebSourceBufferClient::In
itSegmentReceived() | |
159 setSourceBufferActive(buffer); | |
160 | 158 |
161 // 7. Return the new object to the caller. | 159 // 7. Return the new object to the caller. |
162 return buffer; | 160 return buffer; |
163 } | 161 } |
164 | 162 |
165 void MediaSource::removeSourceBuffer(SourceBuffer* buffer, ExceptionState& excep
tionState) | 163 void MediaSource::removeSourceBuffer(SourceBuffer* buffer, ExceptionState& excep
tionState) |
166 { | 164 { |
167 WTF_LOG(Media, "MediaSource::removeSourceBuffer() %p", this); | 165 WTF_LOG(Media, "MediaSource::removeSourceBuffer() %p", this); |
168 | 166 |
169 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media
-source.html#widl-MediaSource-removeSourceBuffer-void-SourceBuffer-sourceBuffer | 167 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media
-source.html#widl-MediaSource-removeSourceBuffer-void-SourceBuffer-sourceBuffer |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 m_webMediaSource->markEndOfStream(eosStatus); | 475 m_webMediaSource->markEndOfStream(eosStatus); |
478 } | 476 } |
479 | 477 |
480 bool MediaSource::isOpen() const | 478 bool MediaSource::isOpen() const |
481 { | 479 { |
482 return readyState() == openKeyword(); | 480 return readyState() == openKeyword(); |
483 } | 481 } |
484 | 482 |
485 void MediaSource::setSourceBufferActive(SourceBuffer* sourceBuffer) | 483 void MediaSource::setSourceBufferActive(SourceBuffer* sourceBuffer) |
486 { | 484 { |
487 if (m_activeSourceBuffers->contains(sourceBuffer)) | 485 ASSERT(!m_activeSourceBuffers->contains(sourceBuffer)); |
488 return; | |
489 | 486 |
490 // https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.
html#widl-MediaSource-activeSourceBuffers | 487 // https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.
html#widl-MediaSource-activeSourceBuffers |
491 // SourceBuffer objects in SourceBuffer.activeSourceBuffers must appear in | 488 // SourceBuffer objects in SourceBuffer.activeSourceBuffers must appear in |
492 // the same order as they appear in SourceBuffer.sourceBuffers. | 489 // the same order as they appear in SourceBuffer.sourceBuffers. |
493 // SourceBuffer transitions to active are not guaranteed to occur in the | 490 // SourceBuffer transitions to active are not guaranteed to occur in the |
494 // same order as buffers in |m_sourceBuffers|, so this method needs to | 491 // same order as buffers in |m_sourceBuffers|, so this method needs to |
495 // insert |sourceBuffer| into |m_activeSourceBuffers|. | 492 // insert |sourceBuffer| into |m_activeSourceBuffers|. |
496 size_t indexInSourceBuffers = m_sourceBuffers->find(sourceBuffer); | 493 size_t indexInSourceBuffers = m_sourceBuffers->find(sourceBuffer); |
497 ASSERT(indexInSourceBuffers != kNotFound); | 494 ASSERT(indexInSourceBuffers != kNotFound); |
498 | 495 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 | 585 |
589 m_asyncEventQueue->enqueueEvent(event.release()); | 586 m_asyncEventQueue->enqueueEvent(event.release()); |
590 } | 587 } |
591 | 588 |
592 URLRegistry& MediaSource::registry() const | 589 URLRegistry& MediaSource::registry() const |
593 { | 590 { |
594 return MediaSourceRegistry::registry(); | 591 return MediaSourceRegistry::registry(); |
595 } | 592 } |
596 | 593 |
597 } // namespace blink | 594 } // namespace blink |
OLD | NEW |