Bug 1409546 - Use literal strings instead of assigning const char* to TrackInfo::mMimeType in mp4 demuxer. r?gerald draft
authorChris Pearce <cpearce@mozilla.com>
Wed, 18 Oct 2017 08:12:51 +0200
changeset 682141 b0f81c46c785a3aa9a559d2e7344419a9d1494a8
parent 682140 0e1cfb91a09c89ff6d384cb4d9b6bdcd199ca8ce
child 736315 6171fc67cc8ff23ab8a3fc907e39aa384653da79
push id85018
push userbmo:cpearce@mozilla.com
push dateWed, 18 Oct 2017 06:15:23 +0000
reviewersgerald
bugs1409546
milestone58.0a1
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
media/libstagefright/binding/DecoderData.cpp
--- 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;