summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Andreas Huber <andih@google.com> 2011-05-17 10:34:41 -0700
committer Android Git Automerger <android-git-automerger@android.com> 2011-05-17 10:34:41 -0700
commitc9eb18bb72d594bdbd1593a8dc6a9b10fa44ec42 (patch)
tree31bd497d93a4c59e31a34ba47ed9975b5821df1c
parent143c529f28bd49e077e4bc36ff30ed2ff7ffb838 (diff)
parentbf81d4be0514265875d7deffe50c31a344f6eac5 (diff)
am bf81d4be: am c56e81c8: Merge "DO NOT MERGE: Properly construct the ESDS metadata even if sizeof(codec-specific-data) != 2" into honeycomb-mr2
* commit 'bf81d4be0514265875d7deffe50c31a344f6eac5': DO NOT MERGE: Properly construct the ESDS metadata even if sizeof(codec-specific-data) != 2
-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 733de92bf6b1..642835a1e265 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;