mirror of https://bitbucket.org/ausocean/av.git
Just updating remote
This commit is contained in:
parent
e1563ba7b5
commit
c73afb65f3
|
@ -58,12 +58,13 @@ 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
|
||||||
bufferSize = 100 / clipDuration
|
ringBufferSize = 100 / clipDuration
|
||||||
|
ringBufferElementSize = 500000
|
||||||
httpTimeOut = 5 // s
|
httpTimeOut = 5 // s
|
||||||
packetsPerFrame = 7
|
packetsPerFrame = 7
|
||||||
h264BufferSize = 500000
|
h264BufferSize = 500000
|
||||||
bitrateTime = 60
|
bitrateTime = 60
|
||||||
mjpegParserInChanLen = 10000
|
mjpegParserInChanLen = 100000
|
||||||
)
|
)
|
||||||
|
|
||||||
// Log Types
|
// Log Types
|
||||||
|
@ -149,7 +150,7 @@ type revidInst struct {
|
||||||
// successful.
|
// successful.
|
||||||
func NewRevidInstance(config Config) (r *revidInst, err error) {
|
func NewRevidInstance(config Config) (r *revidInst, err error) {
|
||||||
r = new(revidInst)
|
r = new(revidInst)
|
||||||
r.ringBuffer = ringbuffer.NewRingBuffer(bufferSize, mp2tPacketSize*mp2tMaxPackets)
|
r.ringBuffer = ringbuffer.NewRingBuffer(ringBufferSize, ringBufferElementSize)
|
||||||
err = r.ChangeState(config)
|
err = r.ChangeState(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -175,6 +176,7 @@ func NewRevidInstance(config Config) (r *revidInst, err error) {
|
||||||
case Mjpeg:
|
case Mjpeg:
|
||||||
r.parser = parser.NewMJPEGParser(mjpegParserInChanLen)
|
r.parser = parser.NewMJPEGParser(mjpegParserInChanLen)
|
||||||
}
|
}
|
||||||
|
r.mjpegOutputChan = make(chan []byte, 10000)
|
||||||
switch r.config.Packetization {
|
switch r.config.Packetization {
|
||||||
case None:
|
case None:
|
||||||
r.parser.SetOutputChan(r.mjpegOutputChan)
|
r.parser.SetOutputChan(r.mjpegOutputChan)
|
||||||
|
@ -231,6 +233,16 @@ func (r *revidInst) ChangeState(config Config) error {
|
||||||
return errors.New("Bad output type defined in config!")
|
return errors.New("Bad output type defined in config!")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch config.Packetization {
|
||||||
|
case None:
|
||||||
|
case Mpegts:
|
||||||
|
case NothingDefined:
|
||||||
|
r.Log(Warning, "No packetization option defined, defaulting to none!")
|
||||||
|
config.Packetization = None
|
||||||
|
default:
|
||||||
|
return errors.New("Bad packetization option defined in config!")
|
||||||
|
}
|
||||||
|
|
||||||
if config.Width == "" {
|
if config.Width == "" {
|
||||||
r.Log(Warning, "No width defined, defaulting to 1280!")
|
r.Log(Warning, "No width defined, defaulting to 1280!")
|
||||||
config.Width = defaultWidth
|
config.Width = defaultWidth
|
||||||
|
@ -427,6 +439,10 @@ func (r *revidInst) packClips() {
|
||||||
case None:
|
case None:
|
||||||
frame := <-r.mjpegOutputChan
|
frame := <-r.mjpegOutputChan
|
||||||
upperBound := clipSize + len(frame)
|
upperBound := clipSize + len(frame)
|
||||||
|
fmt.Printf("len(clip): %v\n", len(clip))
|
||||||
|
fmt.Printf("clipsize: %v\n", clipSize)
|
||||||
|
fmt.Printf("upperBound: %v\n", upperBound)
|
||||||
|
fmt.Printf("len(frame): %v\n", len(frame))
|
||||||
copy(clip[clipSize:upperBound], frame)
|
copy(clip[clipSize:upperBound], frame)
|
||||||
packetCount++
|
packetCount++
|
||||||
clipSize += len(frame)
|
clipSize += len(frame)
|
||||||
|
|
Loading…
Reference in New Issue