Skip to content

Commit

Permalink
Fix: QThread::wait not working
Browse files Browse the repository at this point in the history
  • Loading branch information
ppodds committed Dec 29, 2021
1 parent b502253 commit eb1dd6c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions AAAAnimation/player/ascii_player_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@ void AsciiPlayerThread::run()
transform(frame->data[0], arr, width, height, frame->linesize[0]);
// check time again
// if this frame is too late, play it now
if (position >= play_time)
std::cout << arr;
else {
qint64 t = position;
if (play_time - 200 > t) // 200ms offset to avoid drop too many frames
// wait until the proper time and play this frame
QThread::currentThread()->wait(play_time - position);
std::cout << arr;
}
msleep(play_time - t);
std::cout << arr;
console_controller.top();
}
frame = video_decoder.next_frame();
Expand Down

0 comments on commit eb1dd6c

Please sign in to comment.