Fix an error to deal with 0-size nal units in some AVC files

o related-to-bug: 5890998

Change-Id: If0198e52ff7bbd7422f219f55a37aae97f7d74f1
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_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 @@
                 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 =