From 1fb4381b8e600bf90fe86a1266f87818ac06f877 Mon Sep 17 00:00:00 2001 From: Saxon Date: Thu, 9 May 2019 14:35:21 +0930 Subject: [PATCH] codec/lex/lex_test.go: rtpRead.Read() checks for incomplete reads of packets buffer and resizes accordingly --- codec/h265/lex_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 }