From 61d70dc9a63b605652f0fc238b7031546d1faefb Mon Sep 17 00:00:00 2001 From: Saxon Date: Thu, 14 Mar 2019 11:37:45 +1030 Subject: [PATCH] stream/flv: fixed what encoder.Write is doing with it's integer return value --- stream/flv/encoder.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/stream/flv/encoder.go b/stream/flv/encoder.go index fbf7dbc3..ec1a4968 100644 --- a/stream/flv/encoder.go +++ b/stream/flv/encoder.go @@ -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 } }