Merge "stagefright: fix some issues with mkv HDR info conversions" into nyc-dev
diff --git a/media/libstagefright/Utils.cpp b/media/libstagefright/Utils.cpp
index c343dee..4303d09 100644
--- a/media/libstagefright/Utils.cpp
+++ b/media/libstagefright/Utils.cpp
@@ -1375,7 +1375,7 @@
}
// reassemble the csd data into its original form
- sp<ABuffer> csd0;
+ sp<ABuffer> csd0, csd1, csd2;
if (msg->findBuffer("csd-0", &csd0)) {
if (mime == MEDIA_MIMETYPE_VIDEO_AVC) {
sp<ABuffer> csd1;
@@ -1395,6 +1395,21 @@
uint8_t hvcc[1024]; // that oughta be enough, right?
size_t outsize = reassembleHVCC(csd0, hvcc, 1024, 4);
meta->setData(kKeyHVCC, kKeyHVCC, hvcc, outsize);
+ } else if (mime == MEDIA_MIMETYPE_VIDEO_VP9) {
+ meta->setData(kKeyVp9CodecPrivate, 0, csd0->data(), csd0->size());
+ } else if (mime == MEDIA_MIMETYPE_AUDIO_OPUS) {
+ meta->setData(kKeyOpusHeader, 0, csd0->data(), csd0->size());
+ if (msg->findBuffer("csd-1", &csd1)) {
+ meta->setData(kKeyOpusCodecDelay, 0, csd1->data(), csd1->size());
+ }
+ if (msg->findBuffer("csd-2", &csd2)) {
+ meta->setData(kKeyOpusSeekPreRoll, 0, csd2->data(), csd2->size());
+ }
+ } else if (mime == MEDIA_MIMETYPE_AUDIO_VORBIS) {
+ meta->setData(kKeyVorbisInfo, 0, csd0->data(), csd0->size());
+ if (msg->findBuffer("csd-1", &csd1)) {
+ meta->setData(kKeyVorbisBooks, 0, csd1->data(), csd1->size());
+ }
}
}
diff --git a/media/libstagefright/codecs/on2/dec/SoftVPX.cpp b/media/libstagefright/codecs/on2/dec/SoftVPX.cpp
index ba1f263..8022467 100644
--- a/media/libstagefright/codecs/on2/dec/SoftVPX.cpp
+++ b/media/libstagefright/codecs/on2/dec/SoftVPX.cpp
@@ -233,10 +233,17 @@
// (specified in http://www.webmproject.org/vp9/profiles/). Ignore it if
// it was passed.
if (inHeader->nFlags & OMX_BUFFERFLAG_CODECCONFIG) {
- inQueue.erase(inQueue.begin());
- inInfo->mOwnedByUs = false;
- notifyEmptyBufferDone(inHeader);
- continue;
+ // Only ignore CSD buffer for VP9.
+ if (mMode == MODE_VP9) {
+ inQueue.erase(inQueue.begin());
+ inInfo->mOwnedByUs = false;
+ notifyEmptyBufferDone(inHeader);
+ continue;
+ } else {
+ // Tolerate the CSD buffer for VP8. This is a workaround
+ // for b/28689536.
+ ALOGW("WARNING: Got CSD buffer for VP8.");
+ }
}
mTimeStamps[mTimeStampIdx] = inHeader->nTimeStamp;
@@ -257,7 +264,7 @@
notifyEmptyBufferDone(inHeader);
inHeader = NULL;
} else {
- ALOGE("on2 decoder failed to decode frame.");
+ ALOGE("on2 decoder failed to decode frame. err: %d", err);
notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
return;
}
diff --git a/media/libstagefright/webm/WebmElement.cpp b/media/libstagefright/webm/WebmElement.cpp
index b989b1e..a5120b9 100644
--- a/media/libstagefright/webm/WebmElement.cpp
+++ b/media/libstagefright/webm/WebmElement.cpp
@@ -361,6 +361,15 @@
kVideoType,
trackEntryFields);
+ // CSD
+ uint32_t type;
+ const void *data;
+ size_t size;
+ if (meta->findData(kKeyVp9CodecPrivate, &type, &data, &size)) {
+ sp<ABuffer> buf = new ABuffer((void *)data, size); // note: buf does not own data
+ trackEntryFields.push_back(new WebmBinary(kMkvCodecPrivate, buf));
+ }
+
List<sp<WebmElement> > videoInfo;
videoInfo.push_back(new WebmUnsigned(kMkvPixelWidth, width));
videoInfo.push_back(new WebmUnsigned(kMkvPixelHeight, height));