{"record":{"id":"8a93962731d0f7cc","repo":"AlexxIT/go2rtc","slug":"not-implemented","errorCode":null,"errorMessage":"not implemented","messagePattern":"not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/webrtc/helpers.go","lineNumber":274,"sourceCode":"\t\treturn webrtc.MimeTypeH264\n\tcase core.CodecH265:\n\t\treturn webrtc.MimeTypeH265\n\tcase core.CodecVP8:\n\t\treturn webrtc.MimeTypeVP8\n\tcase core.CodecVP9:\n\t\treturn webrtc.MimeTypeVP9\n\tcase core.CodecAV1:\n\t\treturn webrtc.MimeTypeAV1\n\tcase core.CodecPCMU:\n\t\treturn webrtc.MimeTypePCMU\n\tcase core.CodecPCMA:\n\t\treturn webrtc.MimeTypePCMA\n\tcase core.CodecOpus:\n\t\treturn webrtc.MimeTypeOpus\n\tcase core.CodecG722:\n\t\treturn webrtc.MimeTypeG722\n\t}\n\tpanic(\"not implemented\")\n}\n\nfunc CandidateICE(network, host, port string, priority uint32) string {\n\t// 1. Foundation\n\t// 2. Component, always 1 because RTP\n\t// 3. \"udp\" or \"tcp\"\n\t// 4. Priority\n\t// 5. Host - IP4 or IP6 or domain name\n\t// 6. Port\n\t// 7. \"typ host\"\n\tfoundation := crc32.ChecksumIEEE([]byte(\"host\" + host + network + \"4\"))\n\ts := fmt.Sprintf(\"candidate:%d 1 %s %d %s %s typ host\", foundation, network, priority, host, port)\n\tif network == \"tcp\" {\n\t\treturn s + \" tcptype passive\"\n\t}\n\treturn s\n}\n","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/webrtc/helpers.go#L256-L292","documentation":"MimeType() maps go2rtc core codec identifiers to WebRTC MIME type strings. The switch has no default case, so any codec constant that is not explicitly mapped reaches the trailing panic(\"not implemented\"). This is an intentional fail-fast guard for codec mappings the library does not support in WebRTC.","triggerScenarios":"Calling GetTrack (which calls MimeType) with a stream whose codec is one not listed in the switch (e.g. CodecH264 vs PCM/Opus/G722 variants, or a future/unknown codec constant).","commonSituations":"WebRTC sessions negotiated over an audio stream encoded with an audio codec go2rtc doesn't map here (like MP3, AAC, or an unknown codec byte); config misconfiguration selecting an unsupported audio codec for a webrtc consumer.","solutions":["Check the stream's actual codec (via the streams API or logs) and re-encode/transcode the source to a supported audio codec (PCM, Opus, or G722)","Upgrade go2rtc - newer versions add more codec mappings","If adding a codec in code, extend the switch in MimeType with the new core.Codec case returning the corresponding webrtc.MimeType constant"],"exampleFix":"// before\ncase core.CodecG722:\n    return webrtc.MimeTypeG722\n}\npanic(\"not implemented\")\n// after\ncase core.CodecG722:\n    return webrtc.MimeTypeG722\ncase core.CodecH264:\n    return webrtc.MimeTypeH264\ndefault:\n    return \"\"\n}","handlingStrategy":"validation","validationCode":"var supported = map[core.Codec]bool{\n    core.CodecPCMA: true, core.CodecOpus: true, core.CodecG722: true,\n}\nif !supported[trackCodec] {\n    return fmt.Errorf(\"codec %v not supported for webrtc\", trackCodec)\n}","typeGuard":"func webrtcSupported(c core.Codec) bool {\n    return c == core.CodecPCMA || c == core.CodecOpus || c == core.CodecG722\n}","tryCatchPattern":null,"preventionTips":["Verify stream codecs via the streams API before attaching a webrtc consumer","Transcode unsupported codecs to Opus in config","Keep go2rtc updated so new codec mappings are available"],"tags":["webrtc","codec","panic","unsupported-codec"],"backgroundTag":"unsupported-enum-value","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"}