summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/MPEG4Extractor.cpp
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2013-12-21 01:18:46 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-12-21 01:18:47 +0000
commit1777ed30bfb3b9c1edc037a1b5482d5ab8f28b9b (patch)
treef45ddac110417238522526b14a8b0bd7d6493150 /media/libstagefright/MPEG4Extractor.cpp
parent1f95555c69219180f792ac742cc0e386496c29e6 (diff)
parent00307ade843ac9219ffb9a351a3145ec2927ea51 (diff)
downloadframeworks_av-1777ed30bfb3b9c1edc037a1b5482d5ab8f28b9b.zip
frameworks_av-1777ed30bfb3b9c1edc037a1b5482d5ab8f28b9b.tar.gz
frameworks_av-1777ed30bfb3b9c1edc037a1b5482d5ab8f28b9b.tar.bz2
Merge "stagefright: fix offloading HE-AAC sampling rate."
Diffstat (limited to 'media/libstagefright/MPEG4Extractor.cpp')
-rw-r--r--media/libstagefright/MPEG4Extractor.cpp40
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) {