h264parse: handle all valid pps_id

... which are in range 0-255.
This commit is contained in:
Mark Nauwelaerts 2011-05-25 11:50:07 +02:00
parent 6a8d66728f
commit a407d54d9d
2 changed files with 8 additions and 8 deletions

View file

@ -148,16 +148,14 @@ gst_nal_bs_read_se (GstNalBs * bs)
/* end parser helper */
static void
gst_h264_params_store_nal (GstH264Params * params, GstBuffer ** store, gint id,
GstNalBs * bs)
gst_h264_params_store_nal (GstH264Params * params, GstBuffer ** store,
gint store_size, gint id, GstNalBs * bs)
{
const guint8 *data;
GstBuffer *buf;
guint size;
g_return_if_fail (MAX_SPS_COUNT == MAX_PPS_COUNT);
if (id >= MAX_SPS_COUNT) {
if (id >= store_size) {
GST_DEBUG_OBJECT (params->el,
"unable to store nal, id out-of-range %d", id);
return;
@ -395,7 +393,8 @@ gst_h264_params_decode_sps (GstH264Params * params, GstNalBs * bs)
if (G_UNLIKELY (sps == NULL))
return FALSE;
gst_h264_params_store_nal (params, params->sps_nals, sps_id, bs);
gst_h264_params_store_nal (params, params->sps_nals, MAX_SPS_COUNT, sps_id,
bs);
/* could be redefined mid stream, arrange for clear state */
memset (sps, 0, sizeof (*sps));
@ -570,7 +569,8 @@ gst_h264_params_decode_pps (GstH264Params * params, GstNalBs * bs)
pps->valid = TRUE;
params->pps = pps;
gst_h264_params_store_nal (params, params->pps_nals, pps_id, bs);
gst_h264_params_store_nal (params, params->pps_nals, MAX_PPS_COUNT, pps_id,
bs);
pps->sps_id = gst_nal_bs_read_ue (bs);
GST_LOG_OBJECT (params->el, "pps %d referencing sps %d", pps_id, pps->sps_id);

View file

@ -74,7 +74,7 @@ typedef struct _GstH264ParamsSPS GstH264ParamsSPS;
typedef struct _GstH264ParamsPPS GstH264ParamsPPS;
#define MAX_SPS_COUNT 32
#define MAX_PPS_COUNT 32
#define MAX_PPS_COUNT 256
/* SPS: sequential parameter sets */
struct _GstH264ParamsSPS