Changeset 263892 in webkit
- Timestamp:
- Jul 3, 2020 5:58:24 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r263891 r263892 1 2020-07-03 Youenn Fablet <youenn@apple.com> 2 3 MediaRecorder.start() Method is Ignoring the "timeslice" Parameter 4 https://bugs.webkit.org/show_bug.cgi?id=202233 5 <rdar://problem/55720555> 6 7 Reviewed by Eric Carlson. 8 9 * http/wpt/mediarecorder/MediaRecorder-start-timeSlice-expected.txt: Added. 10 * http/wpt/mediarecorder/MediaRecorder-start-timeSlice.html: Added. 11 1 12 2020-07-03 Youenn Fablet <youenn@apple.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r263891 r263892 1 2020-07-03 Youenn Fablet <youenn@apple.com> 2 3 MediaRecorder.start() Method is Ignoring the "timeslice" Parameter 4 https://bugs.webkit.org/show_bug.cgi?id=202233 5 <rdar://problem/55720555> 6 7 Reviewed by Eric Carlson. 8 9 Use a timer to implement timeSlice parameter. 10 Schedule timer either when start is called or as part of requestData callback. 11 This should ensure that, if requestData is called by the application, the timer will be rescheduled appropriately. 12 13 Test: http/wpt/mediarecorder/MediaRecorder-start-timeSlice.html 14 15 * Modules/mediarecorder/MediaRecorder.cpp: 16 (WebCore::MediaRecorder::MediaRecorder): 17 (WebCore::MediaRecorder::startRecording): 18 (WebCore::MediaRecorder::requestData): 19 * Modules/mediarecorder/MediaRecorder.h: 20 1 21 2020-07-03 Youenn Fablet <youenn@apple.com> 2 22 -
trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp
r263891 r263892 84 84 , m_options(WTFMove(option)) 85 85 , m_stream(WTFMove(stream)) 86 , m_timeSliceTimer([this] { requestData(); }) 86 87 { 87 88 m_tracks = WTF::map(m_stream->getTracks(), [] (auto&& track) -> Ref<MediaStreamTrackPrivate> { … … 126 127 } 127 128 128 ExceptionOr<void> MediaRecorder::startRecording(Optional<int> timeslice) 129 { 130 UNUSED_PARAM(timeslice); 129 ExceptionOr<void> MediaRecorder::startRecording(Optional<int> timeSlice) 130 { 131 131 if (!m_isActive) 132 132 return Exception { InvalidStateError, "The MediaRecorder is not active"_s }; … … 153 153 154 154 m_state = RecordingState::Recording; 155 m_timeSlice = timeSlice; 156 if (m_timeSlice) 157 m_timeSliceTimer.startOneShot(Seconds::fromMilliseconds(*m_timeSlice)); 155 158 return { }; 156 159 } … … 182 185 return Exception { InvalidStateError, "The MediaRecorder's state cannot be inactive"_s }; 183 186 187 if (m_timeSliceTimer.isActive()) 188 m_timeSliceTimer.stop(); 184 189 m_private->fetchData([this, pendingActivity = makePendingActivity(*this)](auto&& buffer, auto& mimeType) { 185 190 queueTaskKeepingObjectAlive(*this, TaskSource::Networking, [this, buffer = WTFMove(buffer), mimeType]() mutable { … … 188 193 189 194 dispatchEvent(BlobEvent::create(eventNames().dataavailableEvent, Event::CanBubble::No, Event::IsCancelable::No, buffer ? Blob::create(buffer.releaseNonNull(), mimeType) : Blob::create())); 195 196 if (m_timeSlice) 197 m_timeSliceTimer.startOneShot(Seconds::fromMilliseconds(*m_timeSlice)); 190 198 }); 191 199 }); -
trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.h
r263891 r263892 31 31 #include "MediaStream.h" 32 32 #include "MediaStreamTrackPrivate.h" 33 #include "Timer.h" 33 34 #include <wtf/UniqueRef.h> 34 35 … … 117 118 RecordingState m_state { RecordingState::Inactive }; 118 119 Vector<Ref<MediaStreamTrackPrivate>> m_tracks; 120 Optional<int> m_timeSlice; 121 Timer m_timeSliceTimer; 119 122 120 123 bool m_isActive { true };
Note: See TracChangeset
for help on using the changeset viewer.