summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHamsalekha S <hamsalekha.s@ittiam.com>2017-05-22 14:10:15 +0530
committerMSe <mse1969@posteo.de>2017-08-31 21:25:45 +0200
commitb828eddda1c790c510bd1905f9a7bff233eb77dc (patch)
tree0aebb56e5ade5ab2f1ef608baac4870209462bea
parent42bd24a67a647f745a69902559f2008e468a69a4 (diff)
downloadandroid_external_libavc-b828eddda1c790c510bd1905f9a7bff233eb77dc.tar.gz
android_external_libavc-b828eddda1c790c510bd1905f9a7bff233eb77dc.tar.bz2
android_external_libavc-b828eddda1c790c510bd1905f9a7bff233eb77dc.zip
Fix resolution change within a decode call.
If resolution changes within a decode call,due to multiple sps, the decoder hangs as the the application will give the same data again in the next decode call. This results in a hang. Fixed this by flaging an error, when sps/resoultion changes within a process call. Bug: 38487564 Test: ran POC on patched O-based system w/o hanging Change-Id: I30095b2e8bf573c1a58a316a23b1a5e6a4af589b (cherry picked from commit fe18375850fe04b8c4ff2f1b20069e161f718e53)
-rw-r--r--decoder/ih264d_api.c1
-rw-r--r--decoder/ih264d_parse_headers.c10
-rw-r--r--decoder/ih264d_structs.h1
3 files changed, 12 insertions, 0 deletions
diff --git a/decoder/ih264d_api.c b/decoder/ih264d_api.c
index 02f622e..b78ad7a 100644
--- a/decoder/ih264d_api.c
+++ b/decoder/ih264d_api.c
@@ -1892,6 +1892,7 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
ps_dec->u4_bs_deblk_thread_created = 0;
ps_dec->u4_cur_bs_mb_num = 0;
ps_dec->u4_start_recon_deblk = 0;
+ ps_dec->u4_sps_cnt_in_process = 0;
DEBUG_THREADS_PRINTF(" Starting process call\n");
diff --git a/decoder/ih264d_parse_headers.c b/decoder/ih264d_parse_headers.c
index fcdd152..aa51c3a 100644
--- a/decoder/ih264d_parse_headers.c
+++ b/decoder/ih264d_parse_headers.c
@@ -1116,6 +1116,16 @@ WORD32 ih264d_parse_nal_unit(iv_obj_t *dec_hdl,
/* ! */
ih264d_rbsp_to_sodb(ps_dec->ps_bitstrm);
i_status = ih264d_parse_sps(ps_dec, ps_bitstrm);
+ ps_dec->u4_sps_cnt_in_process++;
+ /*If a resolution change happens within a process call, due to multiple sps
+ * we will not support it.
+ */
+ if((ps_dec->u4_sps_cnt_in_process > 1 ) &&
+ (i_status == IVD_RES_CHANGED))
+ {
+ i_status = ERROR_INV_SPS_PPS_T;
+ ps_dec->u1_res_changed = 0;
+ }
if(i_status == ERROR_INV_SPS_PPS_T)
return i_status;
if(!i_status)
diff --git a/decoder/ih264d_structs.h b/decoder/ih264d_structs.h
index 5a78784..c83c34e 100644
--- a/decoder/ih264d_structs.h
+++ b/decoder/ih264d_structs.h
@@ -1247,6 +1247,7 @@ typedef struct _DecStruct
UWORD32 u4_cur_bs_mb_num;
UWORD32 u4_bs_cur_slice_num_mbs;
UWORD32 u4_cur_deblk_mb_num;
+ UWORD32 u4_sps_cnt_in_process;
volatile UWORD16 u2_cur_slice_num_bs;
UWORD32 u4_deblk_mb_x;