@Override
public void resume() {
isPaused = false;
- thread.notify();
+ synchronized (thread) {
+ thread.notify();
+ }
}
@Override
int index = 0;
while (!isInterrupted()) {
if (isPaused) {
- wait();
+ synchronized (thread) {
+ wait();
+ }
}
LedFrame frame = LedFrame.from(config);
updateFrame(frame, System.currentTimeMillis() - start, index);
Thread.sleep(20);
}
} catch (InterruptedException e) {
- e.printStackTrace();
+ // e.printStackTrace();
}
}
};
@Override
public void resume() {
isPaused = false;
- grabberThread.notify();
+ synchronized (grabberThread) {
+ grabberThread.notify();
+ }
}
@Override
while (!isInterrupted()) {
Optional<VideoFrame> frame = grabber.grabFrame();
if (isPaused) {
- wait();
+ synchronized (grabberThread) {
+ wait();
+ }
}
if (frameConsumer != null) frame.ifPresent(frameConsumer);
frame.ifPresent(VideoMode.this::onVideoFrame);