From f89e0aefb54b773538021ce41c0f1c3212f94498 Mon Sep 17 00:00:00 2001 From: saxon Date: Sat, 8 Dec 2018 01:14:42 +1030 Subject: [PATCH 1/3] revid: increased number of mpegts packets per clip so that we can send more --- revid/revid.go | 4 ++-- revid/senders.go | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/revid/revid.go b/revid/revid.go index 466d5b8a..e0a96f0b 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -58,7 +58,7 @@ const ( writeTimeout = 10 * time.Millisecond readTimeout = 10 * time.Millisecond httpTimeout = 5 * time.Second - packetsPerFrame = 7 + packetsPerClip = 560 bitrateTime = 1 * time.Minute mjpegParserInChanLen = 100000 ffmpegPath = "/usr/local/bin/ffmpeg" @@ -154,7 +154,7 @@ func (p *packer) Write(frame []byte) (int, error) { return n, err } p.packetCount++ - if p.packetCount >= p.owner.config.FramesPerClip { + if p.packetCount >= packetsPerClip { p.owner.buffer.Flush() p.packetCount = 0 } diff --git a/revid/senders.go b/revid/senders.go index c4ab9cfc..ab7a4c9c 100644 --- a/revid/senders.go +++ b/revid/senders.go @@ -29,6 +29,7 @@ LICENSE package revid import ( + "fmt" "io" "net" "os" @@ -41,6 +42,8 @@ import ( "bitbucket.org/ausocean/utils/smartlogger" ) +var count int = 0 + // loadSender is a destination to send a *ring.Chunk to. // When a loadSender has finished using the *ring.Chunk // it must be Closed. @@ -136,6 +139,8 @@ func (s *httpSender) send() error { for i, pin := range pins { if pin.Name == "V0" { send = true + count += s.chunk.Len() + fmt.Println(count) pins[i].Value = s.chunk.Len() pins[i].Data = s.chunk.Bytes() pins[i].MimeType = "video/mp2t" From cfff3316b4d964c3eb4f6d575bea04fc2f3c40d4 Mon Sep 17 00:00:00 2001 From: saxon Date: Sat, 8 Dec 2018 01:43:10 +1030 Subject: [PATCH 2/3] revid: updated revid packetsPerClip const from 7 to 560 to speed up data sending --- revid/senders.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/revid/senders.go b/revid/senders.go index ab7a4c9c..c4ab9cfc 100644 --- a/revid/senders.go +++ b/revid/senders.go @@ -29,7 +29,6 @@ LICENSE package revid import ( - "fmt" "io" "net" "os" @@ -42,8 +41,6 @@ import ( "bitbucket.org/ausocean/utils/smartlogger" ) -var count int = 0 - // loadSender is a destination to send a *ring.Chunk to. // When a loadSender has finished using the *ring.Chunk // it must be Closed. @@ -139,8 +136,6 @@ func (s *httpSender) send() error { for i, pin := range pins { if pin.Name == "V0" { send = true - count += s.chunk.Len() - fmt.Println(count) pins[i].Value = s.chunk.Len() pins[i].Data = s.chunk.Bytes() pins[i].MimeType = "video/mp2t" From f5a571547d80e1ee96d5bee47316a2363c24de7b Mon Sep 17 00:00:00 2001 From: saxon Date: Sat, 8 Dec 2018 01:54:20 +1030 Subject: [PATCH 3/3] revid: using config to define default packetsPerClipValue --- revid/config.go | 2 +- revid/revid.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/revid/config.go b/revid/config.go index aeb35f4e..72165f60 100644 --- a/revid/config.go +++ b/revid/config.go @@ -108,7 +108,7 @@ const ( defaultFramesPerClip = 1 defaultVerticalFlip = No defaultHorizontalFlip = No - httpFramesPerClip = 7 + httpFramesPerClip = 560 defaultInputCodec = H264 defaultVerbosity = No defaultRtpAddr = "localhost:6970" diff --git a/revid/revid.go b/revid/revid.go index e0a96f0b..5baf69ed 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -58,7 +58,6 @@ const ( writeTimeout = 10 * time.Millisecond readTimeout = 10 * time.Millisecond httpTimeout = 5 * time.Second - packetsPerClip = 560 bitrateTime = 1 * time.Minute mjpegParserInChanLen = 100000 ffmpegPath = "/usr/local/bin/ffmpeg" @@ -154,7 +153,7 @@ func (p *packer) Write(frame []byte) (int, error) { return n, err } p.packetCount++ - if p.packetCount >= packetsPerClip { + if p.packetCount >= p.owner.config.FramesPerClip { p.owner.buffer.Flush() p.packetCount = 0 }