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

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

Issue 1283573002: Do the codec string parsing for MSE in media, instead of Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « Source/modules/mediasource/MediaSource.h ('k') | Source/platform/ContentType.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 // 4. If the readyState attribute is not in the "open" state then throw an 135 // 4. If the readyState attribute is not in the "open" state then throw an
136 // InvalidStateError exception and abort these steps. 136 // InvalidStateError exception and abort these steps.
137 if (!isOpen()) { 137 if (!isOpen()) {
138 exceptionState.throwDOMException(InvalidStateError, "The MediaSource's r eadyState is not 'open'."); 138 exceptionState.throwDOMException(InvalidStateError, "The MediaSource's r eadyState is not 'open'.");
139 return 0; 139 return 0;
140 } 140 }
141 141
142 // 5. Create a new SourceBuffer object and associated resources. 142 // 5. Create a new SourceBuffer object and associated resources.
143 ContentType contentType(type); 143 ContentType contentType(type);
144 Vector<String> codecs = contentType.codecs(); 144 String codecs = contentType.parameter("codecs");
145 OwnPtr<WebSourceBuffer> webSourceBuffer = createWebSourceBuffer(contentType. type(), codecs, exceptionState); 145 OwnPtr<WebSourceBuffer> webSourceBuffer = createWebSourceBuffer(contentType. type(), codecs, exceptionState);
146 146
147 if (!webSourceBuffer) { 147 if (!webSourceBuffer) {
148 ASSERT(exceptionState.code() == NotSupportedError || exceptionState.code () == QuotaExceededError); 148 ASSERT(exceptionState.code() == NotSupportedError || exceptionState.code () == QuotaExceededError);
149 // 2. If type contains a MIME type that is not supported ..., then throw a NotSupportedError exception and abort these steps. 149 // 2. If type contains a MIME type that is not supported ..., then throw a NotSupportedError exception and abort these steps.
150 // 3. If the user agent can't handle any more SourceBuffer objects then throw a QuotaExceededError exception and abort these steps 150 // 3. If the user agent can't handle any more SourceBuffer objects then throw a QuotaExceededError exception and abort these steps
151 return 0; 151 return 0;
152 } 152 }
153 153
154 SourceBuffer* buffer = SourceBuffer::create(webSourceBuffer.release(), this, m_asyncEventQueue.get()); 154 SourceBuffer* buffer = SourceBuffer::create(webSourceBuffer.release(), this, m_asyncEventQueue.get());
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 } 554 }
555 555
556 void MediaSource::stop() 556 void MediaSource::stop()
557 { 557 {
558 m_asyncEventQueue->close(); 558 m_asyncEventQueue->close();
559 if (!isClosed()) 559 if (!isClosed())
560 setReadyState(closedKeyword()); 560 setReadyState(closedKeyword());
561 m_webMediaSource.clear(); 561 m_webMediaSource.clear();
562 } 562 }
563 563
564 PassOwnPtr<WebSourceBuffer> MediaSource::createWebSourceBuffer(const String& typ e, const Vector<String>& codecs, ExceptionState& exceptionState) 564 PassOwnPtr<WebSourceBuffer> MediaSource::createWebSourceBuffer(const String& typ e, const String& codecs, ExceptionState& exceptionState)
565 { 565 {
566 WebSourceBuffer* webSourceBuffer = 0; 566 WebSourceBuffer* webSourceBuffer = 0;
567 567
568 switch (m_webMediaSource->addSourceBuffer(type, codecs, &webSourceBuffer)) { 568 switch (m_webMediaSource->addSourceBuffer(type, codecs, &webSourceBuffer)) {
569 case WebMediaSource::AddStatusOk: 569 case WebMediaSource::AddStatusOk:
570 return adoptPtr(webSourceBuffer); 570 return adoptPtr(webSourceBuffer);
571 case WebMediaSource::AddStatusNotSupported: 571 case WebMediaSource::AddStatusNotSupported:
572 ASSERT(!webSourceBuffer); 572 ASSERT(!webSourceBuffer);
573 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/m edia-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type 573 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/m edia-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type
574 // Step 2: If type contains a MIME type ... that is not supported with t he types 574 // Step 2: If type contains a MIME type ... that is not supported with t he types
(...skipping 23 matching lines...) Expand all
598 598
599 m_asyncEventQueue->enqueueEvent(event.release()); 599 m_asyncEventQueue->enqueueEvent(event.release());
600 } 600 }
601 601
602 URLRegistry& MediaSource::registry() const 602 URLRegistry& MediaSource::registry() const
603 { 603 {
604 return MediaSourceRegistry::registry(); 604 return MediaSourceRegistry::registry();
605 } 605 }
606 606
607 } // namespace blink 607 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/mediasource/MediaSource.h ('k') | Source/platform/ContentType.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698