⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 263651 in webkit


Ignore:
Timestamp:
Jun 29, 2020, 3:10:01 AM (6 years ago)
Author:
youenn@apple.com
Message:

MediaRecorder.start() Method is Ignoring the "timeslice" Parameter
https://bugs.webkit.org/show_bug.cgi?id=202233
<rdar://problem/55720555>

Reviewed by Eric Carlson.

Source/WebCore:

Use a timer to implement timeSlice parameter.
Schedule timer either when start is called or as part of requestData callback.
This should ensure that, if requestData is called by the application, the timer will be rescheduled appropriately.

Test: http/wpt/mediarecorder/MediaRecorder-start-timeSlice.html

  • Modules/mediarecorder/MediaRecorder.cpp:

(WebCore::MediaRecorder::MediaRecorder):
(WebCore::MediaRecorder::startRecording):
(WebCore::MediaRecorder::requestData):

  • Modules/mediarecorder/MediaRecorder.h:

LayoutTests:

  • http/wpt/mediarecorder/MediaRecorder-start-timeSlice-expected.txt: Added.
  • http/wpt/mediarecorder/MediaRecorder-start-timeSlice.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r263650 r263651  
     12020-06-29  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
    1122020-06-29  Zan Dobersek  <zdobersek@igalia.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r263647 r263651  
     12020-06-29  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
    1212020-06-29  Rob Buis  <rbuis@igalia.com>
    222
  • trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp

    r263633 r263651  
    8484    , m_options(WTFMove(option))
    8585    , m_stream(WTFMove(stream))
     86    , m_timeSliceTimer([this] { requestData(); })
    8687{
    8788    m_tracks = WTF::map(m_stream->getTracks(), [] (auto&& track) -> Ref<MediaStreamTrackPrivate> {
     
    126127}
    127128
    128 ExceptionOr<void> MediaRecorder::startRecording(Optional<int> timeslice)
    129 {
    130     UNUSED_PARAM(timeslice);
     129ExceptionOr<void> MediaRecorder::startRecording(Optional<int> timeSlice)
     130{
    131131    if (!m_isActive)
    132132        return Exception { InvalidStateError, "The MediaRecorder is not active"_s };
     
    153153
    154154    m_state = RecordingState::Recording;
     155    m_timeSlice = timeSlice;
     156    if (m_timeSlice)
     157        m_timeSliceTimer.startOneShot(Seconds::fromMilliseconds(*m_timeSlice));
    155158    return { };
    156159}
     
    182185        return Exception { InvalidStateError, "The MediaRecorder's state cannot be inactive"_s };
    183186
     187    if (m_timeSliceTimer.isActive())
     188        m_timeSliceTimer.stop();
    184189    m_private->fetchData([this, pendingActivity = makePendingActivity(*this)](auto&& buffer, auto& mimeType) {
    185190        queueTaskKeepingObjectAlive(*this, TaskSource::Networking, [this, buffer = WTFMove(buffer), mimeType]() mutable {
     
    188193
    189194            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));
    190198        });
    191199    });
  • trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.h

    r263633 r263651  
    3131#include "MediaStream.h"
    3232#include "MediaStreamTrackPrivate.h"
     33#include "Timer.h"
    3334#include <wtf/UniqueRef.h>
    3435
     
    117118    RecordingState m_state { RecordingState::Inactive };
    118119    Vector<Ref<MediaStreamTrackPrivate>> m_tracks;
     120    Optional<int> m_timeSlice;
     121    Timer m_timeSliceTimer;
    119122   
    120123    bool m_isActive { true };
Note: See TracChangeset for help on using the changeset viewer.