[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41854] trunk/blender/source/blender/imbuf /intern/anim_movie.c: Fix #29202: Crash - VSE Cross strip probably leads to this

Sergey Sharybin sergey.vfx at gmail.com
Tue Nov 15 08:00:03 CET 2011


Revision: 41854
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41854
Author:   nazgul
Date:     2011-11-15 07:00:01 +0000 (Tue, 15 Nov 2011)
Log Message:
-----------
Fix #29202: Crash - VSE Cross strip probably leads to this

Crash was caused by several conditions:
- Frame which failed to decode tried to be converted to RGB colorspace
  and some filters like deinterlacing used to be applied as well
  (it's avscale stuff sws_scale where crash happened).
- In some cases it happened reading of freed memory when calling
  sws_scale function. Looks like it happened because of freeing
  packet on which decoding of frame finished and reading next packet.

Solved this two issues by making YUV->RGB conversion as soon as
frame was decoded in ffmpeg_decode_video_frame (such postprocessing
used to happen in callee of this function ffmpeg_fetchibuf), so now
sws_scale would be called before freeing packet on which decoding of
frame finished and it wouldn't be called in cases when decoding of
frame failed.

If decoding of frame failed, it'll be black ibuf returned to the sequencer.

Modified Paths:
--------------
    trunk/blender/source/blender/imbuf/intern/anim_movie.c

Modified: trunk/blender/source/blender/imbuf/intern/anim_movie.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/anim_movie.c	2011-11-15 06:37:47 UTC (rev 41853)
+++ trunk/blender/source/blender/imbuf/intern/anim_movie.c	2011-11-15 07:00:01 UTC (rev 41854)
@@ -747,6 +747,8 @@
 			anim->next_pts = 
 				av_get_pts_from_frame(anim->pFormatCtx,
 						      anim->pFrame);
+
+			ffmpeg_postprocess(anim);
 		}
 
 		av_free_packet(&anim->next_packet);
@@ -797,6 +799,8 @@
 					== AV_NOPTS_VALUE) ?
 				       -1 : (long long int)anim->pFrame->pkt_pts,
 					(long long int)anim->next_pts);
+
+				ffmpeg_postprocess(anim);
 			}
 		}
 		av_free_packet(&anim->next_packet);
@@ -808,6 +812,7 @@
 		       AV_LOG_ERROR, "  DECODE READ FAILED: av_read_frame() "
 		       "returned error: %d\n",	rval);
 	}
+
 	return (rval >= 0);
 }
 
@@ -947,6 +952,7 @@
 	}
 	 
 	IMB_freeImBuf(anim->last_frame);
+	anim->last_frame = IMB_allocImBuf(anim->x, anim->y, 32, IB_rect);
 
 	if (anim->next_pts <= pts_to_search && 
 	    anim->next_undecoded_pts > pts_to_search) {
@@ -1050,10 +1056,6 @@
 		ffmpeg_decode_video_frame(anim);
 	}
 
-	anim->last_frame = IMB_allocImBuf(anim->x, anim->y, 32, IB_rect);
-
-	ffmpeg_postprocess(anim);
-	
 	anim->last_pts = anim->next_pts;
 	
 	ffmpeg_decode_video_frame(anim);




More information about the Bf-blender-cvs mailing list