Merge "Fix NPDs in h263 decoder" into klp-dev am: 012e5fd39e am: 9e8dfb5938 am: 9e4a0e1fab am: 3c4401fce8 am: 8867ca40df am: 4ba3934ec3 am: 89349b8d29 am: 176e7e8183 am: 0cbbb5c561
am: 2e1457123f
Change-Id: Idf145d96a408f70a6b5637af0603832f8dfdbcd7
diff --git a/media/libstagefright/codecs/m4v_h263/dec/src/mb_motion_comp.cpp b/media/libstagefright/codecs/m4v_h263/dec/src/mb_motion_comp.cpp
index fbc7be1..877723d 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/src/mb_motion_comp.cpp
+++ b/media/libstagefright/codecs/m4v_h263/dec/src/mb_motion_comp.cpp
@@ -15,6 +15,10 @@
* and limitations under the License.
* -------------------------------------------------------------------
*/
+
+#define LOG_TAG "m4v_h263"
+#include <log/log.h>
+
/*
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
@@ -236,6 +240,11 @@
/* Pointer to previous luminance frame */
c_prev = prev->yChan;
+ if (!c_prev) {
+ ALOGE("b/35269635");
+ android_errorWriteLog(0x534e4554, "35269635");
+ return;
+ }
pred_block = video->mblock->pred_block;
@@ -574,7 +583,14 @@
/* zero motion compensation for previous frame */
/*mby*width + mbx;*/
- c_prev = prev->yChan + offset;
+ c_prev = prev->yChan;
+ if (!c_prev) {
+ ALOGE("b/35269635");
+ android_errorWriteLog(0x534e4554, "35269635");
+ return;
+ }
+ c_prev += offset;
+
/*by*width_uv + bx;*/
cu_prev = prev->uChan + (offset >> 2) + (xpos >> 2);
/*by*width_uv + bx;*/
diff --git a/media/libstagefright/codecs/m4v_h263/dec/src/pvdec_api.cpp b/media/libstagefright/codecs/m4v_h263/dec/src/pvdec_api.cpp
index c1720c6..8d5d071 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/src/pvdec_api.cpp
+++ b/media/libstagefright/codecs/m4v_h263/dec/src/pvdec_api.cpp
@@ -15,6 +15,8 @@
* and limitations under the License.
* -------------------------------------------------------------------
*/
+#define LOG_TAG "pvdec_api"
+#include <log/log.h>
#include "mp4dec_lib.h"
#include "vlc_decode.h"
#include "bitstream.h"
@@ -1335,6 +1337,11 @@
}
}
+ if (!video->prevVop->yChan) {
+ ALOGE("b/35269635");
+ android_errorWriteLog(0x534e4554, "35269635");
+ return PV_FALSE;
+ }
oscl_memcpy(currVop->yChan, video->prevVop->yChan, (decCtrl->size*3) / 2);
video->prevVop = prevVop;