From f0b042a2d16f0e5ca3c19561080e32a73feb6127 Mon Sep 17 00:00:00 2001 From: Cedric Verstraeten Date: Sun, 29 Jan 2023 16:58:18 +0100 Subject: [PATCH] we missed a packet :100: --- machinery/src/capture/main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/machinery/src/capture/main.go b/machinery/src/capture/main.go index b34f01e..14f2ad2 100644 --- a/machinery/src/capture/main.go +++ b/machinery/src/capture/main.go @@ -105,6 +105,11 @@ func HandleRecordStream(queue *pubsub.Queue, configuration *models.Configuration if start && // If already recording and current frame is a keyframe and we should stop recording nextPkt.IsKeyFrame && (timestamp+recordingPeriod-now <= 0 || now-startRecording >= maxRecordingPeriod) { + // Write the last packet + if err := myMuxer.WritePacket(pkt); err != nil { + log.Log.Error(err.Error()) + } + // This will write the trailer a well. if err := myMuxer.WriteTrailerWithPacket(nextPkt); err != nil { log.Log.Error(err.Error()) @@ -218,8 +223,9 @@ func HandleRecordStream(queue *pubsub.Queue, configuration *models.Configuration // If this happens we need to check to properly close the recording. if cursorError != nil { if recordingStatus == "started" { + // This will write the trailer a well. - if err := myMuxer.WriteTrailerWithPacket(nextPkt); err != nil { + if err := myMuxer.WriteTrailer(); err != nil { log.Log.Error(err.Error()) }