Repository navigation
Conversation
Signed-off-by: wanchenxi <wanchenxi@hikvision.com.cn>
|
Thanks for digging into this — the bug is real, and the MJPEG frame parser in Before merging, though, I'd like to take a different route to the fix, because the transcode this adds is avoidable. The capture is PNG only because we ask for PNG. // FBSimulatorControl/Commands/FBSimulatorScreenshotCommands.swift
if format == .jpeg { return try image.jpegImageData() }
else if format == .png { return try image.pngImageData() }Both paths encode the same framebuffer
Going from one codec pass to three on the default streaming path is a steep price for a MIME label. On the premise that JPEG is the right target at all: I measured 12 real UI screenshots (PNG original vs So the direction we'll take:
I'll open a PR for this and carry over your |
|
@SunsetWan a follow-up, since I owe you an update on what I said earlier. I opened #130 along the lines described above, then closed it. Measuring the alternative changed the plan: native H.264 streaming through idb's I want to be clear that this does not diminish your contribution. Your diagnosis was correct, and chasing it is what surfaced the real problem: nobody had asked why the capture was PNG in the first place, and the answer turned out to be that we had hardcoded Thank you for the report and for the patience while the scope moved. |
|
A better, and full support for correct streaming feature was applied in #138 I am closing this now. @SunsetWan Thank you for placing this out and opening the PR. It raised the issue and we can get a final improvement! Nice work! |
Summary
scale=1.0/quality=80settingsUnreleasedRoot cause
Both the iOS screenshot API and Android
screencap -pproduce 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 asimage/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
rawandffmpegscreenshot-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 passedmake build: passedmake test: all 306 tests passed, then the Swift test process aborted during teardown withfreed pointer was not the last allocation; the same post-test abort reproduces on unchangedorigin/mainadbon PATH