audio: fix meta MIME type failure in MPEG4Writer
- MIME type info included in source->getFormat()
is not updated properly because only temp
variable is updated in AudioSource::getFormat().
MIME type string contains garbage value and it
results in invalid audio formats.
MPEG4Writer returns ERROR_UNSUPPORTED and tunnel
mode recording with 3gpp format fails
- Fix this issue by assigning return value of
getFormat() to a local variable, and check the
return value of findCString.
Change-Id: I242fa25a5d4f7b7e2c88fdd855208dcd42883b6c
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index ca7bcd9..9569fc1 100644
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -441,7 +441,8 @@
// A track of type other than video or audio is not supported.
const char *mime;
- source->getFormat()->findCString(kKeyMIMEType, &mime);
+ sp<MetaData> meta = source->getFormat();
+ CHECK(meta->findCString(kKeyMIMEType, &mime));
bool isAudio = !strncasecmp(mime, "audio/", 6);
bool isVideo = !strncasecmp(mime, "video/", 6);
if (!isAudio && !isVideo) {