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")
|
||||
for i, pin := range inputs {
|
||||
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
|
||||
destination loadSender
|
||||
rtmpInst rtmp.Session
|
||||
currentBitrate int64
|
||||
bitrate int
|
||||
}
|
||||
|
||||
// NewRevid returns a pointer to a new Revid with the desired
|
||||
|
@ -116,10 +116,9 @@ func New(c Config) (*Revid, error) {
|
|||
return &r, nil
|
||||
}
|
||||
|
||||
// Returns the currently saved bitrate from the most recent bitrate check
|
||||
// check bitrate output delay in consts for this period
|
||||
func (r *Revid) GetBitrate() int64 {
|
||||
return r.currentBitrate
|
||||
// Bitrate returns the result of the most recent bitrate check.
|
||||
func (r *Revid) Bitrate() int {
|
||||
return r.bitrate
|
||||
}
|
||||
|
||||
// GetConfigRef returns a pointer to the revidInst's Config struct object
|
||||
|
@ -417,8 +416,9 @@ func (r *Revid) outputClips() {
|
|||
now = time.Now()
|
||||
deltaTime := now.Sub(prevTime)
|
||||
if deltaTime > bitrateTime {
|
||||
r.currentBitrate = int64(float64(bytes*8) / float64(deltaTime/1e9))
|
||||
r.Log(Debug, fmt.Sprintf("Bitrate: %v bits/s\n", r.currentBitrate))
|
||||
// FIXME(kortschak): For subsecond deltaTime, this will give infinite bitrate.
|
||||
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()))
|
||||
prevTime = now
|
||||
bytes = 0
|
||||
|
|
Loading…
Reference in New Issue