codec/h264/h264dec: wrote explantory comment for neglectance of io.EOF error when peeking in RBSP parsing process

This commit is contained in:
Saxon 2019-07-21 21:22:55 +09:30
parent 4d65d0d433
commit 865c1676da
1 changed files with 5 additions and 0 deletions

View File

@ -262,6 +262,11 @@ func NewNALUnit(br *bits.BitReader) (*NALUnit, error) {
for moreRBSPData(br) {
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 {
return nil, errors.Wrap(err, "could not Peek next 3 bytes")
}