Skip to content

Commit

Permalink
Merge pull request #3564 from YangJiao1996/master
Browse files Browse the repository at this point in the history
Fixed rs-convert crash
  • Loading branch information
dorodnic authored Apr 3, 2019
2 parents accc3e3 + 53a3b20 commit e683f02
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tools/convert/rs-convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,17 @@ int main(int argc, char** argv) try
auto frameNumber = 0ULL;

rs2::frameset frameset;
uint64_t posLast = playback.get_position();
while (pipe->try_wait_for_frames(&frameset, 1000))
{
int posP = static_cast<int>(playback.get_position() * 100. / duration.count());
int posP = static_cast<int>(posLast * 100. / duration.count());

if (posP > progress) {
progress = posP;
cout << posP << "%" << "\r" << flush;
}

if (frameset[0].get_frame_number() < frameNumber) {
break;
}


frameNumber = frameset[0].get_frame_number();

Expand All @@ -129,6 +128,11 @@ int main(int argc, char** argv) try
[] (shared_ptr<rs2::tools::converter::converter_base>& converter) {
converter->wait();
});
const uint64_t posCurr = playback.get_position();
if(static_cast<int64_t>(posCurr - posLast) < 0){
break;
}
posLast = posCurr;
}

cout << endl;
Expand Down

0 comments on commit e683f02

Please sign in to comment.