From f55daa02c1f40784463f13bbd8b3e6f7a515c6ca Mon Sep 17 00:00:00 2001 From: Saxon Date: Sun, 10 Mar 2019 13:04:15 +1030 Subject: [PATCH] stream/flv & stream/mts: updated commenting for flv and mts encoders --- stream/encoding.go | 1 + stream/flv/encoder.go | 4 ++-- stream/mts/encoder.go | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/stream/encoding.go b/stream/encoding.go index 493f6b83..6841c4fc 100644 --- a/stream/encoding.go +++ b/stream/encoding.go @@ -42,6 +42,7 @@ type noop struct { dst io.Writer } +// Write implements io.Writer. func (e noop) Write(p []byte) (int, error) { n, err := e.dst.Write(p) return n, err diff --git a/stream/flv/encoder.go b/stream/flv/encoder.go index a340b182..c9281873 100644 --- a/stream/flv/encoder.go +++ b/stream/flv/encoder.go @@ -187,8 +187,8 @@ func (s *frameScanner) readByte() (b byte, ok bool) { return b, true } -// generate takes in raw video data from the input chan and packetises it into -// flv tags, which are then passed to the output channel. +// write implements io.Writer. It takes raw h264 and encodes into flv, then +// writes to the encoders io.Writer destination. func (e *Encoder) Write(frame []byte) (int, error) { var frameType byte var packetType byte diff --git a/stream/mts/encoder.go b/stream/mts/encoder.go index ca534985..70434876 100644 --- a/stream/mts/encoder.go +++ b/stream/mts/encoder.go @@ -178,8 +178,8 @@ func (e *Encoder) TimeBasedPsi(b bool, sendCount int) { e.pktCount = e.psiSendCount } -// generate handles the incoming data and generates equivalent mpegts packets - -// sending them to the output channel. +// Write implements io.Writer. Write takes raw h264 and encodes into mpegts, +// then sending it to the encoder's io.Writer destination. func (e *Encoder) Write(nalu []byte) (int, error) { now := time.Now() if (e.timeBasedPsi && (now.Sub(e.psiLastTime) > psiInterval)) || (!e.timeBasedPsi && (e.pktCount >= e.psiSendCount)) {