Skip to content

Commit

Permalink
Correctly handle object starting before the delay amount
Browse files Browse the repository at this point in the history
Fix #22
  • Loading branch information
MonoS authored Aug 2, 2024
1 parent 90fa967 commit f896382
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,14 @@ int main(int32_t argc, char** argv)
header.pts = (uint32_t)std::round((double)header.pts * cmd.resync);
}
if (doDelay) {
header.pts = header.pts + cmd.delay;
if ( cmd.delay < 0
&& header.pts1 < abs(cmd.delay)) {
std::fprintf(stderr, "Object at timestamp %s starts before the full delay amount, it was set to start at 0!\n", timestampString);
header.pts1 = 0;
}
else {
header.pts1 = header.pts1 + cmd.delay;
}
}

if (doResync || doDelay) {
Expand Down

0 comments on commit f896382

Please sign in to comment.