Skip to content

Commit

Permalink
Do not skip the very first frame in case the first timestamp should r…
Browse files Browse the repository at this point in the history
…eally be zero.

Signed-off-by: Martin Pecka <peckama2@fel.cvut.cz>
  • Loading branch information
peci1 committed Nov 11, 2020
1 parent 2be8e81 commit 378bcd1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion av/src/VideoEncoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<double>(1.0/this->dataPtr->fps))
double period = 1.0/this->dataPtr->fps;
if (this->dataPtr->frameCount > 0u &&
dt < std::chrono::duration<double>(period))
return false;

this->dataPtr->timePrev = _timestamp;
Expand Down

0 comments on commit 378bcd1

Please sign in to comment.