Bug 868 : Movie Threading problem
Last modified: 2010-06-05 03:59




Status:
RESOLVED
Resolution:
WONTFIX -
Priority:
P2
Severity:
normal

 

Reporter:
mattaspen
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2008-08-08 08:56
1. the revision number:
0135 Beta (also tried 0145 )
2. # what operating system you're using, and on what kind of hardware:
Mac OS X (10.4.11)
Java: 1.5.0 (Mac OS X Default)
Eclipse: 3.3.2

I've been working w/ Processing in Eclipse.
I keep running into the same problem while running a simple application
that reads in a movie and plays it in an applet. I copied the example movie
(File > Examples > Libraries > Movie > loop) along w/ the .mov file into an
Eclipse project. When I 'run it as an applet', 20% of the time, the movie
plays, while the other 80% it does not.

I consulted a colleague better versed in Java Threading w/ this issue, and
we agree that this behavior is a Java Threading problem.

I downloaded the source code and looked in the Movie.java file. On line 46
(could be a different line number), the 'runner' is defined as:

Thread runner;

This, I believe, is part of the problem. The variable should be declared as
"volatile Thread runner;"

In the Movie constructor (line 267), reflection is used:

movieEventMethod = parent.getClass().getMethod("movieEvent", new Class[] {
Movie.class });

followed by (line 275):

runner = new Thread(this);
runner.start();

Since my above-mentioned problem happens when the movie is 'read' before
its drawn, the 'runner' not being 'volatile' seems to be the culprit.

Interestingly, when I run the example via Processing, it works fine. I did
notice, though, that via Eclipse, the applet is started in
sun.applet.AppletViewer while via Processing, it is started in
processing.core.PApplet.

I hope that this helps.

I will try 2 things:
1. in Eclipse, make the applet run in processing.core.PApplet.
2. download the latest source, compile it locally and try the example
application again; in Eclipse using the sun.applet.AppletViewer.
Additional Comment #1 From fry 2008-08-09 07:54
Thanks for looking into this, and let me know what you find. Movie
threading hasn't been dealt with in a while and could probably use a tune up.
Additional Comment #2 From mattaspen 2008-08-11 09:52
I tried making the 'runner' thread 'volatile', recompiled (source in both
0144 and 0135), but still the issue persists.

The interesting thing, again, is that the processing sketch (File >
Examples > Libraries > Video > Loop) runs fine in Processing but I cannot
get the 'same' program to run via Eclipse.

In my frustration, I asked a friend to download and try my 'exercise' on
his Mac; thinking that what I've been experiencing is due to a problem w/
my machine. He experienced the same problem.

My guess is that there is something w/ the macs & quicktime.

As much as I like Processing, I've switched to opencv on Ubuntu.

--MA

(In reply to comment #1)
>
>
>
> Additional Comment #1 From
> fry
> 2008-08-09 07:54
>
> <!--
> addReplyLink(1); //-->[reply]
>
>
>
>
> Thanks for looking into this, and let me know what you find. Movie
> threading hasn't been dealt with in a while and could probably use a
tune up.
>
>

Additional Comment #3 From fry 2008-08-11 10:36
Got it, well, I'll try to take a look into it sometime soon. I'll be doing
some video work in the upcoming weeks.
Additional Comment #4 From fry 2010-06-05 03:59
closing this bug, because we'll be replacing the current video library with
another sometime later this summer. as such, i won't be doing any more bug
fixes on the current video library. in the meantime, we recommend using
gsvideo, opencv, or one of the other video libraries that are available.