summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorGilles-Arnaud Bleu-Laine <gilles@ti.com>2011-09-15 21:30:13 -0500
committerAndreas Huber <andih@google.com>2011-09-30 10:46:12 -0700
commitd3523f89a867afa111bb332887bf006ec3ae93e6 (patch)
tree569a59483ca970991541c7508172df425b6396e0 /media
parentfea8f6217455d8cfc957e5b30f4eb2349859518f (diff)
downloadframeworks_av-d3523f89a867afa111bb332887bf006ec3ae93e6.zip
frameworks_av-d3523f89a867afa111bb332887bf006ec3ae93e6.tar.gz
frameworks_av-d3523f89a867afa111bb332887bf006ec3ae93e6.tar.bz2
Gracefuly return on detecting wrong AAC format from corrupted files
Return BAD_VALUE error upon detection of wrongly formatted files. The client should abort the initialization upon error detection. The current CHECK() interrupts the configurecodec() preventing a graceful exit. Change-Id: Ic79313fa76a63284897df5d91635de87d06f3100 Signed-off-by: Gilles-Arnaud Bleu-Laine <gilles@ti.com>
Diffstat (limited to 'media')
-rwxr-xr-xmedia/libstagefright/OMXCodec.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index e94a8d7..ccc8a18 100755
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -625,7 +625,11 @@ status_t OMXCodec::configureCodec(const sp<MetaData> &meta) {
CHECK(meta->findInt32(kKeyChannelCount, &numChannels));
CHECK(meta->findInt32(kKeySampleRate, &sampleRate));
- setAACFormat(numChannels, sampleRate, bitRate);
+ status_t err = setAACFormat(numChannels, sampleRate, bitRate);
+ if (err != OK) {
+ CODEC_LOGE("setAACFormat() failed (err = %d)", err);
+ return err;
+ }
} else if (!strcasecmp(MEDIA_MIMETYPE_AUDIO_G711_ALAW, mMIME)
|| !strcasecmp(MEDIA_MIMETYPE_AUDIO_G711_MLAW, mMIME)) {
// These are PCM-like formats with a fixed sample rate but
@@ -3358,8 +3362,10 @@ void OMXCodec::setAMRFormat(bool isWAMR, int32_t bitRate) {
}
}
-void OMXCodec::setAACFormat(int32_t numChannels, int32_t sampleRate, int32_t bitRate) {
- CHECK(numChannels == 1 || numChannels == 2);
+status_t OMXCodec::setAACFormat(int32_t numChannels, int32_t sampleRate, int32_t bitRate) {
+ if (numChannels > 2)
+ LOGW("Number of channels: (%d) \n", numChannels);
+
if (mIsEncoder) {
//////////////// input port ////////////////////
setRawAudioFormat(kPortIndexInput, sampleRate, numChannels);
@@ -3410,9 +3416,13 @@ void OMXCodec::setAACFormat(int32_t numChannels, int32_t sampleRate, int32_t bit
profile.nAACERtools = OMX_AUDIO_AACERNone;
profile.eAACProfile = OMX_AUDIO_AACObjectLC;
profile.eAACStreamFormat = OMX_AUDIO_AACStreamFormatMP4FF;
- CHECK_EQ(mOMX->setParameter(mNode, OMX_IndexParamAudioAac,
- &profile, sizeof(profile)), (status_t)OK);
+ err = mOMX->setParameter(mNode, OMX_IndexParamAudioAac,
+ &profile, sizeof(profile));
+ if (err != OK) {
+ CODEC_LOGE("setParameter('OMX_IndexParamAudioAac') failed (err = %d)", err);
+ return err;
+ }
} else {
OMX_AUDIO_PARAM_AACPROFILETYPE profile;
InitOMXParams(&profile);
@@ -3428,8 +3438,14 @@ void OMXCodec::setAACFormat(int32_t numChannels, int32_t sampleRate, int32_t bit
err = mOMX->setParameter(
mNode, OMX_IndexParamAudioAac, &profile, sizeof(profile));
- CHECK_EQ(err, (status_t)OK);
+
+ if (err != OK) {
+ CODEC_LOGE("setParameter('OMX_IndexParamAudioAac') failed (err = %d)", err);
+ return err;
+ }
}
+
+ return OK;
}
void OMXCodec::setG711Format(int32_t numChannels) {