{"record":{"id":"49d1f302326930cf","repo":"AlexxIT/go2rtc","slug":"alsa-can-t-convert-s-to-s","errorCode":null,"errorMessage":"alsa: can't convert %s to %s","messagePattern":"alsa: can't convert (.+?) to (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/alsa/playback_linux.go","lineNumber":60,"sourceCode":"}\n\nfunc (p *Playback) AddTrack(media *core.Media, codec *core.Codec, track *core.Receiver) error {\n\tsrc := track.Codec\n\tdst := &core.Codec{\n\t\tName:      core.CodecPCML,\n\t\tClockRate: p.dev.GetRateNear(src.ClockRate),\n\t\tChannels:  p.dev.GetChannelsNear(src.Channels),\n\t}\n\tsender := core.NewSender(media, dst)\n\n\tsender.Handler = func(pkt *rtp.Packet) {\n\t\tif n, err := p.dev.Write(pkt.Payload); err == nil {\n\t\t\tp.Send += n\n\t\t}\n\t}\n\n\tif sender.Handler = pcm.TranscodeHandler(dst, src, sender.Handler); sender.Handler == nil {\n\t\treturn fmt.Errorf(\"alsa: can't convert %s to %s\", src, dst)\n\t}\n\n\t// typical card support:\n\t// - Formats: S16_LE, S32_LE\n\t// - ClockRates: 8000 - 192000\n\t// - Channels: 2 - 10\n\terr := p.dev.SetHWParams(device.SNDRV_PCM_FORMAT_S16_LE, dst.ClockRate, byte(dst.Channels))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsender.HandleRTP(track)\n\tp.Senders = append(p.Senders, sender)\n\treturn nil\n}\n\nfunc (p *Playback) Start() (err error) {\n\treturn p.closed.Wait()","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/alsa/playback_linux.go#L42-L78","documentation":"Guard in Playback.AddTrack: no PCM transcode handler exists for converting the incoming track codec to the codec the sound card negotiated (rate/channels near the source). The unsupported source codec is at fault.","triggerScenarios":"Thrown at pkg/alsa/playback_linux.go:60 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send a codec supported by the playback path (PCM) or one with a known converter","Update the transcode codec table to support this source codec"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c245815e75e2a5fd60b4290f12bfc04e55a984d3","analyzedAt":"2026-09-07T11:47:02.965Z","contentChangedAt":"2026-09-07T11:47:02.965Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}