Skip to content

CarLife: support 3.x receivers alongside 4.x - #34

Merged
riko2chen merged 1 commit into
mainfrom
feature/carlife-vehicle-3-protocol
Nov 8, 2026
Merged

riko2chen merged 1 commit into
mainfrom
feature/carlife-vehicle-3-protocol

Conversation

@riko2chen

Copy link
Copy Markdown
Contributor

Summary

Select a per-session receiver profile from the major version the head unit announces in 98305, so the same CarLife sender serves both the 3.x and 4.x generations without configuration.

Profile Majors Session Video parameter sets
Legacy 1 established at 98311, no challenge first keyframe of a session (and after a format change) only; later keyframes start with the IDR slice, no AUD/SPS
Current 3, 4 challenge/response, established at 98380 in-band SPS/PPS in every keyframe (previous behaviour)

Any other major is rejected as version_mismatch, with the bounded version_rejected major=... minor=... diagnostic from #33.

Root cause

A 3.3.9 receiver announces protocol 1.0 and has no authentication challenge, so the previous sender closed the session at version_mismatch. Once accepted, it still never decoded: the receiver stores the first frame's SPS/PPS and, after a decoder reset, only accepts a keyframe whose first NAL is the IDR slice; a sender that repeats SPS/PPS on every keyframe makes it discard every frame (DecodeUtil: decoder reset per frame). The 3.x receiver also sends frame rate 0 in 98311, which the old clamp turned into 1 fps.

Changes

  • ReceiverProfile.kt: profile selection plus the two behavioural differences (challenge, parameter-set policy).
  • CarlifeSession.kt: profile selection from 98305; bounded rejection diagnostic preserved; 3.x establishes at video negotiation; frame rate 0 means the configured default; 98389 status codes logged as peer_code.
  • CarlifeOutput.kt: per-profile keyframe shaping; parameter-set state resets on session and source-format change.
  • Tests: profile selection, 3.x authless establishment and frame-rate fallback, 4.x keeps in-band sets, 3.x gets parameter sets once and IDR-first keyframes.

Validation

  • :carlife:test and :devrelay:test pass after rebasing onto main.
  • Live against the unmodified CarLife 3.3.9 vehicle APK (SM-G9860, wireless discovery): established in ~110 ms, 1280x720@30 decoded and displayed, taps and swipes returned as touch events.
  • The 4.x path is the unchanged Current branch and covered by unit tests; a live 4.0 reinstall stopped in its own "connecting 0%" state, so it was not used as a signal.

…nect

A 3.3.9 receiver announces protocol 1.0, skips the authentication challenge, sends frame rate 0, and keeps the first frame's parameter sets for its own decoder resets. Select a per-session profile from the announced major: 1.x establishes at video negotiation and receives parameter sets only with the first keyframe of each format; 3.x/4.x keeps the challenge flow and in-band sets on every keyframe. Keyframes for the legacy profile start with the IDR slice so the receiver's reset path can prepend its stored SPS/PPS.
@riko2chen
riko2chen enabled auto-merge November 8, 2026 07:34
@riko2chen
riko2chen merged commit 94bb696 into main Nov 8, 2026
6 checks passed
@riko2chen
riko2chen deleted the feature/carlife-vehicle-3-protocol branch November 8, 2026 07:36
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant