summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/Utils.cpp
diff options
context:
space:
mode:
authorJessica Wagantall <jwagantall@cyngn.com>2016-09-07 14:24:46 -0700
committerJessica Wagantall <jwagantall@cyngn.com>2016-09-07 14:24:46 -0700
commitd9a8909b45b516f54460c2bb13af31a9639fe703 (patch)
tree9fa13ec5ed0a2fc8f5ed4fd89dd29c0cb445cd42 /media/libstagefright/Utils.cpp
parentbdb54da9baf8349a1f030064c3af4ff7318f4771 (diff)
parent6679b5088f36693f5708dcaedd0c9ab7c66df27c (diff)
downloadframeworks_av-d9a8909b45b516f54460c2bb13af31a9639fe703.zip
frameworks_av-d9a8909b45b516f54460c2bb13af31a9639fe703.tar.gz
frameworks_av-d9a8909b45b516f54460c2bb13af31a9639fe703.tar.bz2
Merge tag 'android-6.0.1_r66' into HEAD
Android 6.0.1 release 66 Change-Id: I1d3eb6b66b7482149fe93647c278065fa46dc518
Diffstat (limited to 'media/libstagefright/Utils.cpp')
-rw-r--r--media/libstagefright/Utils.cpp30
1 files changed, 19 insertions, 11 deletions
diff --git a/media/libstagefright/Utils.cpp b/media/libstagefright/Utils.cpp
index 592510b..489ccc3 100644
--- a/media/libstagefright/Utils.cpp
+++ b/media/libstagefright/Utils.cpp
@@ -694,22 +694,30 @@ void convertMessageToMetaData(const sp<AMessage> &msg, sp<MetaData> &meta) {
// reassemble the csd data into its original form
sp<ABuffer> csd0;
if (msg->findBuffer("csd-0", &csd0)) {
+ int csd0size = csd0->size();
if (mime == MEDIA_MIMETYPE_VIDEO_AVC) {
sp<ABuffer> csd1;
if (msg->findBuffer("csd-1", &csd1)) {
- char avcc[1024]; // that oughta be enough, right?
- size_t outsize = reassembleAVCC(csd0, csd1, avcc);
- meta->setData(kKeyAVCC, kKeyAVCC, avcc, outsize);
+ Vector<char> avcc;
+ int avccSize = csd0size + csd1->size() + 1024;
+ if (avcc.resize(avccSize) < 0) {
+ ALOGE("error allocating avcc (size %d); abort setting avcc.", avccSize);
+ } else {
+ size_t outsize = reassembleAVCC(csd0, csd1, avcc.editArray());
+ meta->setData(kKeyAVCC, kKeyAVCC, avcc.array(), outsize);
+ }
}
} else if (mime == MEDIA_MIMETYPE_AUDIO_AAC || mime == MEDIA_MIMETYPE_VIDEO_MPEG4) {
- int csd0size = csd0->size();
- char esds[csd0size + 31];
- // The written ESDS is actually for an audio stream, but it's enough
- // for transporting the CSD to muxers.
- reassembleESDS(csd0, esds);
- meta->setData(kKeyESDS, kKeyESDS, esds, sizeof(esds));
- } else {
- AVUtils::get()->HEVCMuxerUtils().reassembleHEVCCSD(mime, csd0, meta);
+ Vector<char> esds;
+ int esdsSize = csd0size + 31;
+ if (esds.resize(esdsSize) < 0) {
+ ALOGE("error allocating esds (size %d); abort setting esds.", esdsSize);
+ } else {
+ // The written ESDS is actually for an audio stream, but it's enough
+ // for transporting the CSD to muxers.
+ reassembleESDS(csd0, esds.editArray());
+ meta->setData(kKeyESDS, kKeyESDS, esds.array(), esds.size());
+ }
}
}