mbari-org / vars-annotation

Video Annotation Application for MBARI's Media Management (M3) software stack
https://docs.mbari.org/vars-annotation/
Apache License 2.0
16 stars 6 forks source link

In tape mode, UI hangs until play/ffwd/rewind #64

Closed hohonuuli closed 6 years ago

hohonuuli commented 6 years ago

When annotating a tape, if the VCR is paused and new annotations are made, they queue up (unseen) until the VCR plays/rewinds/ffwd/etc, then it gets time or timecode and the annotations all appear. I think maybe the videoIndex is hanging because waiting for valid userbits to get the date.

hohonuuli commented 6 years ago

I looks like the UserbitsAsTimeDecorator was not sending on videoIndex's until they changed, so in essences it was hanging until the timecode and/or userbits changed.. Here's the change I made in vcr4j to fix this. High chance this was the issue:

>> git diff
diff --git a/vcr4j-rs422/src/main/java/org/mbari/vcr4j/rs422/decorators/UserbitsAsTimeDecorator.java b/vcr4j-rs422/src/main/java/org/mbari/vcr4j/rs422/decorators/UserbitsAsTimeDecorator.java
index 8864df9..e822a21 100644
--- a/vcr4j-rs422/src/main/java/org/mbari/vcr4j/rs422/decorators/UserbitsAsTimeDecorator.java
+++ b/vcr4j-rs422/src/main/java/org/mbari/vcr4j/rs422/decorators/UserbitsAsTimeDecorator.java
@@ -75,7 +75,7 @@ public class UserbitsAsTimeDecorator implements Decorator {
                 (videoIndex, userbits) ->
                         new VideoIndex(Optional.of(userbitsAsInstant(userbits.getUserbits())),
                                 videoIndex.getElapsedTime(), videoIndex.getTimecode())
-                ).distinctUntilChanged();
+                );

     }

Here's the call in MediaPlayer that I believe was hanging:

public CompletableFuture<VideoIndex> requestVideoIndex() {
        CompletableFuture<VideoIndex> future = new CompletableFuture<>();
        getVideoIO().getIndexObservable()
                .take(1)
                .forEach(future::complete);
        getVideoIO().send(VideoCommands.REQUEST_INDEX);
        return future;
    }
hohonuuli commented 6 years ago

This has been fixed.