Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: c755d07d28c8ebe6f680c7bd19045baf8c0f31ce https://github.com/WebKit/WebKit/commit/c755d07d28c8ebe6f680c7bd19045baf8c0f31ce Author: Jean-Yves Avenard <j...@apple.com> Date: 2025-07-15 (Tue, 15 Jul 2025)
Changed paths: M Source/WebCore/Headers.cmake M Source/WebCore/WebCore.xcodeproj/project.pbxproj A Source/WebCore/platform/graphics/MediaReorderQueue.h M Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.cpp M Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.h M Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.mm M Tools/TestWebKitAPI/CMakeLists.txt M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj A Tools/TestWebKitAPI/Tests/WebCore/MediaReorderQueue.cpp Log Message: ----------- Stop using a CMBufferQueueRef for re-ordering samples. https://bugs.webkit.org/show_bug.cgi?id=295787 rdar://155621751 Reviewed by Gerald Squelart. CMBufferQueue is a priority queue using a CFArray as backend. It's not particularly adapted for our use as a dequeue where we will append on one end to pop on the other. It's also particularly inefficient in adding samples that aren't out of order. So we introduced a MediaReorderQueue that is using a Deque as backend and will only perform re-ordering as needed. So for YouTube in particular adding and removing a frame are in O(1). When re-ordering the frame, we will use bubble sort from the end of the queue which is very optimal for our use case where the queue is already ordered and only a few samples may be out of order at the end. We migrate most of VideoMediaSampleRenderer use of CoreMedia objects to webkit's MediaTime/MediaSample for ease. YouTube Profiling shows a significant reduction in memory allocations and time spent in VideoMediaSampleRenderer::purgeDecodedSampleQueue. Adding API tests, no observable changes, covered by existing tests. * Source/WebCore/platform/graphics/MediaReorderQueue.h: Added. (WTF::CFTypeTrait<CMSampleBufferRef>::typeID): Deleted. (WebCore::getDecodeTime): Deleted. (WebCore::getPresentationTime): Deleted. (WebCore::getDuration): Deleted. (WebCore::compareBuffers): Deleted. (WebCore::createBufferQueue): Deleted. (WebCore::sampleCallback): Deleted. * Tools/TestWebKitAPI/Tests/WebCore/MediaReorderQueue.cpp: Added. (TestWebKitAPI::TestSample::create): (TestWebKitAPI::TestSample::TestSample): (TestWebKitAPI::TEST(MediaReorderQueue, MediaSample)): (TestWebKitAPI::TEST(MediaReorderQueue, Int)): (TestWebKitAPI::TEST(MediaReorderQueue, Pair)): Canonical link: https://commits.webkit.org/297392@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes