From: Steve Kondik Date: Sun, 12 Oct 2014 03:32:31 +0000 (-0700) Subject: stagefright-plugins: Return real bitwidth in getParameter call X-Git-Tag: android-x86-7.1-r1~127 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=29c93196b3d0f26e32852e9e7cb05e43c6a34e89;p=android-x86%2Fexternal-stagefright-plugins.git stagefright-plugins: Return real bitwidth in getParameter call * ..and store the real parameters during setParameter. Change-Id: I170b283da649303e6c016458a3bfebd3431b5c42 --- diff --git a/libstagefright/codecs/ffmpegdec/adec/SoftFFmpegAudio.cpp b/libstagefright/codecs/ffmpegdec/adec/SoftFFmpegAudio.cpp index 9b38fd5..ea357ca 100644 --- a/libstagefright/codecs/ffmpegdec/adec/SoftFFmpegAudio.cpp +++ b/libstagefright/codecs/ffmpegdec/adec/SoftFFmpegAudio.cpp @@ -380,8 +380,8 @@ OMX_ERRORTYPE SoftFFmpegAudio::internalGetParameter( profile->eNumData = OMX_NumericalDataSigned; profile->eEndian = OMX_EndianBig; profile->bInterleaved = OMX_TRUE; - profile->nBitPerSample = 16; profile->ePCMMode = OMX_AUDIO_PCMModeLinear; + profile->nBitPerSample = mAudioTgtFmt == AV_SAMPLE_FMT_S32 ? 24 : 16; if (getOMXChannelMapping(mAudioSrcChannels, profile->eChannelMapping) != OK) { return OMX_ErrorNone; @@ -761,21 +761,20 @@ OMX_ERRORTYPE SoftFFmpegAudio::internalSetParameter( return OMX_ErrorUndefined; } + enum AVSampleFormat targetFmt = AV_SAMPLE_FMT_S16; + if (mHighResAudioEnabled && profile->nBitPerSample > 16) { + targetFmt = AV_SAMPLE_FMT_S32; + } + mAudioTgtFreq = profile->nSamplingRate; + mAudioTgtChannels = profile->nChannels; + mAudioTgtFmt = targetFmt; + if (!isConfigured()) { mCtx->channels = profile->nChannels; mCtx->sample_rate = profile->nSamplingRate; - } else { - // port reconfiguration - enum AVSampleFormat targetFmt = AV_SAMPLE_FMT_S16; - if (mHighResAudioEnabled && profile->nBitPerSample > 16) { - targetFmt = AV_SAMPLE_FMT_S32; - } if (targetFmt != mAudioTgtFmt || profile->nSamplingRate != mAudioTgtFreq || profile->nChannels != mAudioTgtChannels) { - mAudioTgtFreq = profile->nSamplingRate; - mAudioTgtChannels = profile->nChannels; - mAudioTgtFmt = targetFmt; mOutputReconfigured = true; } }