[webkit-changes] [WebKit/WebKit] f44730: MediaRecorderPrivateWriterWebM should be running i...
Jean-Yves Avenard
noreply at github.com
Tue Oct 15 15:21:56 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f447304fe0efb069b90eeec9d0940ac05f661792
https://github.com/WebKit/WebKit/commit/f447304fe0efb069b90eeec9d0940ac05f661792
Author: Jean-Yves Avenard <jya at apple.com>
Date: 2024-10-15 (Tue, 15 Oct 2024)
Changed paths:
M Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterWebM.h
M Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterWebM.mm
M Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderProvider.cpp
Log Message:
-----------
MediaRecorderPrivateWriterWebM should be running in the content process.
https://bugs.webkit.org/show_bug.cgi?id=281370
rdar://137795763
Reviewed by Youenn Fablet.
We create the MediaRecorderPrivate in the content process if webm was requested.
When running in the content process, MediaRecorderPrivateWriterWebM::appendAudioSampleBuffer
will be called on the audio thread and MediaRecorderPrivateWriterWebM::appendVideoFrame will
be called on the video capture thread. So we have to make those both methods thread-safe.
To achieve this goal we now run the MediaRecorderPrivateWriterWebM on its own work queue.
Using the main thread was no longer suitable as we want the writer to operate even when
the main thread is blocked to avoid losing data.
We could have made the threading management controlled by the MediaRecorderPrivate instead
but it would have required more extensive changes, so we limit it to WebM only for now.
For appendVideoFrame we simply forward the video frame to this WorkQueue,
for appendAudioSampleBuffer the data structure received isn't ref-counted
we must as such create the CMSampleBuffer on the audio thread and then forward it to the workqueue.
This is similar to what the WebKit::MediaRecorderPrivate is doing before sending the data to
the GPU process.
* Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterWebM.h:
* Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterWebM.mm:
(WebCore::MediaRecorderPrivateWriterWebM::MediaRecorderPrivateWriterWebM):
(WebCore::MediaRecorderPrivateWriterWebM::close):
(WebCore::MediaRecorderPrivateWriterWebM::compressedAudioOutputBufferCallback):
(WebCore::MediaRecorderPrivateWriterWebM::initialize):
(WebCore::MediaRecorderPrivateWriterWebM::enqueueCompressedAudioSampleBuffers):
(WebCore::MediaRecorderPrivateWriterWebM::maybeStartWriting):
(WebCore::MediaRecorderPrivateWriterWebM::appendVideoFrame):
(WebCore::MediaRecorderPrivateWriterWebM::nextVideoFrameTime const):
(WebCore::MediaRecorderPrivateWriterWebM::resumeVideoTime const):
(WebCore::MediaRecorderPrivateWriterWebM::encodePendingVideoFrames):
(WebCore::MediaRecorderPrivateWriterWebM::appendAudioSampleBuffer):
(WebCore::MediaRecorderPrivateWriterWebM::flushEncodedQueues):
(WebCore::MediaRecorderPrivateWriterWebM::partiallyFlushEncodedQueues):
(WebCore::MediaRecorderPrivateWriterWebM::muxNextFrame):
(WebCore::MediaRecorderPrivateWriterWebM::stopRecording):
(WebCore::MediaRecorderPrivateWriterWebM::fetchData):
(WebCore::MediaRecorderPrivateWriterWebM::flushPendingData):
(WebCore::MediaRecorderPrivateWriterWebM::appendData):
(WebCore::MediaRecorderPrivateWriterWebM::flushDataBuffer):
(WebCore::MediaRecorderPrivateWriterWebM::takeData):
(WebCore::MediaRecorderPrivateWriterWebM::pause):
(WebCore::MediaRecorderPrivateWriterWebM::resume):
(WebCore::MediaRecorderPrivateWriterWebM::mimeType const):
(WebCore::MediaRecorderPrivateWriterWebM::audioBitRate const):
(WebCore::MediaRecorderPrivateWriterWebM::videoBitRate const):
(WebCore::MediaRecorderPrivateWriterWebM::maybeForceNewCluster):
(WebCore::MediaRecorderPrivateWriterWebM::workQueue const):
(WebCore::MediaRecorderPrivateWriterWebM::completeFetchData): Deleted.
* Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderProvider.cpp:
(WebKit::MediaRecorderProvider::createMediaRecorderPrivate):
Canonical link: https://commits.webkit.org/285227@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list