Skip to content

MJPEG: hardware decoding through MediaCodec (video/jpeg) where the device has it #132

Closed

Description

@compot-dev

Follow-up to #119 / #131. The first step decodes MJPEG with BitmapFactory on the decode thread and draws it with lockCanvas() — works on every device, fine for 1280×720 at 5 fps (.133 /stream=2).

For higher resolutions / frame rates and for multi-view, use the hardware JPEG decoder when the device has one:

  • Probe MediaCodecList for a decoder of video/jpeg (the AG-216 lists OMX.allwinner.video.decoder.mjpeg; other vendors use video/mjpeg or none).
  • Feed whole JPEG frames from JpegAssembler as input buffers, output to the surface like H.264/H.265 (no lockCanvas(), so no surface swap when the codec changes).
  • Fall back to the bitmap path when no decoder exists or configuration fails.
  • Then MJPEG cells in multi-view (today they are paused with MJPEG: single view only), with frame skipping as the cheap mode instead of key frames (Multi-view: adaptive decoding — full rate or key frames per cell, learnt device capacity #85).

Activity

  1. compot-dev commented on Oct 13, 2026

    @compot-dev
    CollaboratorAuthor

    Single view done in #135 (hardware video/jpeg decoder where the platform exposes one, software otherwise). On the AG-216 the platform does not expose its JPEG decoder (declared in the vendor XML, creating it by name fails with 0xfffffffe), so it uses the software path. Left here: MJPEG cells in multi-view.

  2. added a commit that references this issue on Oct 13, 2026
  3. compot-dev commented on Oct 13, 2026

    @compot-dev
    CollaboratorAuthor

    Done: hardware MJPEG through MediaCodec where the device exposes a JPEG decoder (#135), and MJPEG cells in multi-view (#139, ea5c093) with the same hardware-then-software choice per stream. On the AG-216 the vendor JPEG decoder cannot be created (0xfffffffe), so it runs on the software path there.

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

    enhancementNew feature or requesttodayTasks for today

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions