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
commitc56e81c88706d79ce51a314b5bfd3e247ca6f86c (patch)
treeba7cb62f5ff5bbbfe7f96f7ec2179df8b1a1e58a /media
parenta7f52d4665967b4331d38408ba81af37ec589cb4 (diff)
parentb1071331c01d2e2bcfb434a12da8241ba448fb54 (diff)
downloadframeworks_base-c56e81c88706d79ce51a314b5bfd3e247ca6f86c.zip
frameworks_base-c56e81c88706d79ce51a314b5bfd3e247ca6f86c.tar.gz
frameworks_base-c56e81c88706d79ce51a314b5bfd3e247ca6f86c.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;