[webkit-changes] [WebKit/WebKit] 587602: Add methods to convert CMSampleBuffer and CMFormat...

Jean-Yves Avenard noreply at github.com
Mon Dec 16 02:02:22 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 587602e420de43c48d5fd31e7095ce4dec1dc244
      https://github.com/WebKit/WebKit/commit/587602e420de43c48d5fd31e7095ce4dec1dc244
  Author: Jean-Yves Avenard <jya at apple.com>
  Date:   2024-12-16 (Mon, 16 Dec 2024)

  Changed paths:
    M Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.cpp
    M Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.h
    M Source/WebCore/platform/MediaSample.h
    M Source/WebCore/platform/graphics/cocoa/CMUtilities.h
    M Source/WebCore/platform/graphics/cocoa/CMUtilities.mm
    M Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp
    M Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.h
    M Source/WebCore/platform/mediarecorder/MediaRecorderPrivateEncoder.cpp

  Log Message:
  -----------
  Add methods to convert CMSampleBuffer and CMFormatDescription to MediaSamplesBlock and TrackInfo
https://bugs.webkit.org/show_bug.cgi?id=284701
rdar://141498917

Reviewed by Youenn Fablet.

Add createAudioInfoFromFormatDescription and samplesBlockFromCMSampleBuffer.
MediaSamplesBlock created share the CMSampleBuffer's CMBlockBuffer, no new memory is allocated.

We remove support for the UseByteRange variant in MediaSamplesBlock and SourceBufferParserWebM
as it was only usd by the MediaFormatReader plugin which got removed in 282704 at main.

New methods aren't used yet and will be used in a follow-up change.
No change in behaviours, covered by existing tests.

* Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.cpp:
* Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.h:
* Source/WebCore/platform/MediaSample.h:
Make MediaSamplesBlock use FastMalloc so that it can be allocated by makeUniqueRef.
Change MediaSampleItem's trimDuration to trimInterval so that it allows 1:1
compatible with CMSampleBuffer's kCMSampleBufferAttachmentKey_TrimDurationAtEnd.
Remote unused profile and extendedProfile members; we use the FourCC codecName instead.
Change flags type to uint32_t to prepare for IPC serialisation.
Add various utility methods to replicate MediaSample ones (presentationTime, presentationEndTime, duration, isSync).
Sured RefPtr<SharedBuffer> instead of RefPtr<const SharedBuffer> as the IPC serialisation
doesn't handle const type properly.

(WebCore::MediaSamplesBlock::MediaSampleItem::isSync const):
(WebCore::MediaSamplesBlock::MediaSamplesBlock):
(WebCore::MediaSamplesBlock::presentationTime const):
(WebCore::MediaSamplesBlock::duration const):
(WebCore::MediaSamplesBlock::presentationEndTime const):
(WebCore::MediaSamplesBlock::isSync const):
(WebCore::MediaSamplesBlock::trackID const): Change type to TrackID for consistency.
* Source/WebCore/platform/graphics/cocoa/CMUtilities.h:
* Source/WebCore/platform/graphics/cocoa/CMUtilities.mm:
(WebCore::audioStreamDescriptionFromAudioInfo):
(WebCore::createAudioFormatDescription):
(WebCore::createFormatDescriptionFromTrackInfo):
(WebCore::createAudioInfoFromFormatDescription):
(WebCore::toCMSampleBuffer):
(WebCore::samplesBlockFromCMSampleBuffer):
(WebCore::getPacketDescriptions):
(WebCore::ensureContiguousBlockBuffer):
(WebCore::sharedBufferFromCMBlockBuffer): Utility method to create a SharedBuffer from a
CMBlockBuffer. The memory is referenced in place, no copy is performed.
* Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp:
(WebCore::WebMParser::OnTrackEntry):
(WebCore::WebMParser::TrackData::readFrameData):
(WebCore::WebMParser::VideoTrackData::consumeFrameData):
(WebCore::WebMParser::AudioTrackData::consumeFrameData):
(WebCore::SourceBufferParserWebM::parsedMediaData):
(WebCore::SourceBufferParserWebM::returnSamples):
(WebCore::SourceBufferParserWebM::flushPendingAudioSamples):
(WebCore::WebMParser::createByteRangeSamples): Deleted.
* Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.h:
(WebCore::WebMParser::TrackData::createByteRangeSamples): Deleted.
* Source/WebCore/platform/mediarecorder/MediaRecorderPrivateEncoder.cpp:
(WebCore::MediaRecorderPrivateEncoder::enqueueCompressedVideoFrame): Update method
to use C++20 designated initialisers.

Canonical link: https://commits.webkit.org/287870@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