# HG changeset patch
# User Torsten Jager <t.jager@gmx.de>
# Date 1340651609 -10800
# Node ID c2979cafe428d87578e7695d96f27d6958e27799
# Parent  9d3b5d153ef8c8b80b5f6a672b63ac22c3eaa7fd
ff_video_decoder.c: fix: free _all_ DR1 frames

Fixes laming/freezing after manually stopping VP6 or WMV video.
That issue does not hit when we let the stream play to its end.

diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c
--- a/src/combined/ffmpeg/ff_video_decoder.c
+++ b/src/combined/ffmpeg/ff_video_decoder.c
@@ -1721,13 +1721,13 @@ static void ff_reset (video_decoder_t *t
 
   if(this->context && this->decoder_ok)
   {
-    xine_list_iterator_t it;
+    xine_list_iterator_t it = NULL;
 
     avcodec_flush_buffers(this->context);
 
     /* frame garbage collector here - workaround for buggy ffmpeg codecs that
      * don't release their DR1 frames */
-    while( (it = xine_list_front(this->dr1_frames)) != NULL )
+    while ((it = xine_list_next (this->dr1_frames, it)) != NULL)
     {
       vo_frame_t *img = (vo_frame_t *)xine_list_get_value(this->dr1_frames, it);
       if (img)
@@ -1791,7 +1791,7 @@ static void ff_dispose (video_decoder_t 
   lprintf ("ff_dispose\n");
 
   if (this->decoder_ok) {
-    xine_list_iterator_t it;
+    xine_list_iterator_t it = NULL;
 
     pthread_mutex_lock(&ffmpeg_lock);
     avcodec_close (this->context);
@@ -1799,7 +1799,7 @@ static void ff_dispose (video_decoder_t 
 
     /* frame garbage collector here - workaround for buggy ffmpeg codecs that
      * don't release their DR1 frames */
-    while( (it = xine_list_front(this->dr1_frames)) != NULL )
+    while ((it = xine_list_next (this->dr1_frames, it)) != NULL)
     {
       vo_frame_t *img = (vo_frame_t *)xine_list_get_value(this->dr1_frames, it);
       if (img)
