Callback in smpeg

I have been playing with smpeg (Linux) and generally everything is
working well, but I have run into a seg fault problem, which causes me
to realize that I don’t understand how the callback system works.

When playing 768x576 mpegs I have no problem, but going up to 1024x768
seems to be pushing some limit (BTW, the glmovie code needed a tweak to
handle this frame size, there is a problem with the calculation of the
glTexSubImage2D args).

In my program loop I wait until a time interval DT has elapsed since the
last time I displayed a frame, then I check to see if a video frame has
been created (by the smpeg callback function). If it has, I do some
other things in OpenGL then display it. If I make DT = 70 ms, say, all
is OK. If I reduce it to 50 ms I get a seg fault after a while, and
sometimes a funny Xlib message: “unexpected async reply (sequence
0x87)!”

I am using a mutex to protect against clashing data accesses, and in the
callback function I just return if the frame hasn’t been used yet. The
cause of my seg fault may be unrelated to the callback system, but it
has prompted me to wonder how it works. For example, what happens if
the callback function has not returned when smpeg has the next frame
ready?

Gib