mirror of https://bitbucket.org/ausocean/av.git
revid/senders.go: reportSent -> report
This commit is contained in:
parent
9a0fa09879
commit
cdd74c7a22
|
@ -59,17 +59,17 @@ const (
|
|||
// httpSender provides an implemntation of io.Writer to perform sends to a http
|
||||
// destination.
|
||||
type httpSender struct {
|
||||
client *netsender.Sender
|
||||
log func(lvl int8, msg string, args ...interface{})
|
||||
reportSent func(sent int)
|
||||
client *netsender.Sender
|
||||
log func(lvl int8, msg string, args ...interface{})
|
||||
report func(sent int)
|
||||
}
|
||||
|
||||
// newHttpSender returns a pointer to a new httpSender.
|
||||
func newHttpSender(ns *netsender.Sender, log func(lvl int8, msg string, args ...interface{}), reportSent func(sent int)) *httpSender {
|
||||
func newHttpSender(ns *netsender.Sender, log func(lvl int8, msg string, args ...interface{}), report func(sent int)) *httpSender {
|
||||
return &httpSender{
|
||||
client: ns,
|
||||
log: log,
|
||||
reportSent: reportSent,
|
||||
client: ns,
|
||||
log: log,
|
||||
report: report,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ func newHttpSender(ns *netsender.Sender, log func(lvl int8, msg string, args ...
|
|||
func (s *httpSender) Write(d []byte) (int, error) {
|
||||
err := httpSend(d, s.client, s.log)
|
||||
if err == nil {
|
||||
s.reportSent(len(d))
|
||||
s.report(len(d))
|
||||
}
|
||||
return len(d), err
|
||||
}
|
||||
|
@ -274,18 +274,18 @@ func (s *mtsSender) Close() error {
|
|||
|
||||
// rtmpSender implements loadSender for a native RTMP destination.
|
||||
type rtmpSender struct {
|
||||
conn *rtmp.Conn
|
||||
url string
|
||||
timeout uint
|
||||
retries int
|
||||
log func(lvl int8, msg string, args ...interface{})
|
||||
ring *vring.Buffer
|
||||
done chan struct{}
|
||||
wg sync.WaitGroup
|
||||
reportSent func(sent int)
|
||||
conn *rtmp.Conn
|
||||
url string
|
||||
timeout uint
|
||||
retries int
|
||||
log func(lvl int8, msg string, args ...interface{})
|
||||
ring *vring.Buffer
|
||||
done chan struct{}
|
||||
wg sync.WaitGroup
|
||||
report func(sent int)
|
||||
}
|
||||
|
||||
func newRtmpSender(url string, timeout uint, retries int, rb *vring.Buffer, log func(lvl int8, msg string, args ...interface{}), reportSent func(sent int)) (*rtmpSender, error) {
|
||||
func newRtmpSender(url string, timeout uint, retries int, rb *vring.Buffer, log func(lvl int8, msg string, args ...interface{}), report func(sent int)) (*rtmpSender, error) {
|
||||
var conn *rtmp.Conn
|
||||
var err error
|
||||
for n := 0; n < retries; n++ {
|
||||
|
@ -299,14 +299,14 @@ func newRtmpSender(url string, timeout uint, retries int, rb *vring.Buffer, log
|
|||
}
|
||||
}
|
||||
s := &rtmpSender{
|
||||
conn: conn,
|
||||
url: url,
|
||||
timeout: timeout,
|
||||
retries: retries,
|
||||
log: log,
|
||||
ring: rb,
|
||||
done: make(chan struct{}),
|
||||
reportSent: reportSent,
|
||||
conn: conn,
|
||||
url: url,
|
||||
timeout: timeout,
|
||||
retries: retries,
|
||||
log: log,
|
||||
ring: rb,
|
||||
done: make(chan struct{}),
|
||||
report: report,
|
||||
}
|
||||
s.wg.Add(1)
|
||||
go s.output()
|
||||
|
@ -372,7 +372,7 @@ func (s *rtmpSender) Write(d []byte) (int, error) {
|
|||
if err != nil {
|
||||
s.log(logger.Warning, pkg+"rtmpSender: ring buffer write error", "error", err.Error())
|
||||
}
|
||||
s.reportSent(len(d))
|
||||
s.report(len(d))
|
||||
return len(d), nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue