[meta-arago][scarthgap][PATCH] meta-arago-distro: chromium: Avoid placing incomplete H264 NALUs in buffer

Thorsten Lannynd <[email protected]>
Newsgroups org.yoctoproject.lists.meta-arago
Message-ID <[email protected]>
Add patch to prevent SPS, PPS and other NALUs from being placed in seperate
buffers unconditionally. These are not full access units and may confuse
the V4L2 stateful decoder.

This patch adds improved performance and stability for H264 video decoding.

Signed-off-by: Thorsten Lannynd <[email protected]>
---
 ...complete-H264-access-units-in-buffer.patch | 48 +++++++++++++++++++
 .../chromium/chromium-ozone-wayland-arago.inc |  1 +
 2 files changed, 49 insertions(+)
 create mode 100644 meta-arago-distro/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland-132.0.6834.83/0004-Avoid-placing-incomplete-H264-access-units-in-buffer.patch

diff --git a/meta-arago-distro/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland-132.0.6834.83/0004-Avoid-placing-incomplete-H264-access-units-in-buffer.patch b/meta-arago-distro/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland-132.0.6834.83/0004-Avoid-placing-incomplete-H264-access-units-in-buffer.patch
new file mode 100644
index 00000000..e0ca7dfd
--- /dev/null
+++ b/meta-arago-distro/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland-132.0.6834.83/0004-Avoid-placing-incomplete-H264-access-units-in-buffer.patch
@@ -0,0 +1,48 @@
+From 8542b683ca6a0774a452eb3d7cadc834d4f41436 Mon Sep 17 00:00:00 2001
+From: Alexandros Frantzis <[email protected]>
+Date: Wed, 11 Jun 2025 11:07:05 +0300
+Subject: [PATCH] media/gpu/v4l2: Avoid placing incomplete H264 access units in
+ buffers
+
+Upstream-Status: Pending
+
+Don't place SPS, PPS, etc NALUs in their own separate buffers
+unconditionally, as they are not full access units by themselves,
+and may confuse the decoder.
+---
+ media/gpu/v4l2/v4l2_stateful_video_decoder.cc | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/media/gpu/v4l2/v4l2_stateful_video_decoder.cc b/media/gpu/v4l2/v4l2_stateful_video_decoder.cc
+index 422cc72a34a83..61ab2f5bf1ab2 100644
+--- a/media/gpu/v4l2/v4l2_stateful_video_decoder.cc
++++ b/media/gpu/v4l2/v4l2_stateful_video_decoder.cc
+@@ -1340,7 +1340,7 @@ H264FrameReassembler::FindFrameBoundary(const uint8_t* const data,
+           return std::nullopt;
+         }
+         previous_slice_header_.reset();
+-        return FrameBoundaryInfo{.is_whole_frame = true,
++        return FrameBoundaryInfo{.is_whole_frame = false,
+                                  .is_start_of_new_frame = true,
+                                  .nalu_size = nalu_size};
+       case H264NALU::kPPS:
+@@ -1350,7 +1350,7 @@ H264FrameReassembler::FindFrameBoundary(const uint8_t* const data,
+           return std::nullopt;
+         }
+         previous_slice_header_.reset();
+-        return FrameBoundaryInfo{.is_whole_frame = true,
++        return FrameBoundaryInfo{.is_whole_frame = false,
+                                  .is_start_of_new_frame = true,
+                                  .nalu_size = nalu_size};
+       case H264NALU::kNonIDRSlice:
+@@ -1389,7 +1389,7 @@ H264FrameReassembler::FindFrameBoundary(const uint8_t* const data,
+       case H264NALU::kReserved18:
+         // Anything else than SPS, PPS and Non/IDRs marks a new frame boundary.
+         previous_slice_header_.reset();
+-        return FrameBoundaryInfo{.is_whole_frame = true,
++        return FrameBoundaryInfo{.is_whole_frame = false,
+                                  .is_start_of_new_frame = true,
+                                  .nalu_size = nalu_size};
+       default:
+--
+GitLab
diff --git a/meta-arago-distro/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland-arago.inc b/meta-arago-distro/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland-arago.inc
index d5a790fe..53669cf5 100644
--- a/meta-arago-distro/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland-arago.inc
+++ b/meta-arago-distro/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland-arago.inc
@@ -11,4 +11,5 @@ SRC_URI:append = " \
                   file://0001-chromium-gpu-sandbox-allow-access-to-PowerVR-GPU-fro.patch \
                   file://0002-chromium-gpu-sandbox-Allow-GPU-sandbox-access-to-V4L.patch \
                   file://0003-chromium-gpu-v4l2-Fix-OUTPUT-queue-streaming-in-V4L2.patch \
+                  file://0004-Avoid-placing-incomplete-H264-access-units-in-buffer.patch \
                   "
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.