mirror of https://bitbucket.org/ausocean/av.git
flv: fixed NewEncoder so that we still create encoder even if the HeaderByte write fails
This commit is contained in:
parent
83f5e9e68d
commit
b63c55ae48
|
@ -185,7 +185,7 @@ func TestFromFrame(t *testing.T) {
|
||||||
|
|
||||||
const frameRate = 25
|
const frameRate = 25
|
||||||
flvEncoder, err := flv.NewEncoder(s, true, true, frameRate)
|
flvEncoder, err := flv.NewEncoder(s, true, true, frameRate)
|
||||||
if err != nil {
|
if err != nil && err != errTinyPacket {
|
||||||
t.Errorf("Failed to create flv encoder with error: %v", err)
|
t.Errorf("Failed to create flv encoder with error: %v", err)
|
||||||
}
|
}
|
||||||
err = lex.H264(flvEncoder, bytes.NewReader(videoData), time.Second/time.Duration(frameRate))
|
err = lex.H264(flvEncoder, bytes.NewReader(videoData), time.Second/time.Duration(frameRate))
|
||||||
|
|
|
@ -73,9 +73,6 @@ func NewEncoder(dst io.Writer, audio, video bool, fps int) (*Encoder, error) {
|
||||||
video: video,
|
video: video,
|
||||||
}
|
}
|
||||||
_, err := dst.Write(e.HeaderBytes())
|
_, err := dst.Write(e.HeaderBytes())
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return &e, err
|
return &e, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue