Skip to content

fix: emit JPEG frames for default video streams - #1

Closed
SunsetWan wants to merge 1 commit into
mainfrom
codex/fix-mjpeg-jpeg-payload
Closed

fix: emit JPEG frames for default video streams#1
SunsetWan wants to merge 1 commit into
mainfrom
codex/fix-mjpeg-jpeg-payload

Conversation

@SunsetWan

Copy link
Copy Markdown
Owner

Summary

  • ensure screenshot-backed streams encode PNG captures as JPEG at the default scale=1.0 / quality=80 settings
  • preserve byte-for-byte passthrough when the input is already JPEG
  • add shared regression coverage plus iOS and Android MJPEG E2E assertions for MIME, Content-Length, and JPEG magic bytes
  • document the fix under Unreleased

Root cause

Both the iOS screenshot API and Android screencap -p produce PNG data. The shared frame processor treated the default scale and quality as an unconditional passthrough fast path, while both MJPEG writers labeled every frame as image/jpeg. This produced PNG payloads with a JPEG MIME type.

The fast path now checks the source container with ImageIO and only passes through actual JPEG input. PNG captures are re-encoded as JPEG. The shared raw and ffmpeg screenshot-backed formats now also consistently emit the JPEG frames their command descriptions promise.

User impact

Strict MJPEG clients no longer receive PNG frames mislabeled as JPEG at default settings. Non-default quality and scale behavior is unchanged.

Validation

  • swift test --filter VideoFrameProcessingTests: 9 passed
  • make build: passed
  • Standards/spec review: passed
  • make test: all 306 tests passed, then the Swift test process aborted during teardown with freed pointer was not the last allocation; the same post-test abort reproduces on unchanged origin/main
  • Device E2E not run locally: no booted iOS simulator and no adb on PATH

Signed-off-by: wanchenxi <wanchenxi@hikvision.com.cn>
@SunsetWan

Copy link
Copy Markdown
Owner Author

Superseded by lycorp-jp#94.

@SunsetWan SunsetWan closed this Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant