mirror of https://bitbucket.org/ausocean/av.git
Merged in cpu-fix (pull request #135)
Cpu fix Approved-by: kortschak <dan@kortschak.io>
This commit is contained in:
commit
865ce3e7a2
|
@ -145,22 +145,27 @@ func (p *packer) Write(frame []byte) (int, error) {
|
||||||
p.owner.config.Logger.Log(logger.Warning, pkg+"frame was too big", "frame size", len(frame))
|
p.owner.config.Logger.Log(logger.Warning, pkg+"frame was too big", "frame size", len(frame))
|
||||||
return len(frame), nil
|
return len(frame), nil
|
||||||
}
|
}
|
||||||
n, err := p.owner.buffer.Write(frame)
|
|
||||||
|
if len(p.owner.destination) != 0 {
|
||||||
|
n, err := p.owner.buffer.Write(frame)
|
||||||
|
if err != nil {
|
||||||
|
if err == ring.ErrDropped {
|
||||||
|
p.owner.config.Logger.Log(logger.Warning, pkg+"dropped frame", "frame size", len(frame))
|
||||||
|
return len(frame), nil
|
||||||
|
}
|
||||||
|
p.owner.config.Logger.Log(logger.Error, pkg+"unexpected ring buffer write error", "error", err.Error())
|
||||||
|
return n, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If we have an rtp sender bypass ringbuffer and give straight to sender
|
// If we have an rtp sender bypass ringbuffer and give straight to sender
|
||||||
if p.owner.rtpSender != nil {
|
if p.owner.rtpSender != nil {
|
||||||
err = p.owner.rtpSender.send(frame)
|
err := p.owner.rtpSender.send(frame)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
p.owner.config.Logger.Log(logger.Error, pkg+"rtp send failed with error", "error", err.Error())
|
p.owner.config.Logger.Log(logger.Error, pkg+"rtp send failed with error", "error", err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
if err == ring.ErrDropped {
|
|
||||||
p.owner.config.Logger.Log(logger.Warning, pkg+"dropped frame", "frame size", len(frame))
|
|
||||||
return len(frame), nil
|
|
||||||
}
|
|
||||||
p.owner.config.Logger.Log(logger.Error, pkg+"unexpected ring buffer write error", "error", err.Error())
|
|
||||||
return n, err
|
|
||||||
}
|
|
||||||
p.packetCount++
|
p.packetCount++
|
||||||
var hasRtmp bool
|
var hasRtmp bool
|
||||||
for _, d := range p.owner.config.Outputs {
|
for _, d := range p.owner.config.Outputs {
|
||||||
|
|
Loading…
Reference in New Issue