Skip to content

Clink: trace the audio path so a silent head unit can be read - #36

Merged
riko2chen merged 2 commits into
OpenXPlay:mainfrom
PicoHug:pr/clink-audio-trace
Dec 2, 2026
Merged

riko2chen merged 2 commits into
OpenXPlay:mainfrom
PicoHug:pr/clink-audio-trace

Conversation

@PicoHug

@PicoHug PicoHug commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Why

A trace cannot currently explain "the car is silent but the phone plays fine".

ClinkTraceEvent carries Rtsp, Frame, Socket, Negotiation, Media, Video, Input, Error and Link — nothing about audio. Three different faults look identical: an audio path that died, a stream the head unit refused, and a head unit that stays silent while audio keeps arriving. On a 203 s session I could see audio frames climbing at a constant 46.9/s with zero drops and still had no way to tell which stream went where, or whether a packet was rejected before it ever reached the encoder.

audioReject already rate-limits itself to one line a second, but it only printlns, so the reason never reaches the trace file.

What

  • A new Audio trace event in three shapes:
    • format — stream, role, codec, sample rate, channels, voiced, and the stream the head unit is currently fed as media;
    • reject — which stream was refused and why (session mismatch, inactive, bad size, unknown stream);
    • stats, once a second — the media slot, its queued frames, the open voice streams, and the packet counter.
  • audioReject records into the trace as well as logging.
  • The format gate and VoiceDelivery now share opensVoiceChannel(role) from core/audio/VoiceChannel.kt. Both carried their own copy of the role check, so a change to one silently left the other behind.
  • A audio_in stream=… role=… codec=… rate=… ch=… voiced=… line in the debug panel, so a phone-side report can be read without adb.

Behaviour

Unchanged. The same roles open the voice channel, the same packets are delivered, and the recording is the only difference — plus the predicate now has one definition instead of two.

No growth concern: reject inherits the existing once-a-second limiter, so a fully rejected stream adds at most one line a second.

Tests

  • ClinkAudioLoopbackTest: a guidance prompt that arrives on another slot does not open the voice channel.
  • :core:test and :clink:test pass.

Drafted while chasing a head-unit-side silence on a 小鹏 G6 over ICCOA; the audio-side fix for that car is a separate change and not part of this PR.

PicoHug and others added 2 commits November 12, 2026 10:57
An audio path that dies and a head unit that stays silent while audio keeps
arriving look identical in a trace: it carried no audio events at all. Every
rejected packet, every audio format and a once-a-second counter of the slot
and its backlog now land in the trace, so the next silent car can be read
instead of guessed at.

opensVoiceChannel moves to core/audio so the format gate and VoiceDelivery
cannot drift apart; both now answer the same question.
@riko2chen
riko2chen enabled auto-merge December 2, 2026 15:36
@riko2chen
riko2chen merged commit 2b63413 into OpenXPlay:main Dec 2, 2026
6 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 2, 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.

2 participants