Repository navigation
Add decoded {Audio,Video}Info support to toCMSampleBuffer - #77260
Conversation
|
EWS run on previous version of this PR (hash bbb8358) Details
|
bbb8358 to
c2ae121
Compare
|
EWS run on previous version of this PR (hash c2ae121) Details
|
macOS Safer C++ Build #140313 (c2ae121)❌ Found 1 failing file with 2 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
c2ae121 to
c1de520
Compare
|
EWS run on previous version of this PR (hash c1de520) Details
|
c1de520 to
c2ae121
Compare
macOS Safer C++ Build #140348 (c2ae121)❌ Found 1 failing file with 2 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
c2ae121 to
2ae2274
Compare
|
EWS run on previous version of this PR (hash 2ae2274) Details
|
|
|
||
| // The 8-bit planar formats are repacked into a biplanar buffer when the CVPixelBuffer is created. | ||
| switch (*info.pixelFormat()) { | ||
| case VideoPixelFormat::I420: |
There was a problem hiding this comment.
Couldn't this whole function be an equality check with this value?
There was a problem hiding this comment.
I have more to come, I limited to 8bits / I420 for now as the VideoDecoder don't support more than that for now
| return createAudioFormatDescription(*audioInfo); | ||
| #endif | ||
| case kAudioFormatLinearPCM: { | ||
| if (audioInfo->sampleFormat() && *audioInfo->sampleFormat() != AudioSampleFormat::F32) |
There was a problem hiding this comment.
If sampleFormat() is an optional, this deref and nil check is unnecessary.
There was a problem hiding this comment.
not really, they differ when sampleFormat() is nullopt. WebM can contain a PCM 32 when mkv supports is true.
and in this case sampleFormat() would return std::nullopt
There was a problem hiding this comment.
I changed it to if (audioInfo->isDecoded() && audioInfo->sampleFormat() != AudioSampleFormat::F32) it's clearer
2ae2274 to
770da1e
Compare
|
EWS run on current version of this PR (hash 770da1e) Details
|
https://bugs.webkit.org/show_bug.cgi?id=327811 rdar://190200035 Reviewed by Jer Noble. toCMSampleBuffer() and createFormatDescriptionFromTrackInfo() only handled compressed content. A MediaSamplesBlock holding decoded audio or video (AudioInfo::isDecoded() / VideoInfo::isDecoded()) either got a compressed-style format description, or, for LPCM, a sample buffer whose sample count was the number of items and whose size array held one entry per item instead of frames. Decoded audio now produces one constant bitrate sample buffer: the sample count is the frame count, a single timing entry holds the duration of one frame, and only interleaved F32 is accepted. Decoded video produces an IOSurface-backed biplanar CVPixelBuffer repacked from I420, with the colour and aspect ratio properties attached, and a sample buffer holding that image buffer. A video block must hold exactly one frame. The extension properties shared by format descriptions and image buffers are moved into addImageBufferProperties(). * Source/WebCore/platform/graphics/cocoa/CMUtilities.mm: (WebCore::pixelFormatTypeForDecodedVideo): Added. (WebCore::addImageBufferProperties): Added, moved from createFormatDescriptionFromTrackInfo(). (WebCore::createFormatDescriptionFromTrackInfo): Use the pixel format as the codec type for decoded video, reject decoded audio that isn't F32. (WebCore::decodedAudioToCMSampleBuffer): Added. (WebCore::copyI420ToBiplanarPixelBuffer): Added. (WebCore::decodedVideoToCMSampleBuffer): Added. (WebCore::toCMSampleBuffer): Handle decoded audio and video. * Tools/TestWebKitAPI/PlatformCocoa.cmake: * Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * Tools/TestWebKitAPI/Tests/WebCore/cocoa/DecodedMediaSamplesBlockTests.mm: Added. (TestWebKitAPI::TEST(DecodedMediaSamplesBlock, AudioToCMSampleBuffer)): (TestWebKitAPI::TEST(DecodedMediaSamplesBlock, AudioDiscontinuityAttachment)): (TestWebKitAPI::TEST(DecodedMediaSamplesBlock, AudioRejectsInvalidData)): (TestWebKitAPI::TEST(DecodedMediaSamplesBlock, VideoToCMSampleBuffer)): (TestWebKitAPI::TEST(DecodedMediaSamplesBlock, VideoWithOddDimensions)): (TestWebKitAPI::TEST(DecodedMediaSamplesBlock, VideoRejectsInvalidData)): (TestWebKitAPI::TEST(DecodedMediaSamplesBlock, VideoFormatDescriptionFromTrackInfo)): Canonical link: https://commits.webkit.org/323980@main
770da1e to
b14fee8
Compare
|
Committed 323980@main (b14fee8): https://commits.webkit.org/323980@main Reviewed commits have been landed. Closing PR #77260 and removing active labels. |
🧪 ios-wk2-wpt
b14fee8
Add decoded {Audio,Video}Info support to toCMSampleBuffer https://bugs.webkit.org/show_bug.cgi?id=327811 rdar://190200035 Reviewed by Jer Noble. toCMSampleBuffer() and createFormatDescriptionFromTrackInfo() only handled compressed content. A MediaSamplesBlock holding decoded audio or video (AudioInfo::isDecoded() / VideoInfo::isDecoded()) either got a compressed-style format description, or, for LPCM, a sample buffer whose sample count was the number of items and whose size array held one entry per item instead of frames. Decoded audio now produces one constant bitrate sample buffer: the sample count is the frame count, a single timing entry holds the duration of one frame, and only interleaved F32 is accepted. Decoded video produces an IOSurface-backed biplanar CVPixelBuffer repacked from I420, with the colour and aspect ratio properties attached, and a sample buffer holding that image buffer. A video block must hold exactly one frame. The extension properties shared by format descriptions and image buffers are moved into addImageBufferProperties(). * Source/WebCore/platform/graphics/cocoa/CMUtilities.mm: (WebCore::pixelFormatTypeForDecodedVideo): Added. (WebCore::addImageBufferProperties): Added, moved from createFormatDescriptionFromTrackInfo(). (WebCore::createFormatDescriptionFromTrackInfo): Use the pixel format as the codec type for decoded video, reject decoded audio that isn't F32. (WebCore::decodedAudioToCMSampleBuffer): Added. (WebCore::copyI420ToBiplanarPixelBuffer): Added. (WebCore::decodedVideoToCMSampleBuffer): Added. (WebCore::toCMSampleBuffer): Handle decoded audio and video. * Tools/TestWebKitAPI/PlatformCocoa.cmake: * Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * Tools/TestWebKitAPI/Tests/WebCore/cocoa/DecodedMediaSamplesBlockTests.mm: Added. (TestWebKitAPI::TEST(DecodedMediaSamplesBlock, AudioToCMSampleBuffer)): (TestWebKitAPI::TEST(DecodedMediaSamplesBlock, AudioDiscontinuityAttachment)): (TestWebKitAPI::TEST(DecodedMediaSamplesBlock, AudioRejectsInvalidData)): (TestWebKitAPI::TEST(DecodedMediaSamplesBlock, VideoToCMSampleBuffer)): (TestWebKitAPI::TEST(DecodedMediaSamplesBlock, VideoWithOddDimensions)): (TestWebKitAPI::TEST(DecodedMediaSamplesBlock, VideoRejectsInvalidData)): (TestWebKitAPI::TEST(DecodedMediaSamplesBlock, VideoFormatDescriptionFromTrackInfo)): Canonical link: https://commits.webkit.org/323980@main770da1e
🧪 wpe-wk2