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

Side by Side Diff: third_party/WebKit/Source/modules/mediacapturefromelement/HTMLMediaElementCapture.cpp

Issue 1828353002: Revert of Remove platform/NotImplemented.*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/mediacapturefromelement/HTMLMediaElementCapture.h" 5 #include "modules/mediacapturefromelement/HTMLMediaElementCapture.h"
6 6
7 #include "core/dom/ExceptionCode.h" 7 #include "core/dom/ExceptionCode.h"
8 #include "core/html/HTMLMediaElement.h" 8 #include "core/html/HTMLMediaElement.h"
9 #include "modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h" 9 #include "modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h"
10 #include "modules/encryptedmedia/MediaKeys.h" 10 #include "modules/encryptedmedia/MediaKeys.h"
11 #include "modules/mediastream/MediaStream.h" 11 #include "modules/mediastream/MediaStream.h"
12 #include "modules/mediastream/MediaStreamRegistry.h" 12 #include "modules/mediastream/MediaStreamRegistry.h"
13 #include "platform/NotImplemented.h"
13 #include "platform/mediastream/MediaStreamCenter.h" 14 #include "platform/mediastream/MediaStreamCenter.h"
14 #include "public/platform/Platform.h" 15 #include "public/platform/Platform.h"
15 #include "public/platform/WebMediaStream.h" 16 #include "public/platform/WebMediaStream.h"
16 #include "public/platform/WebMediaStreamTrack.h" 17 #include "public/platform/WebMediaStreamTrack.h"
17 18
18 namespace blink { 19 namespace blink {
19 20
20 // static 21 // static
21 MediaStream* HTMLMediaElementCapture::captureStream(HTMLMediaElement& element, E xceptionState& exceptionState) 22 MediaStream* HTMLMediaElementCapture::captureStream(HTMLMediaElement& element, E xceptionState& exceptionState)
22 { 23 {
23 if (element.currentSrc().isNull()) { 24 if (element.currentSrc().isNull()) {
24 exceptionState.throwDOMException(NotSupportedError, "The media element m ust have a source."); 25 exceptionState.throwDOMException(NotSupportedError, "The media element m ust have a source.");
25 return nullptr; 26 return nullptr;
26 } 27 }
27 28
28 // Avoid capturing from EME-protected Media Elements. 29 // Avoid capturing from EME-protected Media Elements.
29 if (HTMLMediaElementEncryptedMedia::mediaKeys(element)) { 30 if (HTMLMediaElementEncryptedMedia::mediaKeys(element)) {
30 // This exception is not defined in the spec, see https://github.com/w3c /mediacapture-fromelement/issues/20. 31 // This exception is not defined in the spec, see https://github.com/w3c /mediacapture-fromelement/issues/20.
31 exceptionState.throwDOMException(NotSupportedError, "Stream capture not supported with EME"); 32 exceptionState.throwDOMException(NotSupportedError, "Stream capture not supported with EME");
32 return nullptr; 33 return nullptr;
33 } 34 }
34 35
35 // If |element| is actually playing a MediaStream, just clone it. 36 // If |element| is actually playing a MediaStream, just clone it.
36 if (HTMLMediaElement::isMediaStreamURL(element.currentSrc().getString())) { 37 if (HTMLMediaElement::isMediaStreamURL(element.currentSrc().getString())) {
37 return MediaStream::create(element.getExecutionContext(), MediaStreamReg istry::registry().lookupMediaStreamDescriptor(element.currentSrc().getString())) ; 38 return MediaStream::create(element.getExecutionContext(), MediaStreamReg istry::registry().lookupMediaStreamDescriptor(element.currentSrc().getString())) ;
38 } 39 }
39 40
40 // TODO(mcasas): Only <video> tags are supported at the moment. 41 // TODO(mcasas): Only <video> tags are supported at the moment.
41 if (element.isHTMLAudioElement()) { 42 if (element.isHTMLAudioElement()) {
42 NOTIMPLEMENTED(); 43 notImplemented();
43 return nullptr; 44 return nullptr;
44 } 45 }
45 46
46 WebMediaStream webStream; 47 WebMediaStream webStream;
47 webStream.initialize(WebVector<WebMediaStreamTrack>(), WebVector<WebMediaStr eamTrack>()); 48 webStream.initialize(WebVector<WebMediaStreamTrack>(), WebVector<WebMediaStr eamTrack>());
48 MediaStreamCenter::instance().didCreateMediaStream(webStream); 49 MediaStreamCenter::instance().didCreateMediaStream(webStream);
49 50
50 Platform::current()->createHTMLVideoElementCapturer(&webStream, element.webM ediaPlayer()); 51 Platform::current()->createHTMLVideoElementCapturer(&webStream, element.webM ediaPlayer());
51 return MediaStream::create(element.getExecutionContext(), webStream); 52 return MediaStream::create(element.getExecutionContext(), webStream);
52 } 53 }
53 54
54 } // namespace blink 55 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698