{"record":{"id":"df2b3f9b7e11bb7a","repo":"AlexxIT/go2rtc","slug":"rtsp-wrong-input","errorCode":null,"errorMessage":"RTSP wrong input","messagePattern":"RTSP wrong input","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/rtsp/conn.go","lineNumber":261,"sourceCode":"\t\t\t\t// TODO: better check maximum good channel ID\n\t\t\t\tif channel >= 20 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tbuf4 = make([]byte, 2)\n\t\t\t\tif _, err = io.ReadFull(c.reader, buf4); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\t// check if size good for RTP\n\t\t\t\tsize = binary.BigEndian.Uint16(buf4)\n\t\t\t\tif size <= 1500 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\t// 10 tries to find good packet\n\t\t\t\tif i >= 10 {\n\t\t\t\t\treturn fmt.Errorf(\"RTSP wrong input\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// hope that the odd channels are always RTCP\n\t\tchannel = buf4[1]\n\n\t\t// get data size\n\t\tsize = binary.BigEndian.Uint16(buf4[2:])\n\n\t\t// skip 4 bytes from c.reader.Peek\n\t\tif _, err = c.reader.Discard(4); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// init memory for data\n\tbuf := make([]byte, size)","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/rtsp/conn.go#L243-L279","documentation":"handleTCPData received interleaved data that repeatedly failed the RTP size sanity check (size > 1500) for 10 consecutive attempts, concluding the TCP stream is not carrying valid RTP/RTSP interleaved framing. A safety heuristic against garbage input from the camera.","triggerScenarios":"Thrown at pkg/rtsp/conn.go:261 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reconnect the RTSP session to resynchronize","Verify the peer is a well-behaved RTSP implementation"],"exampleFix":null,"handlingStrategy":"retry","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"}