From 55f092db09e0bec0f953f77830ac8ac6bb67fdf9 Mon Sep 17 00:00:00 2001 From: jackychen Date: Mon, 21 Sep 2015 09:37:46 -0700 Subject: Change size on first frame and change config cause crash. Reallocation of mi buffer fails if change size on the first frame and change config in subsequent frames. Add a condition for resolution check to avoid assertion failure. BUG=1074 Change-Id: Ie26ed816a57fa871ba27a72db9805baaaeaba9f3 --- vp9/encoder/vp9_encoder.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'vp9/encoder') diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 91e92ff24..eb0d3608f 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -1517,7 +1517,10 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) { } if (cpi->initial_width) { - if (cm->width > cpi->initial_width || cm->height > cpi->initial_height) { + int new_mi_size = 0; + vp9_set_mb_mi(cm, cm->width, cm->height); + new_mi_size = cm->mi_stride * calc_mi_size(cm->mi_rows); + if (cm->mi_alloc_size < new_mi_size) { vp9_free_context_buffers(cm); alloc_compressor_data(cpi); realloc_segmentation_maps(cpi); @@ -4642,8 +4645,10 @@ int vp9_set_internal_size(VP9_COMP *cpi, // always go to the next whole number cm->width = (hs - 1 + cpi->oxcf.width * hr) / hs; cm->height = (vs - 1 + cpi->oxcf.height * vr) / vs; - assert(cm->width <= cpi->initial_width); - assert(cm->height <= cpi->initial_height); + if (cm->current_video_frame) { + assert(cm->width <= cpi->initial_width); + assert(cm->height <= cpi->initial_height); + } update_frame_size(cpi); -- cgit v1.2.3