From f7cfdcae2dc7da2ebcdf5ccc547923102f912f3e Mon Sep 17 00:00:00 2001 From: Eli Mallon Date: Tue, 13 Oct 2026 19:23:25 -0700 Subject: [PATCH] List the completed codec in a completed segment's record Since records list audio from the segment's media data, an AAC-only source completed with Opus was recorded with AAC alone. Refresh the audio list from the completed bytes before distributing. --- pkg/media/transcode_stream.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/media/transcode_stream.go b/pkg/media/transcode_stream.go index 27e400eb..50c67260 100644 --- a/pkg/media/transcode_stream.go +++ b/pkg/media/transcode_stream.go @@ -129,6 +129,13 @@ func (mm *MediaManager) feedStreamTranscoder(ctx context.Context, vs *validatedS streamCtx := context.WithoutCancel(ctx) t = mm.newStreamTranscoder(streamCtx, target, cert, keyPEM, func(token any, completed []byte) { v := token.(*validatedSegment) + // The record lists the audio the delivered bytes carry, the + // completed codec included. + if events, err := unwrapMuxlEvents(streamCtx, completed); err == nil && v.mediaData != nil { + if cat, _ := catalogAndTracks(events); cat != nil { + v.mediaData.Audio = audioMediaData(cat) + } + } if err := mm.distributeSegment(context.WithoutCancel(streamCtx), v, completed); err != nil { log.Error(streamCtx, "distribute completed segment failed", "streamer", v.repoDID, "error", err) } -- 2.51.2