From 378bcd1a5393a50c2b49735034e5dde976e79d88 Mon Sep 17 00:00:00 2001 From: Martin Pecka Date: Wed, 11 Nov 2020 17:12:38 +0100 Subject: [PATCH] Do not skip the very first frame in case the first timestamp should really be zero. Signed-off-by: Martin Pecka --- av/src/VideoEncoder.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/av/src/VideoEncoder.cc b/av/src/VideoEncoder.cc index ef3cfd7e..9660cdb4 100644 --- a/av/src/VideoEncoder.cc +++ b/av/src/VideoEncoder.cc @@ -618,7 +618,9 @@ bool VideoEncoder::AddFrame(const unsigned char *_frame, auto dt = _timestamp - this->dataPtr->timePrev; // Skip frames that arrive faster than the video's fps - if (dt < std::chrono::duration(1.0/this->dataPtr->fps)) + double period = 1.0/this->dataPtr->fps; + if (this->dataPtr->frameCount > 0u && + dt < std::chrono::duration(period)) return false; this->dataPtr->timePrev = _timestamp;