Loading media/libstagefright/Utils.cpp +17 −7 Original line number Original line Diff line number Diff line Loading @@ -613,18 +613,28 @@ void convertMessageToMetaData(const sp<AMessage> &msg, sp<MetaData> &meta) { // reassemble the csd data into its original form // reassemble the csd data into its original form sp<ABuffer> csd0; sp<ABuffer> csd0; if (msg->findBuffer("csd-0", &csd0)) { if (msg->findBuffer("csd-0", &csd0)) { int csd0size = csd0->size(); if (mime.startsWith("video/")) { // do we need to be stricter than this? if (mime.startsWith("video/")) { // do we need to be stricter than this? sp<ABuffer> csd1; sp<ABuffer> csd1; if (msg->findBuffer("csd-1", &csd1)) { if (msg->findBuffer("csd-1", &csd1)) { char avcc[1024]; // that oughta be enough, right? Vector<char> avcc; size_t outsize = reassembleAVCC(csd0, csd1, avcc); int avccSize = csd0size + csd1->size() + 1024; meta->setData(kKeyAVCC, kKeyAVCC, avcc, outsize); 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.startsWith("audio/")) { } else if (mime.startsWith("audio/")) { int csd0size = csd0->size(); Vector<char> esds; char esds[csd0size + 31]; int esdsSize = csd0size + 31; reassembleESDS(csd0, esds); if (esds.resize(esdsSize) < 0) { meta->setData(kKeyESDS, kKeyESDS, esds, sizeof(esds)); ALOGE("error allocating esds (size %d); abort setting esds.", esdsSize); } else { reassembleESDS(csd0, esds.editArray()); meta->setData(kKeyESDS, kKeyESDS, esds.array(), esds.size()); } } } } } Loading Loading
media/libstagefright/Utils.cpp +17 −7 Original line number Original line Diff line number Diff line Loading @@ -613,18 +613,28 @@ void convertMessageToMetaData(const sp<AMessage> &msg, sp<MetaData> &meta) { // reassemble the csd data into its original form // reassemble the csd data into its original form sp<ABuffer> csd0; sp<ABuffer> csd0; if (msg->findBuffer("csd-0", &csd0)) { if (msg->findBuffer("csd-0", &csd0)) { int csd0size = csd0->size(); if (mime.startsWith("video/")) { // do we need to be stricter than this? if (mime.startsWith("video/")) { // do we need to be stricter than this? sp<ABuffer> csd1; sp<ABuffer> csd1; if (msg->findBuffer("csd-1", &csd1)) { if (msg->findBuffer("csd-1", &csd1)) { char avcc[1024]; // that oughta be enough, right? Vector<char> avcc; size_t outsize = reassembleAVCC(csd0, csd1, avcc); int avccSize = csd0size + csd1->size() + 1024; meta->setData(kKeyAVCC, kKeyAVCC, avcc, outsize); 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.startsWith("audio/")) { } else if (mime.startsWith("audio/")) { int csd0size = csd0->size(); Vector<char> esds; char esds[csd0size + 31]; int esdsSize = csd0size + 31; reassembleESDS(csd0, esds); if (esds.resize(esdsSize) < 0) { meta->setData(kKeyESDS, kKeyESDS, esds, sizeof(esds)); ALOGE("error allocating esds (size %d); abort setting esds.", esdsSize); } else { reassembleESDS(csd0, esds.editArray()); meta->setData(kKeyESDS, kKeyESDS, esds.array(), esds.size()); } } } } } Loading