summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
diff options
context:
space:
mode:
authorDave Burke <daveburke@google.com>2012-05-17 23:55:34 -0700
committerDave Burke <daveburke@google.com>2012-05-17 23:55:34 -0700
commit441fbdea6e46ddc6b99fa864ab1edaa9759ec033 (patch)
tree503d7923b38a326d349de6859ad56c3d034ffd35 /media/libstagefright/codecs/aacdec/SoftAAC2.cpp
parent3748b71a7fe73b0365a93f1fd28ced14219f85e5 (diff)
downloadframeworks_av-441fbdea6e46ddc6b99fa864ab1edaa9759ec033.zip
frameworks_av-441fbdea6e46ddc6b99fa864ab1edaa9759ec033.tar.gz
frameworks_av-441fbdea6e46ddc6b99fa864ab1edaa9759ec033.tar.bz2
Robustness - use defaults if we see bogus sample rate / channels from decoder.
Bug: 6498711 Change-Id: I6950d316a292cfd0cb516ee6d95b6af071b08fdc
Diffstat (limited to 'media/libstagefright/codecs/aacdec/SoftAAC2.cpp')
-rw-r--r--media/libstagefright/codecs/aacdec/SoftAAC2.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
index 8eefc07..96277e2 100644
--- a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
+++ b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
@@ -136,7 +136,7 @@ OMX_ERRORTYPE SoftAAC2::internalGetParameter(
aacParams->eChannelMode = OMX_AUDIO_ChannelModeStereo;
- if (!isConfigured()) {
+ if (!isConfigured() || !mStreamInfo->numChannels || !mStreamInfo->sampleRate) {
aacParams->nChannels = 1;
aacParams->nSampleRate = 44100;
aacParams->nFrameLength = 0;
@@ -170,15 +170,12 @@ OMX_ERRORTYPE SoftAAC2::internalGetParameter(
pcmParams->eChannelMapping[4] = OMX_AUDIO_ChannelLS;
pcmParams->eChannelMapping[5] = OMX_AUDIO_ChannelRS;
- if (!isConfigured()) {
+ if (!isConfigured() || !mStreamInfo->numChannels || !mStreamInfo->sampleRate) {
pcmParams->nChannels = 1;
pcmParams->nSamplingRate = 44100;
} else {
pcmParams->nChannels = mStreamInfo->numChannels;
pcmParams->nSamplingRate = mStreamInfo->sampleRate;
- ALOGI("Sampling rate: %lu, channels: %lu",
- pcmParams->nSamplingRate,
- pcmParams->nChannels);
}
return OMX_ErrorNone;
@@ -383,6 +380,10 @@ void SoftAAC2::onQueueFilled(OMX_U32 portIndex) {
// Check if stream info has changed
if (mStreamInfo->sampleRate != prevSampleRate ||
mStreamInfo->numChannels != prevNumChannels) {
+ ALOGI("Reconfiguring decoder: %d Hz, %d channels",
+ mStreamInfo->sampleRate,
+ mStreamInfo->numChannels);
+
// We're going to want to revisit this input buffer, but
// may have already advanced the offset. Undo that if
// necessary.