mirror of https://bitbucket.org/ausocean/av.git
codec/mjpeg/lex.go: returning nil error from Lex if we get io.EOF on reading bytes
This commit is contained in:
parent
8df837ee49
commit
1c9146eec0
|
@ -63,7 +63,10 @@ func Lex(dst io.Writer, src io.Reader, delay time.Duration) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
if err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
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)
|
||||||
|
@ -72,7 +75,10 @@ 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 {
|
||||||
return err
|
if err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
buf = append(buf, b)
|
buf = append(buf, b)
|
||||||
if last == 0xff && b == 0xd9 {
|
if last == 0xff && b == 0xd9 {
|
||||||
|
|
Loading…
Reference in New Issue