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,10 +63,10 @@ func Lex(dst io.Writer, src io.Reader, delay time.Duration) error {
|
|||
return nil
|
||||
}
|
||||
if err != nil {
|
||||
if err != io.EOF {
|
||||
return err
|
||||
if err == io.EOF {
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
if !bytes.Equal(buf, []byte{0xff, 0xd8}) {
|
||||
return fmt.Errorf("parser: not MJPEG frame start: %#v", buf)
|
||||
|
@ -75,10 +75,10 @@ func Lex(dst io.Writer, src io.Reader, delay time.Duration) error {
|
|||
for {
|
||||
b, err := r.ReadByte()
|
||||
if err != nil {
|
||||
if err != io.EOF {
|
||||
return err
|
||||
if err == io.EOF {
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
buf = append(buf, b)
|
||||
if last == 0xff && b == 0xd9 {
|
||||
|
|
Loading…
Reference in New Issue