Changeset 237642 in webkit
- Timestamp:
- Oct 31, 2018, 10:19:27 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 10 added
- 17 edited
- 4 copied
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/wpt/mediarecorder (added)
-
LayoutTests/http/wpt/mediarecorder/MediaRecorder-dataavailable-expected.txt (added)
-
LayoutTests/http/wpt/mediarecorder/MediaRecorder-dataavailable.html (added)
-
LayoutTests/http/wpt/mediarecorder/MediaRecorder-mock-dataavailable-expected.txt (added)
-
LayoutTests/http/wpt/mediarecorder/MediaRecorder-mock-dataavailable.html (added)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/BlobEvent-constructor-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-destroy-script-execution-expected.txt (added)
-
LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-destroy-script-execution.html (added)
-
LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-stop-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-stop.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/support (added)
-
LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/support/MediaRecorder-iframe.html (added)
-
LayoutTests/platform/win/TestExpectations (modified) (1 diff)
-
Source/WebCore/CMakeLists.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/mediarecorder/BlobEvent.cpp (copied) (copied from trunk/Source/WebCore/Modules/mediarecorder/BlobEvent.h ) (1 diff)
-
Source/WebCore/Modules/mediarecorder/BlobEvent.h (modified) (1 diff)
-
Source/WebCore/Modules/mediarecorder/BlobEvent.idl (modified) (1 diff)
-
Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp (modified) (8 diffs)
-
Source/WebCore/Modules/mediarecorder/MediaRecorder.h (modified) (5 diffs)
-
Source/WebCore/Modules/mediarecorder/MediaRecorder.idl (modified) (2 diffs)
-
Source/WebCore/Sources.txt (modified) (2 diffs)
-
Source/WebCore/WebCore.xcodeproj/project.pbxproj (modified) (6 diffs)
-
Source/WebCore/dom/EventNames.h (modified) (1 diff)
-
Source/WebCore/dom/EventNames.in (modified) (1 diff)
-
Source/WebCore/platform/mediarecorder (added)
-
Source/WebCore/platform/mediarecorder/MediaRecorderPrivate.h (copied) (copied from trunk/Source/WebCore/Modules/mediarecorder/BlobEvent.h ) (1 diff)
-
Source/WebCore/platform/mediarecorder/MediaRecorderPrivateMock.cpp (copied) (copied from trunk/Source/WebCore/Modules/mediarecorder/BlobEvent.h ) (1 diff)
-
Source/WebCore/platform/mediarecorder/MediaRecorderPrivateMock.h (copied) (copied from trunk/Source/WebCore/Modules/mediarecorder/BlobEvent.h ) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r237639 r237642 1 2018-10-31 YUHAN WU <yuhan_wu@apple.com> 2 3 MediaRecorder should fire dataavailable event when all tracks are ended and stop() is called 4 https://bugs.webkit.org/show_bug.cgi?id=190778 5 6 Reviewed by Youenn Fablet. 7 8 These tests are used to check if MediaRecorder can generate both video and audio buffers through mock source. 9 10 * http/wpt/mediarecorder/MediaRecorder-dataavailable-expected.txt: Added. 11 * http/wpt/mediarecorder/MediaRecorder-dataavailable.html: Added. 12 * http/wpt/mediarecorder/MediaRecorder-mock-dataavailable-expected.txt: Added. 13 * http/wpt/mediarecorder/MediaRecorder-mock-dataavailable.html: Added. 14 * platform/win/TestExpectations: 15 1 16 2018-10-31 Chris Dumez <cdumez@apple.com> 2 17 -
trunk/LayoutTests/imported/w3c/ChangeLog
r237618 r237642 1 2018-10-31 YUHAN WU <yuhan_wu@apple.com> 2 3 MediaRecorder should fire dataavailable event when all tracks are ended and stop() is called 4 https://bugs.webkit.org/show_bug.cgi?id=190778 5 6 Reviewed by Youenn Fablet. 7 8 * web-platform-tests/mediacapture-record/BlobEvent-constructor-expected.txt: 9 * web-platform-tests/mediacapture-record/MediaRecorder-destroy-script-execution-expected.txt: Added. 10 * web-platform-tests/mediacapture-record/MediaRecorder-destroy-script-execution.html: Added. 11 * web-platform-tests/mediacapture-record/MediaRecorder-stop-expected.txt: 12 * web-platform-tests/mediacapture-record/MediaRecorder-stop.html: 13 * web-platform-tests/mediacapture-record/support/MediaRecorder-iframe.html: Added. 14 1 15 2018-10-30 Chris Dumez <cdumez@apple.com> 2 16 -
trunk/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/BlobEvent-constructor-expected.txt
r236840 r237642 2 2 PASS The BlobEventInit dictionary is required 3 3 PASS The BlobEventInit dictionary's data member is required. 4 FAIL The BlobEvent instance's data attribute is set. assert_equals: expected (object) object "[object Blob]" but got (undefined) undefined 4 PASS The BlobEvent instance's data attribute is set. 5 5 -
trunk/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-stop-expected.txt
r237311 r237642 1 1 2 2 PASS MediaRecorder will stop recording and fire a stop event when all tracks are ended 3 PASS MediaRecorder will stop recording and fire a stop event when stop() is called 3 4 -
trunk/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-stop.html
r237311 r237642 30 30 assert_equals(recorder.state, "recording", "MediaRecorder has been started successfully"); 31 31 video.getVideoTracks()[0].stop(); 32 }, "MediaRecorder will stop recording and fire a stop event when all tracks are ended", { timeout: 10000 }); 32 }, "MediaRecorder will stop recording and fire a stop event when all tracks are ended"); 33 34 async_test(t => { 35 let video = createVideoStream(); 36 let recorder = new MediaRecorder(video); 37 recorder.onstop = t.step_func(errorEvent => { 38 assert_equals(errorEvent.type, 'stop', 'the error type should be stop'); 39 assert_true(errorEvent.isTrusted, 'isTrusted should be true when the event is created by C++'); 40 assert_equals(recorder.state, "inactive", "MediaRecorder has been stopped when stop() is called"); 41 t.done(); 42 }); 43 recorder.start(); 44 assert_equals(recorder.state, "recording", "MediaRecorder has been started successfully"); 45 recorder.stop(); 46 assert_equals(recorder.state, "recording", "State should remain the same until stop event is fired"); 47 }, "MediaRecorder will stop recording and fire a stop event when stop() is called"); 33 48 </script> 34 49 </body> -
trunk/LayoutTests/platform/win/TestExpectations
r237279 r237642 4223 4223 4224 4224 # MediaRecorder is not enabled on Windows 4225 imported/w3c/web-platform-tests/mediacapture-record/BlobEvent-constructor.html [ Skip ] 4226 imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-constructor.html [ Skip ] 4225 imported/w3c/web-platform-tests/mediacapture-record [ Skip ] 4227 4226 fast/mediacapturefromelement/CanvasCaptureMediaStream-imagebitmaprenderingcontext.html [ Skip ] 4227 http/wpt/mediarecorder [ Skip ] 4228 4228 4229 4229 webkit.org/b/190472 fast/forms/fieldset/fieldset-elements-htmlcollection.html [ Failure ] -
trunk/Source/WebCore/CMakeLists.txt
r237344 r237642 114 114 "${WEBCORE_DIR}/platform/graphics/opentype" 115 115 "${WEBCORE_DIR}/platform/graphics/transforms" 116 "${WEBCORE_DIR}/platform/mediarecorder" 116 117 "${WEBCORE_DIR}/platform/mediastream" 117 118 "${WEBCORE_DIR}/platform/mediastream/libwebrtc" -
trunk/Source/WebCore/ChangeLog
r237637 r237642 1 2018-10-31 YUHAN WU <yuhan_wu@apple.com> 2 3 MediaRecorder should fire dataavailable event when all tracks are ended and stop() is called 4 https://bugs.webkit.org/show_bug.cgi?id=190778 5 6 Reviewed by Youenn Fablet. 7 8 Implement JavaScript dispatch event dataavailable and JavaScript exposed method stop(). 9 Implement a mock string as the output buffer of MediaRecorder. 10 Remove the declaration of timecode in BlobEvent since it has not been implemented in MediaRecorder and MediaRecorderPrivate. 11 12 Tests: http/wpt/mediarecorder/MediaRecorder-dataavailable.html 13 http/wpt/mediarecorder/MediaRecorder-mock-dataavailable.html 14 imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-destroy-script-execution.html 15 imported/w3c/web-platform-tests/mediacapture-record/support/MediaRecorder-iframe.html 16 17 * CMakeLists.txt: 18 * Modules/mediarecorder/BlobEvent.cpp: Added. 19 (WebCore::BlobEvent::create): 20 (WebCore::BlobEvent::BlobEvent): 21 (WebCore::BlobEvent::eventInterface const): 22 * Modules/mediarecorder/BlobEvent.h: 23 * Modules/mediarecorder/BlobEvent.idl: 24 * Modules/mediarecorder/MediaRecorder.cpp: 25 (WebCore::MediaRecorder::MediaRecorder): 26 (WebCore::MediaRecorder::~MediaRecorder): 27 (WebCore::MediaRecorder::stop): 28 (WebCore::MediaRecorder::startRecording): 29 (WebCore::MediaRecorder::stopRecording): 30 (WebCore::MediaRecorder::stopRecordingInternal): 31 (WebCore::MediaRecorder::didAddOrRemoveTrack): 32 (WebCore::MediaRecorder::trackEnded): 33 (WebCore::MediaRecorder::sampleBufferUpdated): 34 (WebCore::MediaRecorder::audioSamplesAvailable): 35 (WebCore::MediaRecorder::scheduleDeferredTask): 36 * Modules/mediarecorder/MediaRecorder.h: 37 * Modules/mediarecorder/MediaRecorder.idl: 38 * Sources.txt: 39 * WebCore.xcodeproj/project.pbxproj: 40 * dom/EventNames.h: 41 * dom/EventNames.in: 42 * platform/mediarecorder/MediaRecorderPrivate.h: Added. 43 * platform/mediarecorder/MediaRecorderPrivateMock.cpp: Added. 44 (WebCore::MediaRecorderPrivateMock::sampleBufferUpdated): 45 (WebCore::MediaRecorderPrivateMock::audioSamplesAvailable): 46 (WebCore::MediaRecorderPrivateMock::generateMockString): 47 (WebCore::MediaRecorderPrivateMock::fetchData): 48 * platform/mediarecorder/MediaRecorderPrivateMock.h: Added. 49 1 50 2018-10-31 Claudio Saavedra <csaavedra@igalia.com> 2 51 -
trunk/Source/WebCore/Modules/mediarecorder/BlobEvent.cpp
r237641 r237642 23 23 */ 24 24 25 #pragma once 25 26 #include "config.h" 27 #include "BlobEvent.h" 26 28 27 29 #if ENABLE(MEDIA_STREAM) 28 30 29 #include " Event.h"31 #include "Blob.h" 30 32 31 33 namespace WebCore { 34 35 Ref<BlobEvent> BlobEvent::create(const AtomicString& type, Init&& init, IsTrusted isTrusted) 36 { 37 return adoptRef(*new BlobEvent(type, WTFMove(init), isTrusted)); 38 } 39 40 Ref<BlobEvent> BlobEvent::create(const AtomicString& type, CanBubble canBubble, IsCancelable isCancelable, Ref<Blob>&& data) 41 { 42 return adoptRef(*new BlobEvent(type, canBubble, isCancelable, WTFMove(data))); 43 } 44 45 BlobEvent::BlobEvent(const AtomicString& type, Init&& init, IsTrusted isTrusted) 46 : Event(type, init, isTrusted) 47 , m_blob(init.data.releaseNonNull()) 48 { 49 } 50 51 BlobEvent::BlobEvent(const AtomicString& type, CanBubble canBubble, IsCancelable isCancelable, Ref<Blob>&& data) 52 : Event(type, canBubble, isCancelable) 53 , m_blob(WTFMove(data)) 54 { 55 } 32 56 33 class Blob; 34 35 class BlobEvent final : public Event { 36 public: 37 struct Init : EventInit { 38 RefPtr<Blob> data; 39 double timecode; 40 }; 41 42 static Ref<BlobEvent> create(const AtomicString& type, Init&& init, IsTrusted isTrusted = IsTrusted::No) 43 { 44 return adoptRef(*new BlobEvent(type, WTFMove(init), isTrusted)); 45 } 57 EventInterface BlobEvent::eventInterface() const 58 { 59 return BlobEventInterfaceType; 60 } 46 61 47 private:48 BlobEvent(const AtomicString& type, Init&& init, IsTrusted isTrusted)49 : Event(type, WTFMove(init), isTrusted)50 {51 }52 };53 54 62 } // namespace WebCore 55 63 -
trunk/Source/WebCore/Modules/mediarecorder/BlobEvent.h
r236840 r237642 40 40 }; 41 41 42 static Ref<BlobEvent> create(const AtomicString& type, Init&& init, IsTrusted isTrusted = IsTrusted::No) 43 { 44 return adoptRef(*new BlobEvent(type, WTFMove(init), isTrusted)); 45 } 42 static Ref<BlobEvent> create(const AtomicString&, Init&&, IsTrusted = IsTrusted::No); 43 static Ref<BlobEvent> create(const AtomicString&, CanBubble, IsCancelable, Ref<Blob>&&); 46 44 45 Blob& data() const { return m_blob.get(); } 46 47 47 private: 48 BlobEvent(const AtomicString& type, Init&& init, IsTrusted isTrusted) 49 : Event(type, WTFMove(init), isTrusted) 50 { 51 } 48 BlobEvent(const AtomicString&, Init&&, IsTrusted); 49 BlobEvent(const AtomicString&, CanBubble, IsCancelable, Ref<Blob>&&); 50 51 // Event 52 EventInterface eventInterface() const final; 53 54 Ref<Blob> m_blob; 52 55 }; 53 56 -
trunk/Source/WebCore/Modules/mediarecorder/BlobEvent.idl
r236840 r237642 32 32 ] interface BlobEvent : Event { 33 33 // FIXME: Implement these: 34 //[SameObject] readonly attribute Blob data;34 [SameObject] readonly attribute Blob data; 35 35 // readonly attribute DOMHighResTimeStamp timecode; 36 36 }; -
trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp
r237311 r237642 29 29 #if ENABLE(MEDIA_STREAM) 30 30 31 #include "Blob.h" 32 #include "BlobEvent.h" 31 33 #include "Document.h" 32 34 #include "EventNames.h" 33 35 #include "MediaRecorderErrorEvent.h" 36 #include "MediaRecorderPrivateMock.h" 34 37 35 38 namespace WebCore { … … 46 49 , m_options(WTFMove(option)) 47 50 , m_stream(WTFMove(stream)) 51 , m_private(makeUniqueRef<MediaRecorderPrivateMock>()) // FIXME: we will need to decide which MediaRecorderPrivate instance to create based on the mock enabled feature flag 48 52 { 49 m_tracks = WTF::map(m_stream->getTracks(), [this] (const auto& track) -> Ref<MediaStreamTrackPrivate> { 50 auto& privateTrack = track->privateTrack(); 51 privateTrack.addObserver(*this); 52 return privateTrack; 53 m_tracks = WTF::map(m_stream->getTracks(), [] (auto&& track) -> Ref<MediaStreamTrackPrivate> { 54 return track->privateTrack(); 53 55 }); 54 56 m_stream->addObserver(this); … … 58 60 { 59 61 m_stream->removeObserver(this); 60 for (auto& track : m_tracks) 61 track->removeObserver(*this); 62 stopRecordingInternal(); 62 63 } 63 64 … … 65 66 { 66 67 m_isActive = false; 68 stopRecordingInternal(); 67 69 } 68 70 … … 77 79 } 78 80 79 ExceptionOr<void> MediaRecorder::start (std::optional<int> timeslice)81 ExceptionOr<void> MediaRecorder::startRecording(std::optional<int> timeslice) 80 82 { 81 83 UNUSED_PARAM(timeslice); … … 83 85 return Exception { InvalidStateError, "The MediaRecorder's state must be inactive in order to start recording"_s }; 84 86 87 for (auto& track : m_tracks) 88 track->addObserver(*this); 89 85 90 m_state = RecordingState::Recording; 86 91 return { }; 92 } 93 94 ExceptionOr<void> MediaRecorder::stopRecording() 95 { 96 if (state() == RecordingState::Inactive) 97 return Exception { InvalidStateError, "The MediaRecorder's state cannot be inactive"_s }; 98 99 scheduleDeferredTask([this] { 100 if (!m_isActive || state() == RecordingState::Inactive) 101 return; 102 103 stopRecordingInternal(); 104 ASSERT(m_state == RecordingState::Inactive); 105 dispatchEvent(BlobEvent::create(eventNames().dataavailableEvent, Event::CanBubble::No, Event::IsCancelable::No, m_private->fetchData())); 106 if (!m_isActive) 107 return; 108 dispatchEvent(Event::create(eventNames().stopEvent, Event::CanBubble::No, Event::IsCancelable::No)); 109 }); 110 return { }; 111 } 112 113 void MediaRecorder::stopRecordingInternal() 114 { 115 if (state() != RecordingState::Recording) 116 return; 117 118 for (auto& track : m_tracks) 119 track->removeObserver(*this); 120 121 m_state = RecordingState::Inactive; 87 122 } 88 123 … … 104 139 if (position != notFound) 105 140 return; 106 scheduleDeferredTask([this] { 107 if (!m_isActive || state() == RecordingState::Inactive) 108 return; 109 // FIXME: Add a dataavailable event 110 auto event = Event::create(eventNames().stopEvent, Event::CanBubble::No, Event::IsCancelable::No); 111 setNewRecordingState(RecordingState::Inactive, WTFMove(event)); 112 }); 141 142 stopRecording(); 143 } 144 145 void MediaRecorder::sampleBufferUpdated(MediaStreamTrackPrivate& track, MediaSample& mediaSample) 146 { 147 m_private->sampleBufferUpdated(track, mediaSample); 148 } 149 150 void MediaRecorder::audioSamplesAvailable(MediaStreamTrackPrivate& track, const MediaTime& mediaTime, const PlatformAudioData& audioData, const AudioStreamDescription& description, size_t sampleCount) 151 { 152 m_private->audioSamplesAvailable(track, mediaTime, audioData, description, sampleCount); 113 153 } 114 154 … … 125 165 if (!scriptExecutionContext) 126 166 return; 127 scriptExecutionContext->postTask([weakThis = makeWeakPtr(*this), function = WTFMove(function)] (auto&) { 128 if (!weakThis) 129 return; 130 167 scriptExecutionContext->postTask([protectedThis = makeRef(*this), function = WTFMove(function)] (auto&) { 131 168 function(); 132 169 }); -
trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.h
r237311 r237642 26 26 27 27 #if ENABLE(MEDIA_STREAM) 28 28 29 #include "ActiveDOMObject.h" 29 30 #include "EventTarget.h" 30 31 #include "MediaStream.h" 31 32 #include "MediaStreamTrackPrivate.h" 33 #include <wtf/UniqueRef.h> 32 34 33 35 namespace WebCore { 34 36 35 37 class Document; 38 class MediaRecorderPrivate; 36 39 37 40 class MediaRecorder final … … 61 64 using RefCounted::deref; 62 65 63 ExceptionOr<void> start(std::optional<int>); 66 ExceptionOr<void> startRecording(std::optional<int>); 67 ExceptionOr<void> stopRecording(); 64 68 65 69 private: … … 77 81 bool canSuspendForDocumentSuspension() const final; 78 82 83 void stopRecordingInternal(); 84 79 85 // MediaStream::Observer 80 86 void didAddOrRemoveTrack() final; … … 85 91 void trackSettingsChanged(MediaStreamTrackPrivate&) final { }; 86 92 void trackEnabledChanged(MediaStreamTrackPrivate&) final { }; 93 void sampleBufferUpdated(MediaStreamTrackPrivate&, MediaSample&) final; 94 void audioSamplesAvailable(MediaStreamTrackPrivate&, const MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) final; 87 95 88 96 void scheduleDeferredTask(Function<void()>&&); … … 91 99 Options m_options; 92 100 Ref<MediaStream> m_stream; 101 UniqueRef<MediaRecorderPrivate> m_private; 93 102 RecordingState m_state { RecordingState::Inactive }; 94 103 Vector<Ref<MediaStreamTrackPrivate>> m_tracks; -
trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.idl
r237311 r237642 39 39 // attribute EventHandler onstart; 40 40 attribute EventHandler onstop; 41 //attribute EventHandler ondataavailable;41 attribute EventHandler ondataavailable; 42 42 // attribute EventHandler onpause; 43 43 // attribute EventHandler onresume; … … 46 46 // readonly attribute unsigned long audioBitsPerSecond; 47 47 48 [MayThrowException ] void start(optional long timeslice);49 //void stop();48 [MayThrowException, ImplementedAs=startRecording] void start(optional long timeslice); 49 [ImplementedAs=stopRecording] void stop(); 50 50 // void pause(); 51 51 // void resume(); -
trunk/Source/WebCore/Sources.txt
r237631 r237642 141 141 Modules/mediacontrols/MediaControlsHost.cpp 142 142 143 Modules/mediarecorder/BlobEvent.cpp 143 144 Modules/mediarecorder/MediaRecorder.cpp 144 145 Modules/mediarecorder/MediaRecorderErrorEvent.cpp … … 1767 1768 1768 1769 platform/mediacapabilities/MediaEngineConfigurationFactory.cpp 1770 1771 platform/mediarecorder/MediaRecorderPrivateMock.cpp 1769 1772 1770 1773 platform/mediastream/CaptureDeviceManager.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r237636 r237642 1361 1361 4D3B00AB215D69A70076B983 /* MediaRecorder.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D3B00A9215D69A70076B983 /* MediaRecorder.h */; }; 1362 1362 4D3B00AF215D6A690076B983 /* BlobEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D3B00AD215D6A690076B983 /* BlobEvent.h */; }; 1363 4D3B5016217E58B700665DB1 /* MediaRecorderPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D3B5014217E58B700665DB1 /* MediaRecorderPrivate.h */; }; 1363 1364 4DB7130D216ECB4D0096A4DD /* MediaRecorderErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DB7130C216EC2BD0096A4DD /* MediaRecorderErrorEvent.h */; }; 1364 1365 4E1959220A39DABA00220FE5 /* MediaFeatureNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959200A39DABA00220FE5 /* MediaFeatureNames.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 7921 7922 4D3B00A9215D69A70076B983 /* MediaRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaRecorder.h; sourceTree = "<group>"; }; 7922 7923 4D3B00AD215D6A690076B983 /* BlobEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobEvent.h; sourceTree = "<group>"; }; 7924 4D3B5014217E58B700665DB1 /* MediaRecorderPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaRecorderPrivate.h; sourceTree = "<group>"; }; 7925 4D7EB3F4217C6AE600D64888 /* BlobEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = BlobEvent.cpp; sourceTree = "<group>"; }; 7926 4D9F6B642182532B0092A9C5 /* MediaRecorderPrivateMock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaRecorderPrivateMock.h; sourceTree = "<group>"; }; 7927 4D9F6B652182532B0092A9C5 /* MediaRecorderPrivateMock.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MediaRecorderPrivateMock.cpp; sourceTree = "<group>"; }; 7923 7928 4DB7130A216EC2BC0096A4DD /* MediaRecorderErrorEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaRecorderErrorEvent.idl; sourceTree = "<group>"; }; 7924 7929 4DB7130C216EC2BD0096A4DD /* MediaRecorderErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaRecorderErrorEvent.h; sourceTree = "<group>"; }; … … 18038 18043 isa = PBXGroup; 18039 18044 children = ( 18045 4D7EB3F4217C6AE600D64888 /* BlobEvent.cpp */, 18040 18046 4D3B00AD215D6A690076B983 /* BlobEvent.h */, 18041 18047 4D3B00A6215D645B0076B983 /* BlobEvent.idl */, … … 18046 18052 4DB7130C216EC2BD0096A4DD /* MediaRecorderErrorEvent.h */, 18047 18053 4DB7130A216EC2BC0096A4DD /* MediaRecorderErrorEvent.idl */, 18054 ); 18055 path = mediarecorder; 18056 sourceTree = "<group>"; 18057 }; 18058 4D3B5012217E58A300665DB1 /* mediarecorder */ = { 18059 isa = PBXGroup; 18060 children = ( 18061 4D3B5014217E58B700665DB1 /* MediaRecorderPrivate.h */, 18062 4D9F6B652182532B0092A9C5 /* MediaRecorderPrivateMock.cpp */, 18063 4D9F6B642182532B0092A9C5 /* MediaRecorderPrivateMock.h */, 18048 18064 ); 18049 18065 path = mediarecorder; … … 24832 24848 6582A14809999D6C00BEEB6D /* mac */, 24833 24849 9AC6F02021148F1E00CBDA06 /* mediacapabilities */, 24850 4D3B5012217E58A300665DB1 /* mediarecorder */, 24834 24851 C96F5EBF1B5872260091EA9D /* mediasession */, 24835 24852 07221B9217CF0AD400848E51 /* mediastream */, … … 29946 29963 4D3B00AB215D69A70076B983 /* MediaRecorder.h in Headers */, 29947 29964 4DB7130D216ECB4D0096A4DD /* MediaRecorderErrorEvent.h in Headers */, 29965 4D3B5016217E58B700665DB1 /* MediaRecorderPrivate.h in Headers */, 29948 29966 C90843D01B18E47D00B68564 /* MediaRemoteControls.h in Headers */, 29949 29967 CD8ACA8F1D23971900ECC59E /* MediaRemoteSoftLink.h in Headers */, -
trunk/Source/WebCore/dom/EventNames.h
r237311 r237642 102 102 macro(cuechange) \ 103 103 macro(cut) \ 104 macro(dataavailable) \ 104 105 macro(datachannel) \ 105 106 macro(dblclick) \ -
trunk/Source/WebCore/dom/EventNames.in
r237106 r237642 48 48 ApplePayValidateMerchantEvent conditional=APPLE_PAY 49 49 AudioProcessingEvent conditional=WEB_AUDIO 50 BlobEvent conditional=MEDIA_STREAM 50 51 OfflineAudioCompletionEvent conditional=WEB_AUDIO 51 52 MediaRecorderErrorEvent conditional=MEDIA_STREAM -
trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivate.h
r237641 r237642 27 27 #if ENABLE(MEDIA_STREAM) 28 28 29 #include "Event.h" 29 namespace WTF { 30 class MediaTime; 31 } 30 32 31 33 namespace WebCore { 34 35 class AudioStreamDescription; 36 class Blob; 37 class PlatformAudioData; 38 class MediaSample; 39 class MediaStreamTrackPrivate; 40 41 class MediaRecorderPrivate { 42 public: 43 virtual void sampleBufferUpdated(MediaStreamTrackPrivate&, MediaSample&) = 0; 44 virtual void audioSamplesAvailable(MediaStreamTrackPrivate&, const WTF::MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) = 0; 32 45 33 class Blob; 34 35 class BlobEvent final : public Event { 36 public: 37 struct Init : EventInit { 38 RefPtr<Blob> data; 39 double timecode; 40 }; 41 42 static Ref<BlobEvent> create(const AtomicString& type, Init&& init, IsTrusted isTrusted = IsTrusted::No) 43 { 44 return adoptRef(*new BlobEvent(type, WTFMove(init), isTrusted)); 45 } 46 47 private: 48 BlobEvent(const AtomicString& type, Init&& init, IsTrusted isTrusted) 49 : Event(type, WTFMove(init), isTrusted) 50 { 51 } 46 virtual Ref<Blob> fetchData() = 0; 47 virtual ~MediaRecorderPrivate() = default; 52 48 }; 53 49 -
trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivateMock.cpp
r237641 r237642 23 23 */ 24 24 25 #pragma once 25 26 #include "config.h" 27 #include "MediaRecorderPrivateMock.h" 26 28 27 29 #if ENABLE(MEDIA_STREAM) 28 30 29 #include "Event.h" 31 #include "Blob.h" 32 #include "MediaStreamTrackPrivate.h" 30 33 31 34 namespace WebCore { 32 33 class Blob;34 35 class BlobEvent final : public Event {36 public:37 struct Init : EventInit {38 RefPtr<Blob> data;39 double timecode;40 };41 42 static Ref<BlobEvent> create(const AtomicString& type, Init&& init, IsTrusted isTrusted = IsTrusted::No)43 {44 return adoptRef(*new BlobEvent(type, WTFMove(init), isTrusted));45 }46 35 47 private: 48 BlobEvent(const AtomicString& type, Init&& init, IsTrusted isTrusted) 49 : Event(type, WTFMove(init), isTrusted) 50 { 51 } 52 }; 53 36 void MediaRecorderPrivateMock::sampleBufferUpdated(MediaStreamTrackPrivate& track, MediaSample&) 37 { 38 generateMockString(track); 39 } 40 41 void MediaRecorderPrivateMock::audioSamplesAvailable(MediaStreamTrackPrivate& track, const WTF::MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) 42 { 43 generateMockString(track); 44 } 45 46 void MediaRecorderPrivateMock::generateMockString(MediaStreamTrackPrivate& track) 47 { 48 auto locker = holdLock(m_bufferLock); 49 if (track.type() == RealtimeMediaSource::Type::Audio) 50 m_buffer.append("Audio Track ID: "); 51 else 52 m_buffer.append("Video Track ID: "); 53 m_buffer.append(track.id()); 54 m_buffer.append(" Counter: "); 55 m_buffer.appendNumber(++m_counter); 56 m_buffer.append("\r\n---------\r\n"); 57 } 58 59 Ref<Blob> MediaRecorderPrivateMock::fetchData() 60 { 61 auto locker = holdLock(m_bufferLock); 62 Vector<uint8_t> value(m_buffer.length()); 63 memcpy(value.data(), m_buffer.characters8(), m_buffer.length()); 64 m_buffer.clear(); 65 return Blob::create(WTFMove(value), "text/plain"); 66 } 67 54 68 } // namespace WebCore 55 69 -
trunk/Source/WebCore/platform/mediarecorder/MediaRecorderPrivateMock.h
r237641 r237642 27 27 #if ENABLE(MEDIA_STREAM) 28 28 29 #include "Event.h" 29 #include "MediaRecorderPrivate.h" 30 #include <wtf/Lock.h> 31 #include <wtf/text/StringBuilder.h> 30 32 31 33 namespace WebCore { 34 35 class Blob; 36 class MediaStreamTrackPrivate; 37 38 class MediaRecorderPrivateMock final : public MediaRecorderPrivate { 39 private: 40 void sampleBufferUpdated(MediaStreamTrackPrivate&, MediaSample&) final; 41 void audioSamplesAvailable(MediaStreamTrackPrivate&, const WTF::MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) final; 42 Ref<Blob> fetchData() final; 32 43 33 class Blob; 34 35 class BlobEvent final : public Event { 36 public: 37 struct Init : EventInit { 38 RefPtr<Blob> data; 39 double timecode; 40 }; 41 42 static Ref<BlobEvent> create(const AtomicString& type, Init&& init, IsTrusted isTrusted = IsTrusted::No) 43 { 44 return adoptRef(*new BlobEvent(type, WTFMove(init), isTrusted)); 45 } 44 void generateMockString(MediaStreamTrackPrivate&); 46 45 47 private: 48 BlobEvent(const AtomicString& type, Init&& init, IsTrusted isTrusted) 49 : Event(type, WTFMove(init), isTrusted) 50 { 51 } 46 mutable Lock m_bufferLock; 47 StringBuilder m_buffer; 48 unsigned m_counter { 0 }; 52 49 }; 53 50 54 51 } // namespace WebCore 55 52
Note:
See TracChangeset
for help on using the changeset viewer.