mirror of https://bitbucket.org/ausocean/av.git
codec/mjpeg/lex.go changed error checks for io.EOF to positive checks
This commit is contained in:
parent
1c9146eec0
commit
7181532ccb
|
@ -63,11 +63,11 @@ 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 {
|
if err == io.EOF {
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
if !bytes.Equal(buf, []byte{0xff, 0xd8}) {
|
if !bytes.Equal(buf, []byte{0xff, 0xd8}) {
|
||||||
return fmt.Errorf("parser: not MJPEG frame start: %#v", buf)
|
return fmt.Errorf("parser: not MJPEG frame start: %#v", buf)
|
||||||
}
|
}
|
||||||
|
@ -75,11 +75,11 @@ 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 {
|
if err == io.EOF {
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
buf = append(buf, b)
|
buf = append(buf, b)
|
||||||
if last == 0xff && b == 0xd9 {
|
if last == 0xff && b == 0xd9 {
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue