{"record":{"id":"e6c1f6f12a9a1107","repo":"AlexxIT/go2rtc","slug":"adts-wrong-header","errorCode":null,"errorMessage":"adts: wrong header","messagePattern":"adts: wrong header","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/aac/producer.go","lineNumber":27,"sourceCode":"\t\"github.com/pion/rtp\"\n)\n\ntype Producer struct {\n\tcore.Connection\n\trd *bufio.Reader\n}\n\nfunc Open(r io.Reader) (*Producer, error) {\n\trd := bufio.NewReader(r)\n\n\tb, err := rd.Peek(ADTSHeaderSize)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcodec := ADTSToCodec(b)\n\tif codec == nil {\n\t\treturn nil, errors.New(\"adts: wrong header\")\n\t}\n\tcodec.PayloadType = core.PayloadTypeRAW\n\n\tmedias := []*core.Media{\n\t\t{\n\t\t\tKind:      core.KindAudio,\n\t\t\tDirection: core.DirectionRecvonly,\n\t\t\tCodecs:    []*core.Codec{codec},\n\t\t},\n\t}\n\treturn &Producer{\n\t\tConnection: core.Connection{\n\t\t\tID:         core.NewID(),\n\t\t\tFormatName: \"adts\",\n\t\t\tMedias:     medias,\n\t\t\tTransport:  r,\n\t\t},\n\t\trd: rd,","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/aac/producer.go#L9-L45","documentation":"ADTS Producer.Open's format guard: the first ADTSHeaderSize bytes were read successfully but ADTSToCodec could not recognize a valid ADTS sync word/profile, so the input is not an MPEG-2 ADTS audio stream (or is corrupt at the start). Open refuses to build a producer for it.","triggerScenarios":"Thrown at pkg/aac/producer.go:27 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Confirm the input is actually raw ADTS AAC, not wrapped in a container (MP4/FLV) or another codec","Check for leading garbage before the first ADTS frame","Provide the stream via a producer for the correct container format instead"],"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-16T04:17:20.429Z"}