diff --git a/codec/h264/h264dec/nalunit.go b/codec/h264/h264dec/nalunit.go index dd0248a1..e8ae3e3f 100644 --- a/codec/h264/h264dec/nalunit.go +++ b/codec/h264/h264dec/nalunit.go @@ -260,14 +260,13 @@ func NewNALUnit(br *bits.BitReader) (*NALUnit, error) { } for moreRBSPData(br) { - fmt.Println("here") next3Bytes, err := br.PeekBits(24) // If PeekBits cannot get 3 bytes, but there still might be 2 bytes left in // the source, we will get an io.EOF; we wish to ignore this and continue. // The call to moreRBSPData will determine when we have reached the end of // the NAL unit. - if err != nil && errors.Cause(err) != io.EOF { + if err != nil && errors.Cause(err) != io.ErrUnexpectedEOF { return nil, errors.Wrap(err, "could not Peek next 3 bytes") } diff --git a/codec/h264/h264dec/nalunit_test.go b/codec/h264/h264dec/nalunit_test.go index 419c6c5f..0099b8ba 100644 --- a/codec/h264/h264dec/nalunit_test.go +++ b/codec/h264/h264dec/nalunit_test.go @@ -173,7 +173,7 @@ func TestNewNALUnit(t *testing.T) { "0000 0010" + "0000 0100" + "0000 1000" + - "1000 0000", + "1000 0000", // trailing bits want: NALUnit{ ForbiddenZeroBit: 0, @@ -198,7 +198,6 @@ func TestNewNALUnit(t *testing.T) { 0x02, 0x04, 0x08, - 0x80, }, }, }, @@ -221,6 +220,7 @@ func TestNewNALUnit(t *testing.T) { } } +// nalEqual returns true if two NALUnits are equal. func nalEqual(a, b NALUnit) bool { aCopy := a bCopy := b