WebmWriter:read kKeyBitsPerSample from input
kKeyBitsPerSample information from input was not passed to
audioTrackEntry while remuxing. Hence, the metadata of input file and
muxed file didn't match. Now kKeyBitsPerSample is passed as it is in
the input to muxed file.
Bug: 131842669
Test: cts-tradefed run cts-dev -m CtsMediaTestCases --compatibility:module-arg
CtsMediaTestCases:include-annotation:android.platform.test.annotations.RequiresDevice
Change-Id: I04ab296c39596d02c3f2cd9e219d8d80fe2f9185
diff --git a/media/libstagefright/webm/WebmWriter.cpp b/media/libstagefright/webm/WebmWriter.cpp
index 26e0884..5eaadbd 100644
--- a/media/libstagefright/webm/WebmWriter.cpp
+++ b/media/libstagefright/webm/WebmWriter.cpp
@@ -124,6 +124,11 @@
return NULL;
}
+ int32_t bitsPerSample = 0;
+ if (!md->findInt32(kKeyBitsPerSample, &bitsPerSample)) {
+ ALOGV("kKeyBitsPerSample not available");
+ }
+
if (!strncasecmp(mimeType, MEDIA_MIMETYPE_AUDIO_OPUS, strlen(MEDIA_MIMETYPE_AUDIO_OPUS))) {
// Opus in WebM is a well-known, yet under-documented, format. The codec private data
// of the track is an Opus Ogg header (https://tools.ietf.org/html/rfc7845#section-5.1)
@@ -164,8 +169,8 @@
uint8_t* codecPrivateData = codecPrivateBuf->data();
memcpy(codecPrivateData + off, (uint8_t*)header_data, headerSize);
- sp<WebmElement> entry =
- WebmElement::AudioTrackEntry("A_OPUS", nChannels, samplerate, codecPrivateBuf);
+ sp<WebmElement> entry = WebmElement::AudioTrackEntry("A_OPUS", nChannels, samplerate,
+ codecPrivateBuf, bitsPerSample);
return entry;
} else if (!strncasecmp(mimeType,
MEDIA_MIMETYPE_AUDIO_VORBIS,
@@ -203,8 +208,8 @@
off += headerSize2;
memcpy(codecPrivateData + off, headerData3, headerSize3);
- sp<WebmElement> entry =
- WebmElement::AudioTrackEntry("A_VORBIS", nChannels, samplerate, codecPrivateBuf);
+ sp<WebmElement> entry = WebmElement::AudioTrackEntry("A_VORBIS", nChannels, samplerate,
+ codecPrivateBuf, bitsPerSample);
return entry;
} else {
ALOGE("Track (%s) is not a supported audio format", mimeType);