{"record":{"id":"0c14d55a1450e358","repo":"pion/webrtc","slug":"malformed-rtpdump","errorCode":null,"errorMessage":"malformed rtpdump","messagePattern":"malformed rtpdump","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/media/rtpdump/rtpdump.go","lineNumber":21,"sourceCode":"func NewReader(r io.Reader) (*Reader, Header, error) {\n\tvar hdr Header\n\n\tbio := bufio.NewReader(r)\n\n\t// Look ahead to see if there's a valid preamble\n\tpeek, err := bio.Peek(preambleLen)\n\tif errors.Is(err, io.EOF) {\n\t\treturn nil, hdr, errMalformed\n\t}\n\tif err != nil {\n\t\treturn nil, hdr, err\n\t}\n\n\t// The file starts with #!rtpplay1.0 address/port\\n\n\tpreambleRegexp := regexp.MustCompile(`#\\!rtpplay1\\.0 \\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\/\\d{1,5}\\n`)\n\tif !preambleRegexp.Match(peek) {\n\t\treturn nil, hdr, errMalformed\n\t}\n\n\t// consume the preamble\n\t_, _, err = bio.ReadLine()\n\tif errors.Is(err, io.EOF) {\n\t\treturn nil, hdr, errMalformed\n\t}\n\tif err != nil {\n\t\treturn nil, hdr, err\n\t}\n\n\thBuf := make([]byte, headerLen)\n\t_, err = io.ReadFull(bio, hBuf)\n\tif errors.Is(err, io.ErrUnexpectedEOF) || errors.Is(err, io.EOF) {\n\t\treturn nil, hdr, errMalformed","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/pion/webrtc/blob/8c25dc09fa9e7c09aac4309ead88093d760432b0/pkg/media/rtpdump/rtpdump.go#L3-L39","documentation":"errMalformed is the sentinel for structural corruption of an rtpdump file, returned by rtpdump.NewReader when the input is not a valid RTPDump: fewer than 36 bytes available for the preamble (EOF on peek/read), the preamble does not match the required \"#!rtpplay1.0 address/port\\n\" regular expression, or the 16-byte binary header is truncated (unexpected EOF). The offending input is any stream that is not a complete rtpplay1.0 recording.","triggerScenarios":"Thrown at pkg/media/rtpdump/rtpdump.go:21 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the file is a genuine rtpdump starting with the #!rtpplay1.0 address/port preamble line","Check the file is not truncated; regenerate or re-download the recording","Capture the file again with the original rtpdump tool instead of hand-editing it","Use errors.Is(err, rtpdump.ErrMalformed) to distinguish bad input from transient I/O errors"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8c25dc09fa9e7c09aac4309ead88093d760432b0","analyzedAt":"2026-09-03T21:56:56.182Z","contentChangedAt":"2026-09-03T21:56:56.182Z","schemaVersion":2},"datasetVersion":"2026-09-11T07:07:21.782Z"}