[FFmpeg-cvslog] lavd/sdl: reset context variables after destroy

Lukasz Marek git at videolan.org
Sat Feb 8 12:42:29 CET 2014


ffmpeg | branch: master | Lukasz Marek <lukasz.m.luki at gmail.com> | Fri Feb  7 00:30:27 2014 +0100| [20fe316e47fedb28787e77e77a7011133f3d4e73] | committer: Michael Niedermayer

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: Lukasz Marek <lukasz.m.luki at gmail.com>
Reviewed-by: Nicolas George <george at nsup.org>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=20fe316e47fedb28787e77e77a7011133f3d4e73
---

 libavdevice/sdl.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavdevice/sdl.c b/libavdevice/sdl.c
index 2f36f63..bef5041 100644
--- a/libavdevice/sdl.c
+++ b/libavdevice/sdl.c
@@ -71,12 +71,16 @@ static int sdl_write_trailer(AVFormatContext *s)
 
     if (sdl->overlay)
         SDL_FreeYUVOverlay(sdl->overlay);
+    sdl->overlay = NULL;
     if (sdl->event_thread)
         SDL_WaitThread(sdl->event_thread, NULL);
+    sdl->event_thread = NULL;
     if (sdl->mutex)
         SDL_DestroyMutex(sdl->mutex);
+    sdl->mutex = NULL;
     if (sdl->init_cond)
         SDL_DestroyCond(sdl->init_cond);
+    sdl->init_cond = NULL;
 
     if (!sdl->sdl_was_already_inited)
         SDL_Quit();



More information about the ffmpeg-cvslog mailing list