diff options
author | Eric Laurent <elaurent@google.com> | 2013-12-20 17:23:27 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-12-20 17:23:27 -0800 |
commit | 5a086733f8a7472bee85b371e9d02874c9317f3b (patch) | |
tree | a79b4612342c38b8cd1a07d5ef40872ab92685f0 /media/libstagefright | |
parent | d497b648ccb316e3fbda4c081f7c3010318bbcd9 (diff) | |
parent | 1777ed30bfb3b9c1edc037a1b5482d5ab8f28b9b (diff) | |
download | frameworks_av-5a086733f8a7472bee85b371e9d02874c9317f3b.zip frameworks_av-5a086733f8a7472bee85b371e9d02874c9317f3b.tar.gz frameworks_av-5a086733f8a7472bee85b371e9d02874c9317f3b.tar.bz2 |
am 1777ed30: Merge "stagefright: fix offloading HE-AAC sampling rate."
* commit '1777ed30bfb3b9c1edc037a1b5482d5ab8f28b9b':
stagefright: fix offloading HE-AAC sampling rate.
Diffstat (limited to 'media/libstagefright')
-rw-r--r-- | media/libstagefright/MPEG4Extractor.cpp | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp index 9b36b6a..b419f53 100644 --- a/media/libstagefright/MPEG4Extractor.cpp +++ b/media/libstagefright/MPEG4Extractor.cpp @@ -2419,6 +2419,11 @@ status_t MPEG4Extractor::updateAudioTrackInfoFromESDS_MPEG4Audio( return ERROR_MALFORMED; } + static uint32_t kSamplingRate[] = { + 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, + 16000, 12000, 11025, 8000, 7350 + }; + ABitReader br(csd, csd_size); uint32_t objectType = br.getBits(5); @@ -2438,29 +2443,30 @@ status_t MPEG4Extractor::updateAudioTrackInfoFromESDS_MPEG4Audio( numChannels = br.getBits(4); } else { numChannels = br.getBits(4); - if (objectType == 5) { - // SBR specific config per 14496-3 table 1.13 - freqIndex = br.getBits(4); - if (freqIndex == 15) { - if (csd_size < 8) { - return ERROR_MALFORMED; - } - sampleRate = br.getBits(24); - } + + if (freqIndex == 13 || freqIndex == 14) { + return ERROR_MALFORMED; } - if (sampleRate == 0) { - static uint32_t kSamplingRate[] = { - 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, - 16000, 12000, 11025, 8000, 7350 - }; + sampleRate = kSamplingRate[freqIndex]; + } - if (freqIndex == 13 || freqIndex == 14) { + if (objectType == 5 || objectType == 29) { // SBR specific config per 14496-3 table 1.13 + uint32_t extFreqIndex = br.getBits(4); + int32_t extSampleRate; + if (extFreqIndex == 15) { + if (csd_size < 8) { return ERROR_MALFORMED; } - - sampleRate = kSamplingRate[freqIndex]; + extSampleRate = br.getBits(24); + } else { + if (extFreqIndex == 13 || extFreqIndex == 14) { + return ERROR_MALFORMED; + } + extSampleRate = kSamplingRate[extFreqIndex]; } + //TODO: save the extension sampling rate value in meta data => + // mLastTrack->meta->setInt32(kKeyExtSampleRate, extSampleRate); } if (numChannels == 0) { |