mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-12 01:46:46 +02:00
LibMedia+LibWeb: Store decoded YUV data in video frames
Decoded video frames should own their planar YUV data and color space directly. Keeping that storage behind ImmutableBitmap gave a still-image abstraction media-specific behavior and made calls like bitmap() potentially allocate and convert a whole video frame. Move YUV ownership into Media::VideoFrame, where the lifetime naturally follows media playback, and remove the YUV-backed mode from ImmutableBitmap. This commit intentionally keeps the visible Web paint path on ExternalContentSource by converting the current frame back to an ImmutableBitmap where Web still expects one. Callers that need pixels now ask the frame to convert explicitly. That preserves behavior for canvas and bitmap consumers while making the expensive YUV-to-pixel path visible at the call site instead of hiding it behind ImmutableBitmap::bitmap().
This commit is contained in:
committed by
Gregory Bertilson
parent
7f09cdfc82
commit
febd85f417
Notes:
github-actions[bot]
2026-05-05 19:41:14 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/febd85f417a Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/9249 Reviewed-by: https://github.com/Zaggy1024 ✅
@@ -346,7 +346,12 @@ RefPtr<Gfx::ImmutableBitmap> HTMLVideoElement::bitmap() const
|
||||
auto current_frame = sink->current_frame();
|
||||
if (!current_frame)
|
||||
return nullptr;
|
||||
return current_frame->immutable_bitmap();
|
||||
auto bitmap_or_error = current_frame->to_immutable_bitmap();
|
||||
if (bitmap_or_error.is_error()) {
|
||||
dbgln("Could not convert video frame to bitmap: {}", bitmap_or_error.release_error());
|
||||
return nullptr;
|
||||
}
|
||||
return bitmap_or_error.release_value();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user