{"record":{"id":"dcedcec00fc9d77c","repo":"AlexxIT/go2rtc","slug":"streams-codecs-not-matched","errorCode":null,"errorMessage":"streams: codecs not matched: ","messagePattern":"streams: codecs not matched: ","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/streams/add_consumer.go","lineNumber":151,"sourceCode":"\t\tvar prod, cons string\n\n\t\tfor _, media := range prodMedias {\n\t\t\tif media.Direction == core.DirectionRecvonly {\n\t\t\t\tfor _, codec := range media.Codecs {\n\t\t\t\t\tprod = appendString(prod, media.Kind+\":\"+codec.PrintName())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor _, media := range consMedias {\n\t\t\tif media.Direction == core.DirectionSendonly {\n\t\t\t\tfor _, codec := range media.Codecs {\n\t\t\t\t\tcons = appendString(cons, media.Kind+\":\"+codec.PrintName())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn errors.New(\"streams: codecs not matched: \" + prod + \" => \" + cons)\n\t}\n\n\t// 3. Return unknown error\n\treturn errors.New(\"streams: unknown error\")\n}\n\nfunc appendString(s, elem string) string {\n\tif strings.Contains(s, elem) {\n\t\treturn s\n\t}\n\tif len(s) == 0 {\n\t\treturn elem\n\t}\n\treturn s + \", \" + elem\n}\n","sourceCodeStart":133,"sourceCodeEnd":167,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/internal/streams/add_consumer.go#L133-L167","documentation":"formatError in AddConsumer builds this error when SDP negotiation between the producer's recvonly codecs and the consumer's sendonly codecs finds no intersection. The message appends both codec lists ('kind:codec' joined per media) so the mismatch is visible: producer offers X, consumer demands Y. It fires when the two sides of a stream share no common codec for any media kind.","triggerScenarios":"Thrown at internal/streams/add_consumer.go:151 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Compare the two codec lists in the message and reconfigure either the producer source or the consumer to use a shared codec (e.g. H264 vs H265 mismatch)","Enable transcoding so codecs on both sides can be bridged","If the consumer side is empty, verify the consumer actually offered sendonly medias with codecs"],"exampleFix":null,"handlingStrategy":"validation","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-15T23:17:13.987Z"}