revid: trying to fix jumpy rtp

This commit is contained in:
saxon 2018-12-14 20:05:10 +10:30
parent d8587bdbe2
commit 618fadd90b
3 changed files with 5 additions and 6 deletions

View File

@ -188,7 +188,6 @@ func (c *Config) Validate(r *Revid) error {
switch c.Output1 {
case File:
case Rtp:
case Udp:
case Rtmp, FfmpegRtmp:
if c.RtmpUrl == "" {
@ -204,7 +203,7 @@ func (c *Config) Validate(r *Revid) error {
defaultOutput)
c.Output1 = defaultOutput
fallthrough
case Http:
case Http, Rtp:
c.Logger.Log(smartlogger.Info, pkg+"defaulting frames per clip for http out",
"framesPerClip", httpFramesPerClip)
c.FramesPerClip = httpFramesPerClip

View File

@ -38,7 +38,7 @@ import (
const (
psiPacketSize = 184
psiSendCount = 21
psiSendCount = 7
)
type MetaData struct {

View File

@ -63,7 +63,7 @@ func NewEncoder(dst io.Writer, fps int) *Encoder {
ssrc: rand.Uint32(),
frameInterval: time.Duration(float64(time.Second) / float64(fps)),
fps: fps,
buffer: make([]byte, 0, sendLength),
buffer: make([]byte, 0),
}
}
@ -72,8 +72,8 @@ func NewEncoder(dst io.Writer, fps int) *Encoder {
func (e *Encoder) Write(data []byte) (int, error) {
e.buffer = append(e.buffer, data...)
for len(e.buffer) >= sendLength {
e.Encode(e.buffer)
e.buffer = e.buffer[:0]
e.Encode(e.buffer[:sendLength])
e.buffer = e.buffer[sendLength:]
}
return len(data), nil
}