stream/flv & stream/mts: updated commenting for flv and mts encoders

This commit is contained in:
Saxon 2019-03-10 13:04:15 +10:30
parent 9f4f9e8920
commit f55daa02c1
3 changed files with 5 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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)) {