libmix: add the parameters check to avoid mediaserver crash

BZ: 29342

When the MPEG4 parser gets the invaild parameters, add the check
and return error to OMX to avoid mediaserver crash.

Change-Id: I3c0f71b036bd8c630e245366a5fe1d6390695317
Signed-off-by: wgu11 <wangyi.gu@intel.com>
Reviewed-on: http://android.intel.com:8080/46945
Reviewed-by: Ding, Haitao <haitao.ding@intel.com>
Tested-by: Ding, Haitao <haitao.ding@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
diff --git a/videodecoder/VideoDecoderMPEG4.cpp b/videodecoder/VideoDecoderMPEG4.cpp
index 050ab9a..2ddc5ff 100644
--- a/videodecoder/VideoDecoderMPEG4.cpp
+++ b/videodecoder/VideoDecoderMPEG4.cpp
@@ -86,6 +86,14 @@
             (void**)&data);
     CHECK_STATUS("VideoDecoderBase::parseBuffer");
 
+    // When the MPEG4 parser gets the invaild parameters, add the check
+    // and return error to OMX to avoid mediaserver crash.
+    if (data && data->picture_data &&
+        (data->picture_data->picture_param.vop_width == 0
+        || data->picture_data->picture_param.vop_height == 0)) {
+        return DECODE_FAIL;
+    }
+
     if (!mVAStarted) {
         status = startVA(data);
         CHECK_STATUS("startVA");