mirror of https://bitbucket.org/ausocean/av.git
revid: rename GetBitrate to Bitrate
Also change to int; when we get more than 2Gbs^-1, we'll probably be using 64 bit devices.
This commit is contained in:
parent
5bdd66e22b
commit
6de4f8c9a6
|
@ -306,7 +306,7 @@ func sendTo(ns *netsender.Sender) error {
|
||||||
inputs := netsender.MakePins(ns.GetConfigParam("ip"), "X")
|
inputs := netsender.MakePins(ns.GetConfigParam("ip"), "X")
|
||||||
for i, pin := range inputs {
|
for i, pin := range inputs {
|
||||||
if pin.Name == "X23" {
|
if pin.Name == "X23" {
|
||||||
inputs[i].Value = int(revidInst.GetBitrate())
|
inputs[i].Value = revidInst.Bitrate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ type Revid struct {
|
||||||
getFrame func() []byte
|
getFrame func() []byte
|
||||||
destination loadSender
|
destination loadSender
|
||||||
rtmpInst rtmp.Session
|
rtmpInst rtmp.Session
|
||||||
currentBitrate int64
|
bitrate int
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRevid returns a pointer to a new Revid with the desired
|
// NewRevid returns a pointer to a new Revid with the desired
|
||||||
|
@ -116,10 +116,9 @@ func New(c Config) (*Revid, error) {
|
||||||
return &r, nil
|
return &r, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the currently saved bitrate from the most recent bitrate check
|
// Bitrate returns the result of the most recent bitrate check.
|
||||||
// check bitrate output delay in consts for this period
|
func (r *Revid) Bitrate() int {
|
||||||
func (r *Revid) GetBitrate() int64 {
|
return r.bitrate
|
||||||
return r.currentBitrate
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetConfigRef returns a pointer to the revidInst's Config struct object
|
// GetConfigRef returns a pointer to the revidInst's Config struct object
|
||||||
|
@ -417,8 +416,9 @@ func (r *Revid) outputClips() {
|
||||||
now = time.Now()
|
now = time.Now()
|
||||||
deltaTime := now.Sub(prevTime)
|
deltaTime := now.Sub(prevTime)
|
||||||
if deltaTime > bitrateTime {
|
if deltaTime > bitrateTime {
|
||||||
r.currentBitrate = int64(float64(bytes*8) / float64(deltaTime/1e9))
|
// FIXME(kortschak): For subsecond deltaTime, this will give infinite bitrate.
|
||||||
r.Log(Debug, fmt.Sprintf("Bitrate: %v bits/s\n", r.currentBitrate))
|
r.bitrate = int(float64(bytes*8) / float64(deltaTime/time.Second))
|
||||||
|
r.Log(Debug, fmt.Sprintf("Bitrate: %v bits/s\n", r.bitrate))
|
||||||
r.Log(Debug, fmt.Sprintf("Ring buffer size: %v\n", r.ringBuffer.Len()))
|
r.Log(Debug, fmt.Sprintf("Ring buffer size: %v\n", r.ringBuffer.Len()))
|
||||||
prevTime = now
|
prevTime = now
|
||||||
bytes = 0
|
bytes = 0
|
||||||
|
|
Loading…
Reference in New Issue