From c84b947d802116d64ca11087cfbc52fabd3c7109 Mon Sep 17 00:00:00 2001 From: James Dong Date: Fri, 27 Jan 2012 15:38:44 -0800 Subject: Fix an error to deal with 0-size nal units in some AVC files o related-to-bug: 5890998 Change-Id: If0198e52ff7bbd7422f219f55a37aae97f7d74f1 --- libvideoeditor/vss/mcs/src/M4MCS_API.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/libvideoeditor/vss/mcs/src/M4MCS_API.c b/libvideoeditor/vss/mcs/src/M4MCS_API.c index 3844630..c056ef0 100755 --- a/libvideoeditor/vss/mcs/src/M4MCS_API.c +++ b/libvideoeditor/vss/mcs/src/M4MCS_API.c @@ -1337,21 +1337,8 @@ M4OSA_ERR H264MCS_ProcessSPS_PPS( NSWAVC_MCS_t *instance, M4OSA_UInt8 *inbuff, M4OSA_DEBUG_IF2((M4OSA_NULL == instance), M4ERR_PARAMETER, "H264MCS_ProcessSPS_PPS: instance is M4OSA_NULL"); - switch( instance->m_pDecoderSpecificInfo[4] & 0x3 ) - { - case 0: - instance->m_Num_Bytes_NALUnitLength = 1; - break; - - case 1: - instance->m_Num_Bytes_NALUnitLength = 2; - break; - - case 3: - //Note: Current code supports only this... - instance->m_Num_Bytes_NALUnitLength = 4; - break; - } + instance->m_Num_Bytes_NALUnitLength = + (instance->m_pDecoderSpecificInfo[4] & 0x03) + 1; instance->m_encoder_SPS_Cnt = instance->m_pDecoderSpecificInfo[5] & 0x1F; @@ -1428,6 +1415,12 @@ M4OSA_ERR H264MCS_ProcessSPS_PPS( NSWAVC_MCS_t *instance, M4OSA_UInt8 *inbuff, break; } + if (nal_size == 0) { + M4OSA_TRACE1_1("0 size nal unit at line %d", __LINE__); + frame_size += instance->m_Num_Bytes_NALUnitLength; + continue; + } + p_bs->bitPos = 0; p_bs->lastTotalBits = 0; p_bs->numBitsInBuffer = -- cgit v1.1