Skip to content

馃悰 Android: Frame.hasPixelBuffer is true for PRIVATE frames but getPixelBuffer() throws "Unknown HardwareBuffer format"聽#4207

Description

@lagudafuadtosin

Prerequisites

Reproduction

#4206 (existing harness test in visioncamera.frame.harness.ts, 'reports native buffers and conditionally reads pixel buffers')

Steps to reproduce

  1. Build the example app and run the frame tests on a Galaxy A14: bun run test:harness:android -- --testPathPatterns=frame
  2. Watch the test named "reports native buffers and conditionally reads pixel buffers". It fails.
  3. Or in app: create a frame output with pixelFormat 'native'. In the frame callback frame.hasPixelBuffer says true, then frame.getPixelBuffer() throws.

What did you expect to happen?

If hasPixelBuffer is true, getPixelBuffer() returns a buffer. If the native buffer has no readable pixel layout, hasPixelBuffer is false and the caller uses getNativeBuffer().

What actually happened?

The HAL delivers PRIVATE images backed by a HardwareBuffer with format 0x22 (IMPLEMENTATION_DEFINED), usage 0x20133 (includes USAGE_CPU_READ_OFTEN), 0 planes. ImageProxy.hasPixelBuffer only checks the CPU-read usage bits and returns true. getPixelBuffer() takes the ArrayBuffer.wrap(hardwareBuffer) fast path and Nitro throws because an implementation-defined format has no bytes-per-pixel.

So I found this by running the full harness suite on a Galaxy A14 (SM-A145F, Android 15).

Fix in #4206: and it require a format with a fixed pixel layout as well as the usage bits, frame suite 15/15 on the A14 with it.

Affected platforms

Android (device)

Device(s) affected

Samsung Galaxy A14 (SM-A145F), Android 15, security patch 2026-05-05

VisionCamera version

5.2.3 (main at 91bae1f)

React Native version

0.85.3

React Native architecture

New Architecture (Fabric / bridgeless)

Features being used

  • Preview
  • Photo capture
  • Video capture
  • Frame Processors (worklets)
  • Skia Frame Processors
  • Code/Barcode Scanner
  • Location metadata
  • Multi-cam
  • Depth data
  • HDR / custom dynamic range
  • Custom format / FPS / resolution

Relevant logs / stack trace

Frame.getPixelBuffer(...): Cannot get bytes per pixel: Unknown HardwareBuffer format!

Additional context

No response

Submission

  • The reproduction I linked is either (preferred) a PR against this repo that adds a failing harness test following the harness-tests README, or (fallback) a public repo that reproduces the bug on a fresh clone. I understand the issue will be closed without one.
  • I pasted logs as text (not screenshots).
  • I wrote this report in my own words. I did not paste AI-generated descriptions of the bug.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    馃悰 bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions