@@ -625,7 +625,11 @@ status_t OMXCodec::configureCodec(const sp<MetaData> &meta) {
625625 CHECK (meta->findInt32 (kKeyChannelCount , &numChannels));
626626 CHECK (meta->findInt32 (kKeySampleRate , &sampleRate));
627627
628- setAACFormat (numChannels, sampleRate, bitRate);
628+ status_t err = setAACFormat (numChannels, sampleRate, bitRate);
629+ if (err != OK) {
630+ CODEC_LOGE (" setAACFormat() failed (err = %d)" , err);
631+ return err;
632+ }
629633 } else if (!strcasecmp (MEDIA_MIMETYPE_AUDIO_G711_ALAW, mMIME )
630634 || !strcasecmp (MEDIA_MIMETYPE_AUDIO_G711_MLAW, mMIME )) {
631635 // These are PCM-like formats with a fixed sample rate but
@@ -3358,8 +3362,10 @@ void OMXCodec::setAMRFormat(bool isWAMR, int32_t bitRate) {
33583362 }
33593363}
33603364
3361- void OMXCodec::setAACFormat (int32_t numChannels, int32_t sampleRate, int32_t bitRate) {
3362- CHECK (numChannels == 1 || numChannels == 2 );
3365+ status_t OMXCodec::setAACFormat (int32_t numChannels, int32_t sampleRate, int32_t bitRate) {
3366+ if (numChannels > 2 )
3367+ LOGW (" Number of channels: (%d) \n " , numChannels);
3368+
33633369 if (mIsEncoder ) {
33643370 // ////////////// input port ////////////////////
33653371 setRawAudioFormat (kPortIndexInput , sampleRate, numChannels);
@@ -3410,9 +3416,13 @@ void OMXCodec::setAACFormat(int32_t numChannels, int32_t sampleRate, int32_t bit
34103416 profile.nAACERtools = OMX_AUDIO_AACERNone;
34113417 profile.eAACProfile = OMX_AUDIO_AACObjectLC;
34123418 profile.eAACStreamFormat = OMX_AUDIO_AACStreamFormatMP4FF;
3413- CHECK_EQ ( mOMX ->setParameter (mNode , OMX_IndexParamAudioAac,
3414- &profile, sizeof (profile)), ( status_t )OK) ;
3419+ err = mOMX ->setParameter (mNode , OMX_IndexParamAudioAac,
3420+ &profile, sizeof (profile));
34153421
3422+ if (err != OK) {
3423+ CODEC_LOGE (" setParameter('OMX_IndexParamAudioAac') failed (err = %d)" , err);
3424+ return err;
3425+ }
34163426 } else {
34173427 OMX_AUDIO_PARAM_AACPROFILETYPE profile;
34183428 InitOMXParams (&profile);
@@ -3428,8 +3438,14 @@ void OMXCodec::setAACFormat(int32_t numChannels, int32_t sampleRate, int32_t bit
34283438
34293439 err = mOMX ->setParameter (
34303440 mNode , OMX_IndexParamAudioAac, &profile, sizeof (profile));
3431- CHECK_EQ (err, (status_t )OK);
3441+
3442+ if (err != OK) {
3443+ CODEC_LOGE (" setParameter('OMX_IndexParamAudioAac') failed (err = %d)" , err);
3444+ return err;
3445+ }
34323446 }
3447+
3448+ return OK;
34333449}
34343450
34353451void OMXCodec::setG711Format (int32_t numChannels) {
0 commit comments