gnash-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-dev] Threads and Synchronization


From: Craig Kelley
Subject: [Gnash-dev] Threads and Synchronization
Date: Fri, 16 May 2008 23:21:27 -0600

Hi Gnash folks;

I'm looking at the GTK gui's run() loop, and it uses a g_timer with a
lot of warning comments preceding it.  I think this is the root cause
of the behavior that I'm seeing with gnash and SWF's that have long
sounds (eg, Strongbad emails).  On my workstation (2.8Ghz Pentium 4)
it is pretty well synchronized, but on a 1Ghz Athlon Geode, the frame
rendering slows down to about 10FPS over a 75 second spot.  This
leaves the audio finishing well before the "video".  Here's the
example I'm looking at:

http://www.homestarrunner.com/sbemail45.swf

I want to try out some alternative methods for calling
Gui::advanceMovie, namely a simple thread that would do something like
this (not tested):

    while (!done) {
        g_get_current_time(&gt);
        current_ms = ((gt.tv_sec - start_s) * 1000) +
            (gt.tv_usec / 1000) - start_ms;
        while (current_ms < next_ms) {
            int delay = (next_ms - current_ms);
            if (delay < 2000)
                delay = 2000;   // floor to 2ms
            g_usleep(delay);
        }
        gui->advanceMovie();
        next_ms += gui->_interval;
    }

Is this approach a good idea?  I tried enabling SKIP_RENDERING_IF_LATE
in gui.h, but it had no effect (it made it worse, to be honest).

If I were to use this approach, would GLIB threads or boost threads be
more appropriate?  Since it's a GTK gui, the glib thread choice would
be a no-brainer for something this simple; but I see that Gnash is
using boost threads in other parts.

Many thanks for any ideas!

-- 
http://inconnu.islug.org/~ink finger address@hidden for PGP block




reply via email to

[Prev in Thread] Current Thread [Next in Thread]