mirror of https://bitbucket.org/ausocean/av.git
revid: fixed rtmp problem by adding extra check of output to figure out clip duration before send
This commit is contained in:
parent
081007b091
commit
32e2d61ec1
|
@ -50,7 +50,7 @@ import (
|
||||||
|
|
||||||
// Misc constants
|
// Misc constants
|
||||||
const (
|
const (
|
||||||
clipDuration = 1 * time.Second
|
clipDuration = 1000 * time.Millisecond
|
||||||
mp2tPacketSize = 188 // MPEG-TS packet size
|
mp2tPacketSize = 188 // MPEG-TS packet size
|
||||||
mp2tMaxPackets = int(clipDuration * 2016 / time.Second) // # first multiple of 7 and 8 greater than 2000
|
mp2tMaxPackets = int(clipDuration * 2016 / time.Second) // # first multiple of 7 and 8 greater than 2000
|
||||||
ringBufferSize = 10000
|
ringBufferSize = 10000
|
||||||
|
@ -157,7 +157,7 @@ func (p *packer) Write(frame []byte) (int, error) {
|
||||||
}
|
}
|
||||||
p.packetCount++
|
p.packetCount++
|
||||||
now = time.Now()
|
now = time.Now()
|
||||||
if now.Sub(prevTime) > clipDuration && p.packetCount%7 == 0 {
|
if (p.owner.config.Output1 != Rtmp && now.Sub(prevTime) > clipDuration && p.packetCount%7 == 0) || p.owner.config.Output1 == Rtmp {
|
||||||
p.owner.buffer.Flush()
|
p.owner.buffer.Flush()
|
||||||
p.packetCount = 0
|
p.packetCount = 0
|
||||||
prevTime = now
|
prevTime = now
|
||||||
|
|
Loading…
Reference in New Issue