Re #1219: attempt to fix crash in H.264 decoding

git-svn-id: https://svn.pjsip.org/repos/pjproject/branches/projects/2.0-dev@3530 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjmedia/src/pjmedia-codec/ffmpeg_codecs.c b/pjmedia/src/pjmedia-codec/ffmpeg_codecs.c
index 822902e..8f1bcd0 100644
--- a/pjmedia/src/pjmedia-codec/ffmpeg_codecs.c
+++ b/pjmedia/src/pjmedia-codec/ffmpeg_codecs.c
@@ -942,9 +942,9 @@
 #if LIBAVCODEC_VERSION_MAJOR >= 52 && LIBAVCODEC_VERSION_MINOR >= 72
     char errbuf[512];
     if (av_strerror(err, errbuf, sizeof(errbuf)) >= 0)
-        PJ_LOG(1, (THIS_FILE, "ffmpeg err %d: %s", err, errbuf));
+        PJ_LOG(5, (THIS_FILE, "ffmpeg err %d: %s", err, errbuf));
 #else
-    PJ_LOG(1, (THIS_FILE, "ffmpeg err %d", err));
+    PJ_LOG(5, (THIS_FILE, "ffmpeg err %d", err));
 #endif
 
 }
@@ -1373,8 +1373,8 @@
 	 * to the configured param.
 	 */
 	if (ff->dec_ctx->pix_fmt != ff->expected_dec_fmt ||
-	    ff->dec_ctx->coded_width != (int)vafp->size.w ||
-	    ff->dec_ctx->coded_height != (int)vafp->size.h)
+	    ff->dec_ctx->width != (int)vafp->size.w ||
+	    ff->dec_ctx->height != (int)vafp->size.h)
 	{
 	    pjmedia_format_id new_fmt_id;
 	    pj_status_t status;
@@ -1387,8 +1387,8 @@
 
 	    /* Update decoder format in param */
     	    ff->param.dec_fmt.id = new_fmt_id;
-	    ff->param.dec_fmt.det.vid.size.w = ff->dec_ctx->coded_width;
-	    ff->param.dec_fmt.det.vid.size.h = ff->dec_ctx->coded_height;
+	    ff->param.dec_fmt.det.vid.size.w = ff->dec_ctx->width;
+	    ff->param.dec_fmt.det.vid.size.h = ff->dec_ctx->height;
 
 	    /* Re-init format info and apply-param of decoder */
 	    ff->dec_vfi = pjmedia_get_video_format_info(NULL, ff->param.dec_fmt.id);
@@ -1403,12 +1403,12 @@
 
 	    /* 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 */
 	for (i = 0; i < ff->dec_vfi->plane_cnt; ++i) {
 	    pj_uint8_t *p = avframe.data[i];