mirror of https://bitbucket.org/ausocean/av.git
revid: use time.Duration for durations
This commit is contained in:
parent
576815a10f
commit
3da57cbe46
|
@ -52,16 +52,16 @@ import (
|
|||
|
||||
// Misc constants
|
||||
const (
|
||||
clipDuration = 1 // s
|
||||
mp2tPacketSize = 188 // MPEG-TS packet size
|
||||
mp2tMaxPackets = 2016 * clipDuration // # first multiple of 7 and 8 greater than 2000
|
||||
clipDuration = 1 * time.Second
|
||||
mp2tPacketSize = 188 // MPEG-TS packet size
|
||||
mp2tMaxPackets = int(clipDuration * 2016 / time.Second) // # first multiple of 7 and 8 greater than 2000
|
||||
ringBufferSize = 500
|
||||
ringBufferElementSize = 150000
|
||||
writeTimeout = 10 * time.Millisecond
|
||||
readTimeout = 10 * time.Millisecond
|
||||
httpTimeOut = 5 // s
|
||||
httpTimeout = 5 * time.Second
|
||||
packetsPerFrame = 7
|
||||
bitrateTime = 60 // s
|
||||
bitrateTime = 1 * time.Minute
|
||||
mjpegParserInChanLen = 100000
|
||||
ffmpegPath = "/usr/local/bin/ffmpeg"
|
||||
rtmpConnectionTimout = 10
|
||||
|
@ -72,7 +72,7 @@ const (
|
|||
clipSizeThreshold = 11
|
||||
rtmpConnectionMaxTries = 5
|
||||
raspividNoOfTries = 3
|
||||
sendingWaitTime = time.Duration(5) * time.Millisecond
|
||||
sendingWaitTime = 5 * time.Millisecond
|
||||
)
|
||||
|
||||
// Log Types
|
||||
|
@ -446,7 +446,7 @@ func (r *revid) outputClips() {
|
|||
// Log some information regarding bitrate and ring buffer size if it's time
|
||||
now = time.Now()
|
||||
deltaTime := now.Sub(prevTime)
|
||||
if deltaTime > time.Duration(bitrateTime)*time.Second {
|
||||
if deltaTime > bitrateTime {
|
||||
r.currentBitrate = int64(float64(bytes*8) / float64(deltaTime/1e9))
|
||||
r.Log(Debug, fmt.Sprintf("Bitrate: %v bits/s\n", r.currentBitrate))
|
||||
r.Log(Debug, fmt.Sprintf("Ring buffer size: %v\n", r.ringBuffer.Len()))
|
||||
|
@ -470,8 +470,7 @@ func (r *revid) sendClipToHTTP(clip *ring.Chunk) error {
|
|||
defer r.sendMutex.Unlock()
|
||||
r.sendMutex.Lock()
|
||||
|
||||
timeout := time.Duration(httpTimeOut * time.Second)
|
||||
client := http.Client{Timeout: timeout}
|
||||
client := http.Client{Timeout: httpTimeout}
|
||||
url := r.config.HttpAddress + strconv.Itoa(clip.Len())
|
||||
|
||||
// FIXME(kortschak): This is necessary because Post takes
|
||||
|
|
Loading…
Reference in New Issue