Revert: remove NestsTrace listener-pipeline instrumentation

Removes the four trace points + debug-build auto-enable hook added in
the prior commit on this branch. They served their purpose locally
(confirmed the ~1s startup lag lives between pcm_decoded and
pcm_enqueued, i.e. AudioTrack ring backpressure), and don't need to
land in main.
This commit is contained in:
Claude
2026-05-14 03:23:02 +00:00
parent 86c66920d3
commit dec56c2ee9
4 changed files with 1 additions and 70 deletions
@@ -135,24 +135,10 @@ class MoqLiteNestsListener internal constructor(
val mapped =
handle.frames.map { frame ->
val payload = if (stripLegacyTimestamp) stripLegacyTimestampPrefix(frame.payload) else frame.payload
val objId = objectIdSeq.getAndIncrement()
// Second stage of the listener-pipeline trace. Bridges
// `frame_received` (subscribeId + groupSequence + frame_idx)
// to `pcm_decoded` / `pcm_enqueued` (which know obj_id but
// not the per-group frame_idx). A gap between
// `frame_received` and `frame_object_mapped` of the same
// (sub_id, group_seq) means the consumer of the per-subscription
// Channel is slow — i.e. NestPlayer's decode/enqueue is the
// bottleneck.
com.vitorpamplona.nestsclient.trace.NestsTrace
.emit("frame_object_mapped") {
"\"sub_id\":${handle.id},\"group_seq\":${frame.groupSequence}," +
"\"obj_id\":$objId,\"size\":${payload.size}"
}
MoqObject(
trackAlias = handle.id,
groupId = frame.groupSequence,
objectId = objId,
objectId = objectIdSeq.getAndIncrement(),
publisherPriority = MoqLiteSession.DEFAULT_PRIORITY,
payload = payload,
)
@@ -277,16 +277,6 @@ class NestPlayer(
} else {
decodedFrames += 1
onLevel(peakAmplitude(pcm))
// Third stage of the listener-pipeline trace.
// Delta from `frame_object_mapped` to here is
// Opus decode wall-time (typically <1ms — a
// larger value means MediaCodec is contending).
com.vitorpamplona.nestsclient.trace.NestsTrace
.emit("pcm_decoded") {
"\"track_alias\":${obj.trackAlias},\"group\":${obj.groupId}," +
"\"obj_id\":${obj.objectId},\"samples\":${pcm.size}," +
"\"preroll_size\":${preroll.size},\"playback_begun\":$playbackBegun"
}
if (playbackBegun) {
val enqueueStart = System.currentTimeMillis()
player.enqueue(pcm)
@@ -297,21 +287,6 @@ class NestPlayer(
"NestPlayer enqueued #$enqueued (took ${enqueueMs}ms)"
}
}
// Fourth stage of the listener-pipeline
// trace. Delta from `pcm_decoded` to here
// = AudioTrack ring-buffer backpressure:
// `WRITE_BLOCKING` parks until the ring
// has room. A consistent ~20ms means the
// ring is full and the device clock is
// the pacer (healthy steady-state). A
// larger value means GC / Compose stalls
// are starving the audio-priority writer.
com.vitorpamplona.nestsclient.trace.NestsTrace
.emit("pcm_enqueued") {
"\"track_alias\":${obj.trackAlias},\"group\":${obj.groupId}," +
"\"obj_id\":${obj.objectId},\"samples\":${pcm.size}," +
"\"write_ms\":$enqueueMs"
}
} else {
preroll.addLast(pcm)
if (preroll.size >= prerollFrames) {
@@ -676,19 +676,6 @@ class MoqLiteSession internal constructor(
),
)
if (!sent.isSuccess) trySendFailures += 1
// Per-frame timestamp at the moq-lite layer — first
// stage of the listener-pipeline trace. Pair with
// `frame_object_mapped` (NestsListener), `pcm_decoded`
// (NestPlayer), and `pcm_enqueued` (NestPlayer) to
// reconstruct end-to-end glass-to-glass latency.
// `frame_idx` is the 0-based index of this frame
// within the group so DROP_OLDEST gaps downstream
// are visible as missing indices in pcm_decoded.
NestsTrace.emit("frame_received") {
"\"sub_id\":$subscribeId,\"group_seq\":$groupSequence," +
"\"frame_idx\":$frameCount,\"size\":${frame.size}," +
"\"queued\":${sent.isSuccess}"
}
}
frameCount += 1
}