diff --git a/codec/h265/lex_test.go b/codec/h265/lex_test.go index fac1dcc2..637a1860 100644 --- a/codec/h265/lex_test.go +++ b/codec/h265/lex_test.go @@ -45,7 +45,11 @@ func (r *rtpReader) Read(p []byte) (int, error) { } b := r.packets[r.idx] n := copy(p, b) - r.idx++ + if n < len(r.packets[r.idx]) { + r.packets[r.idx] = r.packets[r.idx][n:] + } else { + r.idx++ + } return n, nil }