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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "modules/mediasource/MediaSource.h" | 32 #include "modules/mediasource/MediaSource.h" |
33 | 33 |
34 #include "RuntimeEnabledFeatures.h" | |
35 #include "bindings/v8/ExceptionMessages.h" | 34 #include "bindings/v8/ExceptionMessages.h" |
36 #include "bindings/v8/ExceptionState.h" | 35 #include "bindings/v8/ExceptionState.h" |
37 #include "bindings/v8/ExceptionStatePlaceholder.h" | 36 #include "bindings/v8/ExceptionStatePlaceholder.h" |
38 #include "core/dom/ExceptionCode.h" | 37 #include "core/dom/ExceptionCode.h" |
39 #include "core/events/GenericEventQueue.h" | 38 #include "core/events/GenericEventQueue.h" |
40 #include "core/html/HTMLMediaElement.h" | 39 #include "core/html/HTMLMediaElement.h" |
41 #include "core/html/TimeRanges.h" | 40 #include "core/html/TimeRanges.h" |
42 #include "modules/mediasource/MediaSourceRegistry.h" | 41 #include "modules/mediasource/MediaSourceRegistry.h" |
43 #include "platform/ContentType.h" | 42 #include "platform/ContentType.h" |
44 #include "platform/Logging.h" | 43 #include "platform/Logging.h" |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 m_asyncEventQueue->close(); | 469 m_asyncEventQueue->close(); |
471 if (!isClosed()) | 470 if (!isClosed()) |
472 setReadyState(closedKeyword()); | 471 setReadyState(closedKeyword()); |
473 m_webMediaSource.clear(); | 472 m_webMediaSource.clear(); |
474 } | 473 } |
475 | 474 |
476 PassOwnPtr<WebSourceBuffer> MediaSource::createWebSourceBuffer(const String& typ
e, const Vector<String>& codecs, ExceptionState& exceptionState) | 475 PassOwnPtr<WebSourceBuffer> MediaSource::createWebSourceBuffer(const String& typ
e, const Vector<String>& codecs, ExceptionState& exceptionState) |
477 { | 476 { |
478 WebSourceBuffer* webSourceBuffer = 0; | 477 WebSourceBuffer* webSourceBuffer = 0; |
479 | 478 |
480 // FIXME: Always use the new frame processor once it has stabilized enough.
See http://crbug.com/249422. | 479 switch (m_webMediaSource->addSourceBuffer(type, codecs, &webSourceBuffer)) { |
481 WebMediaSource::FrameProcessorChoice frameProcessorChoice = RuntimeEnabledFe
atures::mediaSourceExperimentalEnabled() ? | |
482 WebMediaSource::UseNewFrameProcessor : WebMediaSource::UseLegacyFramePro
cessor; | |
483 | |
484 WTF_LOG(Media, "MediaSource::createWebSourceBuffer() %p : frameProcessorChoi
ce = %i", this, frameProcessorChoice); | |
485 | |
486 switch (m_webMediaSource->addSourceBuffer(type, codecs, frameProcessorChoice
, &webSourceBuffer)) { | |
487 case WebMediaSource::AddStatusOk: | 480 case WebMediaSource::AddStatusOk: |
488 return adoptPtr(webSourceBuffer); | 481 return adoptPtr(webSourceBuffer); |
489 case WebMediaSource::AddStatusNotSupported: | 482 case WebMediaSource::AddStatusNotSupported: |
490 ASSERT(!webSourceBuffer); | 483 ASSERT(!webSourceBuffer); |
491 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/m
edia-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type | 484 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/m
edia-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type |
492 // Step 2: If type contains a MIME type ... that is not supported with t
he types | 485 // Step 2: If type contains a MIME type ... that is not supported with t
he types |
493 // specified for the other SourceBuffer objects in sourceBuffers, then t
hrow | 486 // specified for the other SourceBuffer objects in sourceBuffers, then t
hrow |
494 // a NotSupportedError exception and abort these steps. | 487 // a NotSupportedError exception and abort these steps. |
495 exceptionState.throwDOMException(NotSupportedError, "The type provided (
'" + type + "') is not supported."); | 488 exceptionState.throwDOMException(NotSupportedError, "The type provided (
'" + type + "') is not supported."); |
496 return nullptr; | 489 return nullptr; |
(...skipping 19 matching lines...) Expand all Loading... |
516 | 509 |
517 m_asyncEventQueue->enqueueEvent(event.release()); | 510 m_asyncEventQueue->enqueueEvent(event.release()); |
518 } | 511 } |
519 | 512 |
520 URLRegistry& MediaSource::registry() const | 513 URLRegistry& MediaSource::registry() const |
521 { | 514 { |
522 return MediaSourceRegistry::registry(); | 515 return MediaSourceRegistry::registry(); |
523 } | 516 } |
524 | 517 |
525 } // namespace WebCore | 518 } // namespace WebCore |
OLD | NEW |