stream/flv: fixed what encoder.Write is doing with it's integer return value

This commit is contained in:
Saxon 2019-03-14 11:37:45 +10:30
parent 00f2b66a8b
commit 61d70dc9a6
1 changed files with 8 additions and 8 deletions

View File

@ -184,9 +184,9 @@ func (e *Encoder) Write(frame []byte) (int, error) {
// See https://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf
// section E.3.
var zero [4]byte
n, err := e.dst.Write(zero[:])
_, err := e.dst.Write(zero[:])
if err != nil {
return n, err
return 0, err
}
}
timeStamp := e.getNextTimestamp()
@ -215,9 +215,9 @@ func (e *Encoder) Write(frame []byte) (int, error) {
Data: frame,
PrevTagSize: uint32(videoHeaderSize + len(frame)),
}
n, err := e.dst.Write(tag.Bytes())
_, err := e.dst.Write(tag.Bytes())
if err != nil {
return n, err
return len(frame), err
}
}
// Do we even have some audio to send off ?
@ -236,9 +236,9 @@ func (e *Encoder) Write(frame []byte) (int, error) {
Data: dummyAudioTag1Data,
PrevTagSize: uint32(audioSize),
}
n, err := e.dst.Write(tag.Bytes())
_, err := e.dst.Write(tag.Bytes())
if err != nil {
return n, err
return len(frame), err
}
tag = AudioTag{
@ -253,9 +253,9 @@ func (e *Encoder) Write(frame []byte) (int, error) {
Data: dummyAudioTag2Data,
PrevTagSize: uint32(22),
}
n, err = e.dst.Write(tag.Bytes())
_, err = e.dst.Write(tag.Bytes())
if err != nil {
return n, err
return len(frame), err
}
}