Index: /pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-codec/ffmpeg_codecs.c
===================================================================
--- /pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-codec/ffmpeg_codecs.c	(revision 3431)
+++ /pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-codec/ffmpeg_codecs.c	(revision 3432)
@@ -1273,6 +1273,10 @@
     PJ_ASSERT_RETURN(ff->dec_ctx, PJ_EINVALIDOP);
 
+    /* Reset output frame bit info */
+    output->bit_info = 0;
+
     /* Validate output buffer size */
-    //PJ_ASSERT_RETURN(ff->dec_vafp.framebytes <= output_buf_len, PJ_ETOOSMALL);
+    if (ff->dec_vafp.framebytes > output_buf_len)
+	return PJ_ETOOSMALL;
 
     /* Init frame to receive the decoded data, the ffmpeg codec context will
@@ -1326,34 +1330,4 @@
 	    ff->dec_ctx->coded_height != (int)vafp->size.h)
 	{
-#if 0	    
-	    // it should not be the codec responsibility to do resizing
-	    pj_uint8_t *data[PJMEDIA_MAX_VIDEO_PLANES] = {0};
-	    unsigned i;
-	    int h;
-
-	    if (!ff->sws_ctx) {
-		pj_assert(sws_isSupportedInput(ff->dec_ctx->pix_fmt) > 0);
-		pj_assert(sws_isSupportedOutput(ff->expected_dec_fmt) > 0);
-		ff->sws_ctx = sws_getContext(ff->dec_ctx->coded_width,
-					     ff->dec_ctx->coded_height,
-					     ff->dec_ctx->pix_fmt,
-					     vafp->size.w, vafp->size.h,
-					     ff->expected_dec_fmt,
-					     SWS_BILINEAR | SWS_PRINT_INFO,
-					     NULL, NULL, NULL);
-		if (ff->sws_ctx == NULL) {
-		    return PJ_EUNKNOWN;
-		}
-	    }
-
-	    for (i = 0; i < ff->vfi->plane_cnt; ++i) {
-		data[i] = q;
-		q += vafp->plane_bytes[i];
-	    }
-	    h = sws_scale(ff->sws_ctx, avframe.data, avframe.linesize, 0, 
-			  ff->dec_ctx->coded_height, data, vafp->strides);
-	    pj_assert((int)vafp->size.h == h);
-#endif
-
 	    pjmedia_format_id new_fmt_id;
 	    pj_status_t status;
@@ -1383,9 +1357,9 @@
 	    /* Notify application via the bit_info field of pjmedia_frame */
 	    output->bit_info = PJMEDIA_VID_CODEC_EVENT_FMT_CHANGED;
+
+	    /* Check provided buffer size after format changed */
+	    if (vafp->framebytes > output_buf_len)
+		return PJ_ETOOSMALL;
 	}
-
-	/* Check provided buffer size after format changed */
-	//if (vafp->framebytes > output_buf_len)
-	    //return PJ_ETOOSMALL;
 
 	/* Get the decoded data */
Index: /pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/sdl_dev.c
===================================================================
--- /pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/sdl_dev.c	(revision 3431)
+++ /pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/sdl_dev.c	(revision 3432)
@@ -281,5 +281,5 @@
 
     pj_bzero(param, sizeof(*param));
-    if (di->info.dir & PJMEDIA_DIR_CAPTURE_RENDER) {
+    if (di->info.dir == PJMEDIA_DIR_CAPTURE_RENDER) {
 	param->dir = PJMEDIA_DIR_CAPTURE_RENDER;
 	param->cap_id = index;
@@ -751,4 +751,7 @@
     }
 
+    if (frame->size==0 || frame->buf==NULL)
+	goto on_return;
+
     if (stream->surf) {
         if (SDL_MUSTLOCK(stream->surf)) {
Index: /pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/vid_streamutil.c
===================================================================
--- /pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/vid_streamutil.c	(revision 3431)
+++ /pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/vid_streamutil.c	(revision 3432)
@@ -89,7 +89,15 @@
 #define THIS_FILE	"vid_streamutil.c"
 
+
+/* If set, local renderer will be created to play original file */
 #define HAS_LOCAL_RENDERER_FOR_PLAY_FILE    1
-#define DEF_RENDERER_WIDTH		    0
-#define DEF_RENDERER_HEIGHT		    0
+
+
+/* Default width and height for the renderer, better be set to maximum
+ * acceptable size.
+ */
+#define DEF_RENDERER_WIDTH		    640
+#define DEF_RENDERER_HEIGHT		    480
+
 
 /* Prototype */
@@ -598,5 +606,5 @@
     if (play_file.file_name) {
 	pjmedia_video_format_detail *file_vfd;
-        pjmedia_clock_param *clock_param;
+        pjmedia_clock_param clock_param;
 
 	/* Create file player */
