Re: Slow UI updates with GtkImage



On Nov 27, 2007 6:11 AM, David Brigada <brigad rpi edu> wrote:
Hi,

I'm working on an audio player application.  I currently have two
elements that change on a frequent basis: a GtkHScale and a GtkImage.
Whenever I update the data, I call gtk_widget_queue_draw on the widget
that changed.  With just the slider updating every 200ms, it works fine.
  If I add the GtkImage changing (by swapping out the GdkPixbuf with
gtk_image_pixbuf_set) or I call gtk_widget_queue_draw on the widget, the
UI waits about 2.5s in between redraws on both the slider and the image.
  This event happens about every 186ms.

Is there something that I should be doing differently here?  Is this
method horribly inefficient?  What should I change?

You should not have to call gtk_widget_queue_draw() at all in this
case (I'm sure the gtkimage & gtkscale implementations do this
themselves when you update the image or adjustment values).

Rather, how is your application structured ? do you use a thread
for the audio or are you processing audio data for 2.5s intervals
before ever returning control to the gtk+ main loop ? (are you
blocking or read or write maybe ?).

Even if you get it all right though, remember that you can still
get resource starvation when writing a media streaming app,
probably your audio processing thread is a higher priority.

Cheers,
                    -Tristan



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