revid & rtp: fixed up some logging, line breaks, and simplified some decrements/increments

This commit is contained in:
saxon 2018-11-24 12:14:44 +10:30
parent 103bd2b91c
commit 5eb7225da9
5 changed files with 5 additions and 6 deletions

View File

@ -137,7 +137,6 @@ func (c *Config) Validate(r *Revid) error {
switch c.Input { switch c.Input {
case Raspivid: case Raspivid:
case File: case File:
c.Logger.Log(smartlogger.Info, pkg+"Using file input", "input")
case NothingDefined: case NothingDefined:
c.Logger.Log(smartlogger.Warning, pkg+"no input type defined, defaulting", "input", c.Logger.Log(smartlogger.Warning, pkg+"no input type defined, defaulting", "input",
defaultInput) defaultInput)
@ -161,7 +160,6 @@ func (c *Config) Validate(r *Revid) error {
return errors.New("bad bitrate and quantization combination for H264 input") return errors.New("bad bitrate and quantization combination for H264 input")
} }
} }
c.Logger.Log(smartlogger.Info, pkg+"Reading h264 codec", "inputCodec")
case Mjpeg: case Mjpeg:
if c.Quantization != "" { if c.Quantization != "" {
quantization, err := strconv.Atoi(c.Quantization) quantization, err := strconv.Atoi(c.Quantization)

View File

@ -391,6 +391,7 @@ loop:
} }
} }
} }
r.destination.release() r.destination.release()
r.config.Logger.Log(smartlogger.Debug, pkg+"done reading that clip from ring buffer") r.config.Logger.Log(smartlogger.Debug, pkg+"done reading that clip from ring buffer")
@ -488,6 +489,7 @@ func (r *Revid) setupInputForFile() error {
return err return err
} }
defer f.Close() defer f.Close()
// TODO(kortschak): Maybe we want a context.Context-aware parser that we can stop. // TODO(kortschak): Maybe we want a context.Context-aware parser that we can stop.
return r.lexTo(r.encoder, f, delay) return r.lexTo(r.encoder, f, delay)
} }

View File

@ -298,8 +298,7 @@ type udpSender struct {
chunk *ring.Chunk chunk *ring.Chunk
} }
func newUdpSender(addr string, log func(lvl int8, msg string, func newUdpSender(addr string, log func(lvl int8, msg string, args ...interface{})) (*udpSender, error) {
args ...interface{})) (*udpSender, error) {
conn, err := net.Dial("udp", addr) conn, err := net.Dial("udp", addr)
if err != nil { if err != nil {

View File

@ -207,7 +207,7 @@ func (e *Encoder) Encode(nalu []byte) error {
return err return err
} }
} }
e.psiCount -= 1 e.psiCount--
// Prepare PES data. // Prepare PES data.
pesPkt := pes.Packet{ pesPkt := pes.Packet{
StreamID: streamID, StreamID: streamID,

View File

@ -114,6 +114,6 @@ func (e *Encoder) nxtTimestamp() uint32 {
// nxtSeqNo gets the next rtp packet sequence number // nxtSeqNo gets the next rtp packet sequence number
func (e *Encoder) nxtSeqNo() uint16 { func (e *Encoder) nxtSeqNo() uint16 {
e.seqNo += 1 e.seqNo++
return e.seqNo - 1 return e.seqNo - 1
} }