diff --git a/codec/h264/lex.go b/codec/h264/lex.go index 633d3f53..6159a15e 100644 --- a/codec/h264/lex.go +++ b/codec/h264/lex.go @@ -72,7 +72,13 @@ func Lex(dst io.Writer, src io.Reader, delay time.Duration) error { var err error buf, b, err = c.ScanUntil(buf, 0x00) if err != nil { - return err + if err != io.EOF { + return err + } + if len(buf) != 0 { + return io.ErrUnexpectedEOF + } + return io.EOF } for n := 1; b == 0x0 && n < 4; n++ {