Two YUV movies (thread/mutex)

Hi *,

I’m using SDL to render YUV420 “movies”. I’m just trying to display two
movies at once (using QThread). The problem is that it Segfaults (Fatal
signal: Segmentation Fault (SDL Parachute Deployed)).

I know that I’ll have to put a mutex and I did. But maybe on the wrong place.
Could anyone help me?

My code looks like this:

Initialization:

QMutex mutex;
mutex.lock();

char buf[32];
SDL_Surface *m_screen;

if (SDL_Init(SDL_INIT_VIDEO) < 0 || !SDL_VideoDriverName(buf, 1)) {
#if DEBUG >= 1
cerr << "Could not init SDL video: " << SDL_GetError() << nl;
#endif
exit(-1); // use exception here l8er
}
video_info = SDL_GetVideoInfo();

m_screen = SDL_SetVideoMode(width,height,32, SDL_SWSURFACE |
SDL_ASYNCBLIT);

m_image = SDL_CreateYUVOverlay(width,height, SDL_YV12_OVERLAY,m_screen);

mutex.unlock();

Play:

QMutex mutex;
mutex.lock();
memcpy(m_image->pixels[0], buffer + bufOffsetY, ySize);
memcpy(m_image->pixels[1], buffer + bufOffsetV, uvSize);
memcpy(m_image->pixels[2], buffer + bufOffsetU, uvSize);
SDL_DisplayYUVOverlay(m_image, &m_dstrect);
SDL_UnlockYUVOverlay(m_image);
mutex.unlock();
SDL_Delay(delay);