Bug 1409546 - Use literal strings instead of assigning const char* to TrackInfo::mMimeType in mp4 demuxer. r?gerald
This works around an issue in xpcom strings that causes us to report leaking
a string for some unknown reason, so that we can unblock gecko-media which
wants to run the MP4Demuxer seek test.
We should follow up and try to figure out the root cause at a later time.
MozReview-Commit-ID: C6UlOTAIh1l
--- a/media/libstagefright/binding/DecoderData.cpp
+++ b/media/libstagefright/binding/DecoderData.cpp
@@ -204,21 +204,21 @@ MP4AudioInfo::Update(const mp4parse_trac
// start of the codec-specific config blob.
MOZ_ASSERT(audio->extra_data.data);
MOZ_ASSERT(audio->extra_data.length >= 12);
uint16_t preskip =
mozilla::LittleEndian::readUint16(audio->extra_data.data + 10);
mozilla::OpusDataDecoder::AppendCodecDelay(mCodecSpecificConfig,
mozilla::FramesToUsecs(preskip, 48000).value());
} else if (track->codec == mp4parse_codec_AAC) {
- mMimeType = MEDIA_MIMETYPE_AUDIO_AAC;
+ mMimeType = NS_LITERAL_CSTRING("audio/mp4a-latm");
} else if (track->codec == mp4parse_codec_FLAC) {
- mMimeType = MEDIA_MIMETYPE_AUDIO_FLAC;
+ mMimeType = NS_LITERAL_CSTRING("audio/flac");
} else if (track->codec == mp4parse_codec_MP3) {
- mMimeType = MEDIA_MIMETYPE_AUDIO_MPEG;
+ mMimeType = NS_LITERAL_CSTRING("audio/mpeg");
}
mRate = audio->sample_rate;
mChannels = audio->channels;
mBitDepth = audio->bit_depth;
mExtendedProfile = audio->profile;
mDuration = TimeUnit::FromMicroseconds(track->duration);
mMediaTime = TimeUnit::FromMicroseconds(track->media_time);
@@ -242,21 +242,21 @@ MP4AudioInfo::Update(const mp4parse_trac
}
void
MP4VideoInfo::Update(const mp4parse_track_info* track,
const mp4parse_track_video_info* video)
{
UpdateTrackProtectedInfo(*this, video->protected_data);
if (track->codec == mp4parse_codec_AVC) {
- mMimeType = MEDIA_MIMETYPE_VIDEO_AVC;
+ mMimeType = NS_LITERAL_CSTRING("video/avc");
} else if (track->codec == mp4parse_codec_VP9) {
mMimeType = NS_LITERAL_CSTRING("video/vp9");
} else if (track->codec == mp4parse_codec_MP4V) {
- mMimeType = MEDIA_MIMETYPE_VIDEO_MPEG4;
+ mMimeType = NS_LITERAL_CSTRING("video/mp4v-es");
}
mTrackId = track->track_id;
mDuration = TimeUnit::FromMicroseconds(track->duration);
mMediaTime = TimeUnit::FromMicroseconds(track->media_time);
mDisplay.width = video->display_width;
mDisplay.height = video->display_height;
mImage.width = video->image_width;
mImage.height = video->image_height;