updating remote

This commit is contained in:
saxon.milton@gmail.com 2018-03-13 19:44:30 +10:30
parent 3f9c73a612
commit 31eb35b5e8
3 changed files with 7 additions and 8 deletions

View File

@ -86,7 +86,7 @@ const (
defaultHeight = "720" defaultHeight = "720"
defaultIntraRefreshPeriod = "100" defaultIntraRefreshPeriod = "100"
defaultTimeout = "0" defaultTimeout = "0"
defaultQuantization = "35" defaultQuantization = "40"
defaultBitrate = "0" defaultBitrate = "0"
) )

View File

@ -59,12 +59,12 @@ const (
clipDuration = 1 // s clipDuration = 1 // s
mp2tPacketSize = 188 // MPEG-TS packet size mp2tPacketSize = 188 // MPEG-TS packet size
mp2tMaxPackets = 2016 * clipDuration // # first multiple of 7 and 8 greater than 2000 mp2tMaxPackets = 2016 * clipDuration // # first multiple of 7 and 8 greater than 2000
ringBufferSize = 1000 / clipDuration ringBufferSize = 100 / clipDuration
ringBufferElementSize = 100000 ringBufferElementSize = 100000
maxClipSize = 100000 maxClipSize = 100000
httpTimeOut = 5 // s httpTimeOut = 5 // s
packetsPerFrame = 7 packetsPerFrame = 7
h264BufferSize = 100000 h264BufferSize = 1000000
bitrateTime = 60 bitrateTime = 60
mjpegParserInChanLen = 100000 mjpegParserInChanLen = 100000
ffmpegPath = "/home/saxon/bin/ffmpeg" ffmpegPath = "/home/saxon/bin/ffmpeg"
@ -311,15 +311,13 @@ func (r *revidInst) outputClips() {
now := time.Now() now := time.Now()
prevTime := now prevTime := now
bytes := 0 bytes := 0
delay := 0 fps, _ := strconv.Atoi(r.config.FrameRate)
delay := int64(float64(1000) / float64(fps))
for r.isRunning { for r.isRunning {
// Here we slow things down as much as we can to decrease cpu usage // Here we slow things down as much as we can to decrease cpu usage
switch { switch {
case r.ringBuffer.GetNoOfElements() < 2: case r.ringBuffer.GetNoOfElements() < 2:
delay++
time.Sleep(time.Duration(delay) * time.Millisecond) time.Sleep(time.Duration(delay) * time.Millisecond)
case delay > 10:
delay -= 10
} }
// If the ringbuffer has something we can read and send off // If the ringbuffer has something we can read and send off
if clip, err := r.ringBuffer.Read(); err == nil { if clip, err := r.ringBuffer.Read(); err == nil {

View File

@ -170,6 +170,7 @@ func TestRtmpOutputUsingLibRtmp(t *testing.T){
*/ */
// Test revidInst with a Raspivid h264 input // Test revidInst with a Raspivid h264 input
func TestRaspividToRtmp(t *testing.T){ func TestRaspividToRtmp(t *testing.T){
config := Config{ config := Config{
@ -187,7 +188,7 @@ func TestRaspividToRtmp(t *testing.T){
return return
} }
revidInst.Start() revidInst.Start()
time.Sleep(120*time.Second) time.Sleep(240*time.Second)
revidInst.Stop() revidInst.Stop()
} }