Added check for minimum output buffer size.
Changed macro specifying the minimum size required for output buffer. Added an error check on the size allocated for output buffer. Change-Id: I98e4f46e62ffc974df760f2633689de079ca3e5e
This commit is contained in:
parent
7dbacdf765
commit
205e6fe110
5 changed files with 17 additions and 4 deletions
|
|
@ -4618,7 +4618,7 @@ static WORD32 ih264e_get_buf_info(iv_obj_t *ps_codec_obj,
|
|||
|
||||
for (i = 0; i < (WORD32) ps_op->s_ive_op.u4_out_comp_cnt; i++)
|
||||
{
|
||||
ps_op->s_ive_op.au4_min_out_buf_size[i] = (wd * ht * 3) >> 1;
|
||||
ps_op->s_ive_op.au4_min_out_buf_size[i] = MAX(((wd * ht * 3) >> 1), MIN_STREAM_SIZE);
|
||||
}
|
||||
|
||||
ps_op->s_ive_op.u4_min_inp_bufs = MIN_INP_BUFS;
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ IH264E_ERROR_T ih264e_bitstrm_init(bitstrm_t *ps_bitstrm,
|
|||
UWORD32 u4_max_bitstrm_size)
|
||||
{
|
||||
ps_bitstrm->pu1_strm_buffer = pu1_bitstrm_buf;
|
||||
ps_bitstrm->u4_max_strm_size = MAX(u4_max_bitstrm_size, MIN_STREAM_SIZE);
|
||||
ps_bitstrm->u4_max_strm_size = u4_max_bitstrm_size;
|
||||
|
||||
/* Default init values for other members of bitstream context */
|
||||
ps_bitstrm->u4_strm_buf_offset = 0;
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@
|
|||
* @brief Stream buffer allocated per frame should be atleast MIN_STREAM_SIZE
|
||||
******************************************************************************
|
||||
*/
|
||||
#define MIN_STREAM_SIZE 0x20000
|
||||
#define MIN_STREAM_SIZE 0x800
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -226,6 +226,16 @@ WORD32 ih264e_encode(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *pv_api_op)
|
|||
ps_video_encode_op->s_ive_op.dump_recon = 0;
|
||||
ps_video_encode_op->s_ive_op.u4_encoded_frame_type = IV_NA_FRAME;
|
||||
|
||||
/* Check for output memory allocation size */
|
||||
if (ps_video_encode_ip->s_ive_ip.s_out_buf.u4_bufsize < MIN_STREAM_SIZE)
|
||||
{
|
||||
error_status |= IH264E_INSUFFICIENT_OUTPUT_BUFFER;
|
||||
SET_ERROR_ON_RETURN(error_status,
|
||||
IVE_UNSUPPORTEDPARAM,
|
||||
ps_video_encode_op->s_ive_op.u4_error_code,
|
||||
IV_FAIL);
|
||||
}
|
||||
|
||||
/* copy output info. to internal structure */
|
||||
s_out_buf.s_bits_buf = ps_video_encode_ip->s_ive_ip.s_out_buf;
|
||||
s_out_buf.u4_is_last = 0;
|
||||
|
|
|
|||
|
|
@ -218,7 +218,10 @@ typedef enum
|
|||
IH264E_INVALID_ALT_REF_OPTION = IH264E_CODEC_ERROR_START + 0x2E,
|
||||
|
||||
/**No free picture buffer available to store recon pic */
|
||||
IH264E_NO_FREE_RECONBUF = IH264E_CODEC_ERROR_START + 0x2F,
|
||||
IH264E_NO_FREE_RECONBUF = IH264E_CODEC_ERROR_START + 0x2F,
|
||||
|
||||
/**Not enough memory allocated as output buffer */
|
||||
IH264E_INSUFFICIENT_OUTPUT_BUFFER = IH264E_CODEC_ERROR_START + 0x30,
|
||||
|
||||
/**max failure error code to ensure enum is 32 bits wide */
|
||||
IH264E_FAIL = -1,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue