Skip to content
Snippets Groups Projects
Commit 20fe316e authored by Lukasz Marek's avatar Lukasz Marek Committed by Michael Niedermayer
Browse files

lavd/sdl: reset context variables after destroy


SDL device reports double free or hangs when quiting.
Reseting variables solves the issue.

The issue is caused by double call of write_trailer callback.
It is called for the first time in write_packet when quit flag is set.
Second call comes from ffmpeg.c or may come from other client application.

Signed-off-by: default avatarLukasz Marek <lukasz.m.luki@gmail.com>
Reviewed-by: default avatarNicolas George <george@nsup.org>
Signed-off-by: default avatarMichael Niedermayer <michaelni@gmx.at>
parent 18c3313e
No related branches found
No related tags found
No related merge requests found
...@@ -71,12 +71,16 @@ static int sdl_write_trailer(AVFormatContext *s) ...@@ -71,12 +71,16 @@ static int sdl_write_trailer(AVFormatContext *s)
if (sdl->overlay) if (sdl->overlay)
SDL_FreeYUVOverlay(sdl->overlay); SDL_FreeYUVOverlay(sdl->overlay);
sdl->overlay = NULL;
if (sdl->event_thread) if (sdl->event_thread)
SDL_WaitThread(sdl->event_thread, NULL); SDL_WaitThread(sdl->event_thread, NULL);
sdl->event_thread = NULL;
if (sdl->mutex) if (sdl->mutex)
SDL_DestroyMutex(sdl->mutex); SDL_DestroyMutex(sdl->mutex);
sdl->mutex = NULL;
if (sdl->init_cond) if (sdl->init_cond)
SDL_DestroyCond(sdl->init_cond); SDL_DestroyCond(sdl->init_cond);
sdl->init_cond = NULL;
if (!sdl->sdl_was_already_inited) if (!sdl->sdl_was_already_inited)
SDL_Quit(); SDL_Quit();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment