Repository navigation
feat: http:// MJPEG slots — multipart/x-mixed-replace over HTTP (#121) - #150
Conversation
…he single view and in multi-view (#121) Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
|
/review |
Code Review by Qodo
1.
|
…ntials, query/fragment URLs, quoted boundaries, LF-only and boundary-like data in lengthless parts, only JPEG parts count Co-Authored-By: Claude <noreply@anthropic.com>
…te (#150) Co-Authored-By: Claude <noreply@anthropic.com>
|
Qodo findings 1–7 → cac8f6b + bc26e69: |
|
/review |
Thanks for the update. The reported fixes cover findings 1–7, and the current review shows all findings resolved. The device re-test also confirms HTTP MJPEG works in both single-view and grid modes with no fatal errors. |
| int i = lower.indexOf("boundary="); | ||
| if (i < 0) return null; |
There was a problem hiding this comment.
4. Some cameras cannot start mjpeg playback 🐞 Bug ≡ Correctness
Response.boundary() searches only for the literal boundary=, so it misses a boundary parameter with whitespace before the equals sign. When a camera sends a content type such as multipart/x-mixed-replace; boundary = frame, httpMjpeg() rejects the response as not an MJPEG stream before reading any frames.
Agent Prompt
## Issue description
A valid multipart boundary parameter with whitespace around `=` is not recognized, so the HTTP MJPEG connection is rejected.
## Fix Focus Areas
- android/app/src/main/java/com/openipc/decoder/HttpMjpeg.java[110-129]
- android/app/src/main/java/com/openipc/decoder/RtspSession.java[540-544]
## Recommended Fix
Parse content-type parameters as names and values, allowing whitespace around the equals sign while preserving quoted boundary values. Add a response-head test for `boundary = frame`.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| else if (name.equals("transfer-encoding")) { | ||
| r.chunked = value.toLowerCase(Locale.ROOT).contains("chunked"); | ||
| } else if (name.equals("www-authenticate")) r.challenges.add(value); |
There was a problem hiding this comment.
5. A camera response can exhaust app memory 🐞 Bug ☼ Reliability
readResponse() retains every WWW-Authenticate value in Response.challenges without limiting the number or total size of headers. A camera that continuously sends individually valid header lines can grow that list until the app runs out of memory, even though each line has a size limit.
Agent Prompt
## Issue description
The HTTP response parser caps individual lines but can retain an unbounded number of authentication headers from a camera.
## Fix Focus Areas
- android/app/src/main/java/com/openipc/decoder/HttpMjpeg.java[134-157]
## Recommended Fix
Enforce a cumulative response-header byte or count limit and throw `IOException` when it is exceeded. Add a test with many short authentication headers.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Code review by qodo was updated up to the latest commit bc26e69 |
…ntials, query/fragment URLs, quoted boundaries, LF-only and boundary-like data in lengthless parts, only JPEG parts count Co-Authored-By: Claude <noreply@anthropic.com>
…te (#150) Co-Authored-By: Claude <noreply@anthropic.com>
feat: http:// MJPEG slots — multipart/x-mixed-replace over HTTP (#121)
Closes #121.
A slot accepts an HTTP MJPEG URL such as Majestic's
http://user:pass@<camera>/mjpeg—multipart/x-mixed-replace, each part one whole JPEG.HttpMjpeg(pure Java): URL, response head, chunked bodies (Majestic sendsTransfer-Encoding: chunked, one part per chunk), parts byContent-Lengthor else up to the next boundary.RtspSession.httpMjpeg(): GET with Basic credentials up front, Digest after a challenge (RtspAuth); the same back-off, watchdog and status as RTSP; transport shown asHTTP. The frames go to a new callbackonJpegFrameafter anSdpwithvideoJpeg, so the existing MJPEG paths (MJPEG over RTSP (RTP/JPEG, RFC 2435) — discussion #119 single view, feat: MJPEG cells in multi-view (#132) #139 multi-view) show them — hardware JPEG decoder where there is one, else BitmapFactory.HttpMjpegTest: URL, Majestic's response head, 401 challenge, quoted boundary, chunked parts with Content-Length, parts without length (CR LF-inside the data), a chunk split inside a part.Device test (AG-216, CI build 9523733),
http://root:***@172.17.32.133/mjpegin slot 2:transport HTTP,MJPEG 1280x720, live picture (clock running);1280×720 MJPEG reduced · 1.0 fps · software, transportHTTP; 0 FATAL.userAgentis the whole header line already — fixed in 9523733.