STill working on stuff

This commit is contained in:
Saxon 2018-02-09 17:30:09 +10:30
parent 871fb45b5b
commit e522c34f36
2 changed files with 17 additions and 2 deletions

View File

@ -84,6 +84,7 @@ type Config struct {
InputCodec uint8
Output uint8
RtmpEncodingMethod uint8
FramesPerClip uint
RtmpUrl string
Bitrate string
OutputFileName string
@ -274,6 +275,20 @@ func (r *revidInst) ChangeState(config Config) error {
return errors.New("Bad packetization option defined in config!")
}
switch {
case config.FramesPerClip >= 0:
case config.FramesPerClip == 0:
r.Log(Warning, "No frames per clip defined, defaulting to 1!")
config.FramesPerClip = 1
case config.FramesPerClip < 0:
return errors.New("Bad frames per clip given!")
}
if config.FramesPerClip == 0 {
r.Log(Warning, "No frames per clip define, defaulting to 1!")
config.FramesPerClip = 1
} else {}
if config.Width == "" {
r.Log(Warning, "No width defined, defaulting to 1280!")
config.Width = defaultWidth
@ -540,8 +555,7 @@ func (r *revidInst) packClips() {
}
// send if (1) our buffer is full or (2) 1 second has elapsed and we have % packetsPerFrame
now = time.Now()
if (now.Sub(prevTime) > clipDuration*time.Second && clipSize > 0 ) || clipSize > maxClipSize {
fmt.Println("DoneWriting!")
if packetCount > r.config.FramesPerClip {
if err := r.ringBuffer.DoneWriting(clipSize); err != nil {
r.Log(Error, err.Error())
r.Log(Warning, "Dropping clip!")

View File

@ -108,6 +108,7 @@ func TestRtmpOutput(t *testing.T){
Height: "720",
FrameRate: "25",
Packetization: None,
FramesPerClip: 1,
}
revidInst, err := NewRevidInstance(config)
if err != nil {