Fix for handling streams which resulted in negative num_mbs_left
Bug: 26070014
Change-Id: Id9f063a2c72a802d991b92abaf00ec687db5bb0f
diff --git a/decoder/impeg2d_dec_hdr.c b/decoder/impeg2d_dec_hdr.c
index 83c1545..fa876ca 100644
--- a/decoder/impeg2d_dec_hdr.c
+++ b/decoder/impeg2d_dec_hdr.c
@@ -18,6 +18,7 @@
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <string.h>
+#include <cutils/log.h>
#include "iv_datatypedef.h"
#include "iv.h"
@@ -915,6 +916,12 @@
temp = u4_bits_read & 0xFF;
i4_continue_decode = (((u4_bits_read >> 8) == 0x01) && (temp) && (temp <= 0xAF));
+ if (1 == ps_dec->i4_num_cores && 0 == ps_dec->u2_num_mbs_left)
+ {
+ i4_continue_decode = 0;
+ android_errorWriteLog(0x534e4554, "26070014");
+ }
+
if(i4_continue_decode)
{
/* If the slice is from the same row, then continue decoding without dequeue */
@@ -1148,7 +1155,7 @@
i4_row -= 1;
- if(i4_prev_row != i4_row)
+ if(i4_prev_row < i4_row)
{
/* Create a job for previous slice row */
if(i4_start_row != -1)
@@ -1172,6 +1179,8 @@
/* Store current slice's row position */
i4_start_row = i4_row;
+ } else if (i4_prev_row > i4_row) {
+ android_errorWriteLog(0x534e4554, "26070014");
}