codec/h264/h264dec: fixed problem with test

This commit is contained in:
Saxon 2019-08-01 02:37:34 +09:30
parent 42d57eb044
commit 311c44f55c
2 changed files with 3 additions and 4 deletions

View File

@ -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")
}

View File

@ -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