mirror of https://bitbucket.org/ausocean/av.git
Merged in performance-fix (pull request #238)
revid: increase sender ring buffer read timeouts to slow down output loops Approved-by: Alan Noble <anoble@gmail.com>
This commit is contained in:
commit
cd162c086f
|
@ -50,6 +50,12 @@ import (
|
||||||
// Log is used by the multiSender.
|
// Log is used by the multiSender.
|
||||||
type Log func(level int8, message string, params ...interface{})
|
type Log func(level int8, message string, params ...interface{})
|
||||||
|
|
||||||
|
// Sender ring buffer read timeouts.
|
||||||
|
const (
|
||||||
|
rtmpRBReadTimeout = 1 * time.Second
|
||||||
|
mtsRBReadTimeout = 1 * time.Second
|
||||||
|
)
|
||||||
|
|
||||||
// httpSender provides an implemntation of io.Writer to perform sends to a http
|
// httpSender provides an implemntation of io.Writer to perform sends to a http
|
||||||
// destination.
|
// destination.
|
||||||
type httpSender struct {
|
type httpSender struct {
|
||||||
|
@ -192,7 +198,7 @@ func (s *mtsSender) output() {
|
||||||
// If chunk is nil then we're ready to get another from the ringBuffer.
|
// If chunk is nil then we're ready to get another from the ringBuffer.
|
||||||
if chunk == nil {
|
if chunk == nil {
|
||||||
var err error
|
var err error
|
||||||
chunk, err = s.ring.Next(0)
|
chunk, err = s.ring.Next(mtsRBReadTimeout)
|
||||||
switch err {
|
switch err {
|
||||||
case nil, io.EOF:
|
case nil, io.EOF:
|
||||||
continue
|
continue
|
||||||
|
@ -301,7 +307,7 @@ func (s *rtmpSender) output() {
|
||||||
// If chunk is nil then we're ready to get another from the ring buffer.
|
// If chunk is nil then we're ready to get another from the ring buffer.
|
||||||
if chunk == nil {
|
if chunk == nil {
|
||||||
var err error
|
var err error
|
||||||
chunk, err = s.ring.Next(0)
|
chunk, err = s.ring.Next(rtmpRBReadTimeout)
|
||||||
switch err {
|
switch err {
|
||||||
case nil, io.EOF:
|
case nil, io.EOF:
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue