mirror of https://bitbucket.org/ausocean/av.git
Merged in fix-mjpeg-lex (pull request #261)
codec/mjpeg/lex.go: returning nil error from Lex if we get io.EOF on reading bytes Approved-by: Alan Noble <anoble@gmail.com>
This commit is contained in:
commit
38eed6bb2d
|
@ -63,6 +63,9 @@ func Lex(dst io.Writer, src io.Reader, delay time.Duration) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if err == io.EOF {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !bytes.Equal(buf, []byte{0xff, 0xd8}) {
|
if !bytes.Equal(buf, []byte{0xff, 0xd8}) {
|
||||||
|
@ -72,6 +75,9 @@ func Lex(dst io.Writer, src io.Reader, delay time.Duration) error {
|
||||||
for {
|
for {
|
||||||
b, err := r.ReadByte()
|
b, err := r.ReadByte()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if err == io.EOF {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
buf = append(buf, b)
|
buf = append(buf, b)
|
||||||
|
|
Loading…
Reference in New Issue