summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-05-17 10:29:36 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-05-17 10:29:36 -0700
commit70361bfe567cc86343126a7ca2f92cb109711aa0 (patch)
tree3fd6269818bd33bde666a6ed01cc634cabd5afda /media
parent7efab4282a7179b2f53a3dbccee3e70d7fce6a7f (diff)
parent83e90762e0ce4470e5174ae3b38afdfca0b9e42f (diff)
downloadframeworks_av-70361bfe567cc86343126a7ca2f92cb109711aa0.zip
frameworks_av-70361bfe567cc86343126a7ca2f92cb109711aa0.tar.gz
frameworks_av-70361bfe567cc86343126a7ca2f92cb109711aa0.tar.bz2
Merge "DO NOT MERGE: Properly construct the ESDS metadata even if sizeof(codec-specific-data) != 2" into honeycomb-mr2
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/matroska/MatroskaExtractor.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/media/libstagefright/matroska/MatroskaExtractor.cpp b/media/libstagefright/matroska/MatroskaExtractor.cpp
index 733de92..642835a 100644
--- a/media/libstagefright/matroska/MatroskaExtractor.cpp
+++ b/media/libstagefright/matroska/MatroskaExtractor.cpp
@@ -660,7 +660,8 @@ static void addESDSFromAudioSpecificInfo(
// AudioSpecificInfo (with size prefix) follows
};
- CHECK(asiSize < 128);
+ // Make sure all sizes can be coded in a single byte.
+ CHECK(asiSize + 22 - 2 < 128);
size_t esdsSize = sizeof(kStaticESDS) + asiSize + 1;
uint8_t *esds = new uint8_t[esdsSize];
memcpy(esds, kStaticESDS, sizeof(kStaticESDS));
@@ -668,6 +669,11 @@ static void addESDSFromAudioSpecificInfo(
*ptr++ = asiSize;
memcpy(ptr, asi, asiSize);
+ // Increment by codecPrivateSize less 2 bytes that are accounted for
+ // already in lengths of 22/17
+ esds[1] += asiSize - 2;
+ esds[6] += asiSize - 2;
+
meta->setData(kKeyESDS, 0, esds, esdsSize);
delete[] esds;