Merge "Make sure the .wav extractor does not read data outside the bounds of the 'data' box." into gingerbread
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp
index 4a1d27b..8ab94ad 100644
--- a/cmds/stagefright/stagefright.cpp
+++ b/cmds/stagefright/stagefright.cpp
@@ -60,7 +60,7 @@
return (int64_t)tv.tv_usec + tv.tv_sec * 1000000ll;
}
-static void playSource(OMXClient *client, const sp<MediaSource> &source) {
+static void playSource(OMXClient *client, sp<MediaSource> &source) {
sp<MetaData> meta = source->getFormat();
const char *mime;
@@ -81,6 +81,8 @@
}
}
+ source.clear();
+
status_t err = rawSource->start();
if (err != OK) {
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 3d25a4b..cd70a3d 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -1035,7 +1035,7 @@
mNode, OMX_IndexParamVideoProfileLevelQuerySupported,
¶m, sizeof(param));
- if (err != OK) return err;
+ if (err != OK) break;
int32_t supportedProfile = static_cast<int32_t>(param.eProfile);
int32_t supportedLevel = static_cast<int32_t>(param.eLevel);
@@ -1043,7 +1043,10 @@
supportedProfile, supportedLevel);
if (profile == supportedProfile &&
- level == supportedLevel) {
+ level <= supportedLevel) {
+ // We can further check whether the level is a valid
+ // value; but we will leave that to the omx encoder component
+ // via OMX_SetParameter call.
profileLevel.mProfile = profile;
profileLevel.mLevel = level;
return OK;
diff --git a/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp b/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp
index 7154ba5..7483d60 100644
--- a/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp
+++ b/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp
@@ -317,7 +317,7 @@
&nalType, &nalRefIdc);
if (res != AVCDEC_SUCCESS) {
- LOGE("cannot determine nal type");
+ LOGV("cannot determine nal type");
} else if (nalType == AVC_NALTYPE_SPS || nalType == AVC_NALTYPE_PPS
|| (mSPSSeen && mPPSSeen)) {
switch (nalType) {
@@ -330,6 +330,7 @@
fragSize);
if (res != AVCDEC_SUCCESS) {
+ LOGV("PVAVCDecSeqParamSet returned error %d", res);
break;
}
@@ -396,6 +397,7 @@
fragSize);
if (res != AVCDEC_SUCCESS) {
+ LOGV("PVAVCDecPicParamSet returned error %d", res);
break;
}
@@ -418,8 +420,13 @@
AVCFrameIO Output;
Output.YCbCr[0] = Output.YCbCr[1] = Output.YCbCr[2] = NULL;
- CHECK_EQ(PVAVCDecGetOutput(mHandle, &index, &Release, &Output),
- AVCDEC_SUCCESS);
+ AVCDec_Status status =
+ PVAVCDecGetOutput(mHandle, &index, &Release, &Output);
+
+ if (status != AVCDEC_SUCCESS) {
+ LOGV("PVAVCDecGetOutput returned error %d", status);
+ break;
+ }
CHECK(index >= 0);
CHECK(index < (int32_t)mFrames.size());
@@ -466,7 +473,7 @@
err = OK;
} else {
- LOGV("failed to decode frame (res = %d)", res);
+ LOGV("PVAVCDecodeSlice returned error %d", res);
}
break;
}