Bug 1394591 - P1. Use nsCString for decoder description. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 01 Sep 2017 14:25:28 +0200
changeset 428198 968316ac21fa9432fb458c8ae0818b6747e1ff53
parent 428197 dc82b0cabd216cb6901731ea28e6784ab40040f7
child 428199 956185fdc25f130c51a24330aea32c621295d3c9
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1394591
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1394591 - P1. Use nsCString for decoder description. r=gerald This will allow to modify the string returned later. MozReview-Commit-ID: Giw1JyukE4v
dom/media/MediaFormatReader.cpp
dom/media/MediaFormatReader.h
dom/media/ipc/RemoteVideoDecoder.h
dom/media/platforms/PlatformDecoderModule.h
dom/media/platforms/agnostic/AOMDecoder.h
dom/media/platforms/agnostic/BlankDecoderModule.cpp
dom/media/platforms/agnostic/DummyMediaDataDecoder.cpp
dom/media/platforms/agnostic/DummyMediaDataDecoder.h
dom/media/platforms/agnostic/NullDecoderModule.cpp
dom/media/platforms/agnostic/OpusDecoder.h
dom/media/platforms/agnostic/TheoraDecoder.h
dom/media/platforms/agnostic/VPXDecoder.h
dom/media/platforms/agnostic/VorbisDecoder.h
dom/media/platforms/agnostic/WAVDecoder.h
dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.cpp
dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.h
dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
dom/media/platforms/agnostic/gmp/GMPVideoDecoder.h
dom/media/platforms/android/RemoteDataDecoder.h
dom/media/platforms/apple/AppleATDecoder.h
dom/media/platforms/apple/AppleVTDecoder.h
dom/media/platforms/ffmpeg/FFmpegAudioDecoder.h
dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
dom/media/platforms/omx/OmxDataDecoder.h
dom/media/platforms/wmf/WMFAudioMFTManager.h
dom/media/platforms/wmf/WMFMediaDataDecoder.h
dom/media/platforms/wmf/WMFVideoMFTManager.h
dom/media/platforms/wrappers/H264Converter.h
dom/media/platforms/wrappers/MediaDataDecoderProxy.cpp
dom/media/platforms/wrappers/MediaDataDecoderProxy.h
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -474,17 +474,17 @@ MediaFormatReader::DecoderData::Shutdown
   } else {
     // No flush is in action. We can shut down the decoder now.
     mOwner->mShutdownPromisePool->Track(mDecoder->Shutdown());
   }
 
   // mShutdownPromisePool will handle the order of decoder shutdown so
   // we can forget mDecoder and be ready to create a new one.
   mDecoder = nullptr;
-  mDescription = "shutdown";
+  mDescription = NS_LITERAL_CSTRING("shutdown");
   mOwner->ScheduleUpdate(mType == MediaData::AUDIO_DATA
                          ? TrackType::kAudioTrack
                          : TrackType::kVideoTrack);
 }
 
 void
 MediaFormatReader::DecoderData::Flush()
 {
@@ -625,17 +625,17 @@ public:
     return mDecoder->Decode(aSample);
   }
   RefPtr<DecodePromise> Drain() override { return mDecoder->Drain(); }
   RefPtr<FlushPromise> Flush() override { return mDecoder->Flush(); }
   bool IsHardwareAccelerated(nsACString& aFailureReason) const override
   {
     return mDecoder->IsHardwareAccelerated(aFailureReason);
   }
-  const char* GetDescriptionName() const override
+  nsCString GetDescriptionName() const override
   {
     return mDecoder->GetDescriptionName();
   }
   void SetSeekThreshold(const TimeUnit& aTime) override
   {
     mDecoder->SetSeekThreshold(aTime);
   }
   bool SupportDecoderRecycling() const override
@@ -2440,17 +2440,17 @@ MediaFormatReader::Update(TrackType aTra
        TrackTypeToStr(aTrack),
        needInput,
        needOutput,
        decoder.mNumSamplesInput,
        decoder.mNumSamplesOutput,
        uint32_t(size_t(decoder.mSizeOfQueue)),
        decoder.mDecodeRequest.Exists(),
        decoder.mFlushing,
-       decoder.mDescription,
+       decoder.mDescription.get(),
        uint32_t(decoder.mOutput.Length()),
        decoder.mWaitingForData,
        decoder.mDemuxEOS,
        int32_t(decoder.mDrainState),
        decoder.mLastStreamSourceID);
 
   if (IsWaitingOnCDMResource()) {
     // If the content is encrypted, MFR won't start to create decoder until
@@ -3108,29 +3108,29 @@ MediaFormatReader::GetImageContainer()
   return mVideoFrameContainer ? mVideoFrameContainer->GetImageContainer()
                               : nullptr;
 }
 
 void
 MediaFormatReader::GetMozDebugReaderData(nsACString& aString)
 {
   nsAutoCString result;
-  const char* audioName = "unavailable";
-  const char* videoName = audioName;
+  nsAutoCString audioName("unavailable");
+  nsAutoCString videoName = audioName;
 
   if (HasAudio()) {
     MutexAutoLock lock(mAudio.mMutex);
     audioName = mAudio.mDescription;
   }
   if (HasVideo()) {
     MutexAutoLock mon(mVideo.mMutex);
     videoName = mVideo.mDescription;
   }
 
-  result += nsPrintfCString("Audio Decoder: %s\n", audioName);
+  result += nsPrintfCString("Audio Decoder: %s\n", audioName.get());
   result += nsPrintfCString("Audio Frames Decoded: %" PRIu64 "\n",
                             mAudio.mNumSamplesOutputTotal);
   if (HasAudio()) {
     result += nsPrintfCString(
       "Audio State: ni=%d no=%d wp=%d demuxr=%d demuxq=%u decoder=%d tt=%.1f "
       "tths=%d in=%" PRIu64 " out=%" PRIu64
       " qs=%u pending=%u wfd=%d eos=%d ds=%d wfk=%d sid=%u\n",
       NeedInput(mAudio),
@@ -3147,17 +3147,17 @@ MediaFormatReader::GetMozDebugReaderData
       unsigned(size_t(mAudio.mSizeOfQueue)),
       unsigned(mAudio.mOutput.Length()),
       mAudio.mWaitingForData,
       mAudio.mDemuxEOS,
       int32_t(mAudio.mDrainState),
       mAudio.mWaitingForKey,
       mAudio.mLastStreamSourceID);
   }
-  result += nsPrintfCString("Video Decoder: %s\n", videoName);
+  result += nsPrintfCString("Video Decoder: %s\n", videoName.get());
   result +=
     nsPrintfCString("Hardware Video Decoding: %s\n",
                     VideoIsHardwareAccelerated() ? "enabled" : "disabled");
   result +=
     nsPrintfCString("Video Frames Decoded: %" PRIu64 " (skipped=%" PRIu64 ")\n",
                     mVideo.mNumSamplesOutputTotal,
                     mVideo.mNumSamplesSkippedTotal);
   if (HasVideo()) {
--- a/dom/media/MediaFormatReader.h
+++ b/dom/media/MediaFormatReader.h
@@ -392,17 +392,17 @@ private:
     // TaskQueue on which decoder can choose to decode.
     // Only non-null up until the decoder is created.
     RefPtr<TaskQueue> mTaskQueue;
 
     // Mutex protecting mDescription and mDecoder.
     Mutex mMutex;
     // The platform decoder.
     RefPtr<MediaDataDecoder> mDecoder;
-    const char* mDescription;
+    nsCString mDescription;
     void ShutdownDecoder();
 
     // Only accessed from reader's task queue.
     bool mUpdateScheduled;
     bool mDemuxEOS;
     bool mWaitingForData;
     bool mWaitingForKey;
     bool mReceivedNewData;
--- a/dom/media/ipc/RemoteVideoDecoder.h
+++ b/dom/media/ipc/RemoteVideoDecoder.h
@@ -30,17 +30,20 @@ public:
   RefPtr<InitPromise> Init() override;
   RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
   RefPtr<DecodePromise> Drain() override;
   RefPtr<FlushPromise> Flush() override;
   RefPtr<ShutdownPromise> Shutdown() override;
   bool IsHardwareAccelerated(nsACString& aFailureReason) const override;
   void SetSeekThreshold(const media::TimeUnit& aTime) override;
 
-  const char* GetDescriptionName() const override { return "RemoteVideoDecoder"; }
+  nsCString GetDescriptionName() const override
+  {
+    return NS_LITERAL_CSTRING("RemoteVideoDecoder");
+  }
   ConversionRequired NeedsConversion() const override;
 
 private:
   RemoteVideoDecoder();
   ~RemoteVideoDecoder();
 
   // Only ever written to from the reader task queue (during the constructor and
   // destructor when we can guarantee no other threads are accessing it). Only
--- a/dom/media/platforms/PlatformDecoderModule.h
+++ b/dom/media/platforms/PlatformDecoderModule.h
@@ -275,19 +275,18 @@ public:
   // decide whether or not hardware acceleration is supported after creating.
   // It doesn't need to call Init() before calling this function.
   virtual bool IsHardwareAccelerated(nsACString& aFailureReason) const
   {
     return false;
   }
 
   // Return the name of the MediaDataDecoder, only used for decoding.
-  // Only return a static const string, as the information may be accessed
-  // in a non thread-safe fashion.
-  virtual const char* GetDescriptionName() const = 0;
+  // May be accessed in a non thread-safe fashion.
+  virtual nsCString GetDescriptionName() const = 0;
 
   // Set a hint of seek target time to decoder. Decoder will drop any decoded
   // data which pts is smaller than this value. This threshold needs to be clear
   // after reset decoder.
   // Decoder may not honor this value. However, it'd be better that
   // video decoder implements this API to improve seek performance.
   // Note: it should be called before Input() or after Flush().
   virtual void SetSeekThreshold(const media::TimeUnit& aTime) { }
--- a/dom/media/platforms/agnostic/AOMDecoder.h
+++ b/dom/media/platforms/agnostic/AOMDecoder.h
@@ -19,19 +19,19 @@ class AOMDecoder : public MediaDataDecod
 public:
   explicit AOMDecoder(const CreateDecoderParams& aParams);
 
   RefPtr<InitPromise> Init() override;
   RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
   RefPtr<DecodePromise> Drain() override;
   RefPtr<FlushPromise> Flush() override;
   RefPtr<ShutdownPromise> Shutdown() override;
-  const char* GetDescriptionName() const override
+  nsCString GetDescriptionName() const override
   {
-    return "libaom (AV1) video decoder";
+    return NS_LITERAL_CSTRING("av1 libaom video decoder");
   }
 
   // Return true if aMimeType is a one of the strings used
   // by our demuxers to identify AV1 streams.
   static bool IsAV1(const nsACString& aMimeType);
 
   // Return true if aCodecType is a supported codec description.
   static bool IsSupportedCodec(const nsAString& aCodecType);
--- a/dom/media/platforms/agnostic/BlankDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/BlankDecoderModule.cpp
@@ -126,29 +126,29 @@ BlankAudioDataCreator::Create(MediaRawDa
 }
 
 already_AddRefed<MediaDataDecoder>
 BlankDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams)
 {
   const VideoInfo& config = aParams.VideoConfig();
   UniquePtr<DummyDataCreator> creator =
     MakeUnique<BlankVideoDataCreator>(config.mDisplay.width, config.mDisplay.height, aParams.mImageContainer);
-  RefPtr<MediaDataDecoder> decoder =
-    new DummyMediaDataDecoder(Move(creator), "blank media data decoder", aParams);
+  RefPtr<MediaDataDecoder> decoder = new DummyMediaDataDecoder(
+    Move(creator), NS_LITERAL_CSTRING("blank media data decoder"), aParams);
   return decoder.forget();
 }
 
 already_AddRefed<MediaDataDecoder>
 BlankDecoderModule::CreateAudioDecoder(const CreateDecoderParams& aParams)
 {
   const AudioInfo& config = aParams.AudioConfig();
   UniquePtr<DummyDataCreator> creator =
     MakeUnique<BlankAudioDataCreator>(config.mChannels, config.mRate);
-  RefPtr<MediaDataDecoder> decoder =
-    new DummyMediaDataDecoder(Move(creator), "blank media data decoder", aParams);
+  RefPtr<MediaDataDecoder> decoder = new DummyMediaDataDecoder(
+    Move(creator), NS_LITERAL_CSTRING("blank media data decoder"), aParams);
   return decoder.forget();
 }
 
 bool
 BlankDecoderModule::SupportsMimeType(const nsACString& aMimeType,
                                      DecoderDoctorDiagnostics* aDiagnostics) const
 {
   return true;
--- a/dom/media/platforms/agnostic/DummyMediaDataDecoder.cpp
+++ b/dom/media/platforms/agnostic/DummyMediaDataDecoder.cpp
@@ -9,17 +9,17 @@
 #include "mp4_demuxer/H264.h"
 #include "MP4Decoder.h"
 
 namespace mozilla {
 
 DummyDataCreator::~DummyDataCreator() {}
 
 DummyMediaDataDecoder::DummyMediaDataDecoder(UniquePtr<DummyDataCreator>&& aCreator,
-                                             const char* aDescription,
+                                             const nsACString& aDescription,
                                              const CreateDecoderParams& aParams)
   : mCreator(Move(aCreator))
   , mIsH264(MP4Decoder::IsH264(aParams.mConfig.mMimeType))
   , mMaxRefFrames(
       mIsH264
       ? mp4_demuxer::H264::HasSPS(aParams.VideoConfig().mExtraData)
         ? mp4_demuxer::H264::ComputeMaxRefFrames(aParams.VideoConfig().mExtraData)
         : 16
@@ -72,20 +72,20 @@ DummyMediaDataDecoder::Drain()
 
 RefPtr<MediaDataDecoder::FlushPromise>
 DummyMediaDataDecoder::Flush()
 {
   mReorderQueue.Clear();
   return FlushPromise::CreateAndResolve(true, __func__);
 }
 
-const char*
+nsCString
 DummyMediaDataDecoder::GetDescriptionName() const
 {
-  return "blank media data decoder";
+  return NS_LITERAL_CSTRING("blank media data decoder");
 }
 
 MediaDataDecoder::ConversionRequired
 DummyMediaDataDecoder::NeedsConversion() const
 {
   return mIsH264
          ? ConversionRequired::kNeedAVCC
          : ConversionRequired::kNeedNone;
--- a/dom/media/platforms/agnostic/DummyMediaDataDecoder.h
+++ b/dom/media/platforms/agnostic/DummyMediaDataDecoder.h
@@ -24,30 +24,30 @@ public:
 };
 
 // Decoder that uses a passed in object's Create function to create Null
 // MediaData objects.
 class DummyMediaDataDecoder : public MediaDataDecoder
 {
 public:
   DummyMediaDataDecoder(UniquePtr<DummyDataCreator>&& aCreator,
-                        const char* aDescription,
+                        const nsACString& aDescription,
                         const CreateDecoderParams& aParams);
 
   RefPtr<InitPromise> Init() override;
 
   RefPtr<ShutdownPromise> Shutdown() override;
 
   RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
 
   RefPtr<DecodePromise> Drain() override;
 
   RefPtr<FlushPromise> Flush() override;
 
-  const char* GetDescriptionName() const override;
+  nsCString GetDescriptionName() const override;
 
   ConversionRequired NeedsConversion() const override;
 
 private:
   UniquePtr<DummyDataCreator> mCreator;
   const bool mIsH264;
   const uint32_t mMaxRefFrames;
   ReorderQueue mReorderQueue;
--- a/dom/media/platforms/agnostic/NullDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/NullDecoderModule.cpp
@@ -29,18 +29,18 @@ public:
 
 class NullDecoderModule : public PlatformDecoderModule {
 public:
 
   // Decode thread.
   already_AddRefed<MediaDataDecoder>
   CreateVideoDecoder(const CreateDecoderParams& aParams) override {
     UniquePtr<DummyDataCreator> creator = MakeUnique<NullVideoDataCreator>();
-    RefPtr<MediaDataDecoder> decoder =
-      new DummyMediaDataDecoder(Move(creator), "null media data decoder", aParams);
+    RefPtr<MediaDataDecoder> decoder = new DummyMediaDataDecoder(
+      Move(creator), NS_LITERAL_CSTRING("null media data decoder"), aParams);
     return decoder.forget();
   }
 
   // Decode thread.
   already_AddRefed<MediaDataDecoder>
   CreateAudioDecoder(const CreateDecoderParams& aParams) override {
     MOZ_ASSERT(false, "Audio decoders are unsupported.");
     return nullptr;
--- a/dom/media/platforms/agnostic/OpusDecoder.h
+++ b/dom/media/platforms/agnostic/OpusDecoder.h
@@ -23,19 +23,19 @@ public:
   explicit OpusDataDecoder(const CreateDecoderParams& aParams);
   ~OpusDataDecoder();
 
   RefPtr<InitPromise> Init() override;
   RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
   RefPtr<DecodePromise> Drain() override;
   RefPtr<FlushPromise> Flush() override;
   RefPtr<ShutdownPromise> Shutdown() override;
-  const char* GetDescriptionName() const override
+  nsCString GetDescriptionName() const override
   {
-    return "opus audio decoder";
+    return NS_LITERAL_CSTRING("opus audio decoder");
   }
 
   // Return true if mimetype is Opus
   static bool IsOpus(const nsACString& aMimeType);
 
   // Pack pre-skip/CodecDelay, given in microseconds, into a
   // MediaByteBuffer. The decoder expects this value to come
   // from the container (if any) and to precede the OpusHead
--- a/dom/media/platforms/agnostic/TheoraDecoder.h
+++ b/dom/media/platforms/agnostic/TheoraDecoder.h
@@ -22,19 +22,19 @@ public:
   RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
   RefPtr<DecodePromise> Drain() override;
   RefPtr<FlushPromise> Flush() override;
   RefPtr<ShutdownPromise> Shutdown() override;
 
   // Return true if mimetype is a Theora codec
   static bool IsTheora(const nsACString& aMimeType);
 
-  const char* GetDescriptionName() const override
+  nsCString GetDescriptionName() const override
   {
-    return "theora video decoder";
+    return NS_LITERAL_CSTRING("theora video decoder");
   }
 
 private:
   ~TheoraDecoder();
   nsresult DoDecodeHeader(const unsigned char* aData, size_t aLength);
 
   RefPtr<DecodePromise> ProcessDecode(MediaRawData* aSample);
 
--- a/dom/media/platforms/agnostic/VPXDecoder.h
+++ b/dom/media/platforms/agnostic/VPXDecoder.h
@@ -22,19 +22,19 @@ class VPXDecoder : public MediaDataDecod
 public:
   explicit VPXDecoder(const CreateDecoderParams& aParams);
 
   RefPtr<InitPromise> Init() override;
   RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
   RefPtr<DecodePromise> Drain() override;
   RefPtr<FlushPromise> Flush() override;
   RefPtr<ShutdownPromise> Shutdown() override;
-  const char* GetDescriptionName() const override
+  nsCString GetDescriptionName() const override
   {
-    return "libvpx video decoder";
+    return NS_LITERAL_CSTRING("libvpx video decoder");
   }
 
   enum Codec: uint8_t
   {
     VP8 = 1 << 0,
     VP9 = 1 << 1,
     Unknown = 1 << 7,
   };
--- a/dom/media/platforms/agnostic/VorbisDecoder.h
+++ b/dom/media/platforms/agnostic/VorbisDecoder.h
@@ -24,19 +24,19 @@ public:
   explicit VorbisDataDecoder(const CreateDecoderParams& aParams);
   ~VorbisDataDecoder();
 
   RefPtr<InitPromise> Init() override;
   RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
   RefPtr<DecodePromise> Drain() override;
   RefPtr<FlushPromise> Flush() override;
   RefPtr<ShutdownPromise> Shutdown() override;
-  const char* GetDescriptionName() const override
+  nsCString GetDescriptionName() const override
   {
-    return "vorbis audio decoder";
+    return NS_LITERAL_CSTRING("vorbis audio decoder");
   }
 
   // Return true if mimetype is Vorbis
   static bool IsVorbis(const nsACString& aMimeType);
   static const AudioConfig::Channel* VorbisLayout(uint32_t aChannels);
 
 private:
   nsresult DecodeHeader(const unsigned char* aData, size_t aLength);
--- a/dom/media/platforms/agnostic/WAVDecoder.h
+++ b/dom/media/platforms/agnostic/WAVDecoder.h
@@ -20,19 +20,19 @@ public:
   // Return true if mimetype is Wave
   static bool IsWave(const nsACString& aMimeType);
 
   RefPtr<InitPromise> Init() override;
   RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
   RefPtr<DecodePromise> Drain() override;
   RefPtr<FlushPromise> Flush() override;
   RefPtr<ShutdownPromise> Shutdown() override;
-  const char* GetDescriptionName() const override
+  nsCString GetDescriptionName() const override
   {
-    return "wave audio decoder";
+    return NS_LITERAL_CSTRING("wave audio decoder");
   }
 
 private:
   RefPtr<DecodePromise> ProcessDecode(MediaRawData* aSample);
   const AudioInfo& mInfo;
   const RefPtr<TaskQueue> mTaskQueue;
 };
 
--- a/dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.cpp
+++ b/dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.cpp
@@ -86,20 +86,20 @@ ChromiumCDMVideoDecoder::Init()
   VideoInfo info = mConfig;
   RefPtr<layers::ImageContainer> imageContainer = mImageContainer;
   return InvokeAsync(
     mGMPThread, __func__, [cdm, config, info, imageContainer]() {
       return cdm->InitializeVideoDecoder(config, info, imageContainer);
     });
 }
 
-const char*
+nsCString
 ChromiumCDMVideoDecoder::GetDescriptionName() const
 {
-  return "Chromium CDM video decoder";
+  return NS_LITERAL_CSTRING("chromium cdm video decoder");
 }
 
 MediaDataDecoder::ConversionRequired
 ChromiumCDMVideoDecoder::NeedsConversion() const
 {
   return mConvertToAnnexB ? ConversionRequired::kNeedAnnexB
                           : ConversionRequired::kNeedNone;
 }
--- a/dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.h
+++ b/dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.h
@@ -21,17 +21,17 @@ public:
   ChromiumCDMVideoDecoder(const GMPVideoDecoderParams& aParams,
                           CDMProxy* aCDMProxy);
 
   RefPtr<InitPromise> Init() override;
   RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
   RefPtr<FlushPromise> Flush() override;
   RefPtr<DecodePromise> Drain() override;
   RefPtr<ShutdownPromise> Shutdown() override;
-  const char* GetDescriptionName() const override;
+  nsCString GetDescriptionName() const override;
   ConversionRequired NeedsConversion() const override;
 
 private:
   ~ChromiumCDMVideoDecoder();
 
   RefPtr<gmp::ChromiumCDMParent> mCDMParent;
   const VideoInfo mConfig;
   RefPtr<GMPCrashHelper> mCrashHelper;
--- a/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
@@ -201,17 +201,17 @@ public:
     MOZ_ASSERT(!mIsShutdown);
     mIsShutdown = true;
     mSamplesWaitingForKey = nullptr;
     RefPtr<MediaDataDecoder> decoder = mDecoder.forget();
     mProxy = nullptr;
     return decoder->Shutdown();
   }
 
-  const char* GetDescriptionName() const override
+  nsCString GetDescriptionName() const override
   {
     return mDecoder->GetDescriptionName();
   }
 
   ConversionRequired NeedsConversion() const override
   {
     return mDecoder->NeedsConversion();
   }
--- a/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.h
+++ b/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.h
@@ -33,19 +33,19 @@ class GMPVideoDecoder : public MediaData
 public:
   explicit GMPVideoDecoder(const GMPVideoDecoderParams& aParams);
 
   RefPtr<InitPromise> Init() override;
   RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
   RefPtr<DecodePromise> Drain() override;
   RefPtr<FlushPromise> Flush() override;
   RefPtr<ShutdownPromise> Shutdown() override;
-  const char* GetDescriptionName() const override
+  nsCString GetDescriptionName() const override
   {
-    return "GMP video decoder";
+    return NS_LITERAL_CSTRING("gmp video decoder");
   }
   ConversionRequired NeedsConversion() const override
   {
     return mConvertToAnnexB ? ConversionRequired::kNeedAnnexB
                             : ConversionRequired::kNeedAVCC;
   }
 
   // GMPVideoDecoderCallbackProxy
--- a/dom/media/platforms/android/RemoteDataDecoder.h
+++ b/dom/media/platforms/android/RemoteDataDecoder.h
@@ -26,19 +26,19 @@ public:
   CreateVideoDecoder(const CreateDecoderParams& aParams,
                      const nsString& aDrmStubId,
                      CDMProxy* aProxy);
 
   RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
   RefPtr<DecodePromise> Drain() override;
   RefPtr<FlushPromise> Flush() override;
   RefPtr<ShutdownPromise> Shutdown() override;
-  const char* GetDescriptionName() const override
+  nsCString GetDescriptionName() const override
   {
-    return "android remote decoder";
+    return NS_LITERAL_CSTRING("android decoder (remote)");
   }
 
 protected:
   virtual ~RemoteDataDecoder() { }
   RemoteDataDecoder(MediaData::Type aType,
                     const nsACString& aMimeType,
                     java::sdk::MediaFormat::Param aFormat,
                     const nsString& aDrmStubId, TaskQueue* aTaskQueue);
--- a/dom/media/platforms/apple/AppleATDecoder.h
+++ b/dom/media/platforms/apple/AppleATDecoder.h
@@ -24,19 +24,19 @@ public:
   ~AppleATDecoder();
 
   RefPtr<InitPromise> Init() override;
   RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
   RefPtr<DecodePromise> Drain() override;
   RefPtr<FlushPromise> Flush() override;
   RefPtr<ShutdownPromise> Shutdown() override;
 
-  const char* GetDescriptionName() const override
+  nsCString GetDescriptionName() const override
   {
-    return "apple CoreMedia decoder";
+    return NS_LITERAL_CSTRING("apple coremedia decoder");
   }
 
   // Callbacks also need access to the config.
   const AudioInfo& mConfig;
 
   // Use to extract magic cookie for HE-AAC detection.
   nsTArray<uint8_t> mMagicCookie;
   // Will be set to true should an error occurred while attempting to retrieve
--- a/dom/media/platforms/apple/AppleVTDecoder.h
+++ b/dom/media/platforms/apple/AppleVTDecoder.h
@@ -48,21 +48,21 @@ public:
   RefPtr<ShutdownPromise> Shutdown() override;
   void SetSeekThreshold(const media::TimeUnit& aTime) override;
 
   bool IsHardwareAccelerated(nsACString& aFailureReason) const override
   {
     return mIsHardwareAccelerated;
   }
 
-  const char* GetDescriptionName() const override
+  nsCString GetDescriptionName() const override
   {
     return mIsHardwareAccelerated
-           ? "apple hardware VT decoder"
-           : "apple software VT decoder";
+           ? NS_LITERAL_CSTRING("apple hardware VT decoder")
+           : NS_LITERAL_CSTRING("apple software VT decoder");
   }
 
   ConversionRequired NeedsConversion() const override
   {
     return ConversionRequired::kNeedAVCC;
   }
 
   // Access from the taskqueue and the decoder's thread.
--- a/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.h
+++ b/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.h
@@ -22,19 +22,19 @@ class FFmpegAudioDecoder<LIBAV_VER> : pu
 public:
   FFmpegAudioDecoder(FFmpegLibWrapper* aLib, TaskQueue* aTaskQueue,
                      const AudioInfo& aConfig);
   virtual ~FFmpegAudioDecoder();
 
   RefPtr<InitPromise> Init() override;
   void InitCodecContext() override;
   static AVCodecID GetCodecId(const nsACString& aMimeType);
-  const char* GetDescriptionName() const override
+  nsCString GetDescriptionName() const override
   {
-    return "ffmpeg audio decoder";
+    return NS_LITERAL_CSTRING("ffmpeg audio decoder");
   }
 
 private:
   RefPtr<DecodePromise> ProcessDecode(MediaRawData* aSample) override;
   RefPtr<DecodePromise> ProcessDrain() override;
 };
 
 } // namespace mozilla
--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
@@ -32,22 +32,22 @@ public:
                      const VideoInfo& aConfig,
                      KnowsCompositor* aAllocator,
                      ImageContainer* aImageContainer,
                      bool aLowLatency);
   virtual ~FFmpegVideoDecoder();
 
   RefPtr<InitPromise> Init() override;
   void InitCodecContext() override;
-  const char* GetDescriptionName() const override
+  nsCString GetDescriptionName() const override
   {
 #ifdef USING_MOZFFVPX
-    return "ffvpx video decoder";
+    return NS_LITERAL_CSTRING("ffvpx video decoder");
 #else
-    return "ffmpeg video decoder";
+    return NS_LITERAL_CSTRING("ffmpeg video decoder");
 #endif
   }
   ConversionRequired NeedsConversion() const override
   {
     return ConversionRequired::kNeedAVCC;
   }
 
   static AVCodecID GetCodecId(const nsACString& aMimeType);
--- a/dom/media/platforms/omx/OmxDataDecoder.h
+++ b/dom/media/platforms/omx/OmxDataDecoder.h
@@ -65,19 +65,19 @@ public:
                  layers::ImageContainer* aImageContainer);
 
   RefPtr<InitPromise> Init() override;
   RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
   RefPtr<DecodePromise> Drain() override;
   RefPtr<FlushPromise> Flush() override;
   RefPtr<ShutdownPromise> Shutdown() override;
 
-  const char* GetDescriptionName() const override
+  nsCString GetDescriptionName() const override
   {
-    return "omx decoder";
+    return NS_LITERAL_CSTRING("omx decoder");
   }
 
   ConversionRequired NeedsConversion() const override
   {
     return ConversionRequired::kNeedAnnexB;
   }
 
   // Return true if event is handled.
--- a/dom/media/platforms/wmf/WMFAudioMFTManager.h
+++ b/dom/media/platforms/wmf/WMFAudioMFTManager.h
@@ -31,19 +31,19 @@ public:
 
   void Shutdown() override;
 
   TrackInfo::TrackType GetType() override
   {
     return TrackInfo::kAudioTrack;
   }
 
-  const char* GetDescriptionName() const override
+  nsCString GetDescriptionName() const override
   {
-    return "wmf audio decoder";
+    return NS_LITERAL_CSTRING("wmf audio decoder");
   }
 
 private:
   HRESULT UpdateOutputType();
 
   uint32_t mAudioChannels;
   uint32_t mAudioRate;
   nsTArray<BYTE> mUserData;
--- a/dom/media/platforms/wmf/WMFMediaDataDecoder.h
+++ b/dom/media/platforms/wmf/WMFMediaDataDecoder.h
@@ -55,17 +55,17 @@ public:
 
   virtual bool IsHardwareAccelerated(nsACString& aFailureReason) const
   {
     return false;
   }
 
   virtual TrackInfo::TrackType GetType() = 0;
 
-  virtual const char* GetDescriptionName() const = 0;
+  virtual nsCString GetDescriptionName() const = 0;
 
   virtual void SetSeekThreshold(const media::TimeUnit& aTime)
   {
     mSeekTargetThreshold = Some(aTime);
   }
 
   virtual MediaDataDecoder::ConversionRequired NeedsConversion() const
   {
@@ -97,19 +97,20 @@ public:
   RefPtr<DecodePromise> Drain() override;
 
   RefPtr<FlushPromise> Flush() override;
 
   RefPtr<ShutdownPromise> Shutdown() override;
 
   bool IsHardwareAccelerated(nsACString& aFailureReason) const override;
 
-  const char* GetDescriptionName() const override
+  nsCString GetDescriptionName() const override
   {
-    return mMFTManager ? mMFTManager->GetDescriptionName() : "";
+    return mMFTManager
+           ? mMFTManager->GetDescriptionName() : NS_LITERAL_CSTRING("");
   }
 
   ConversionRequired NeedsConversion() const override
   {
     MOZ_ASSERT(mMFTManager);
     return mMFTManager->NeedsConversion();
   }
 
--- a/dom/media/platforms/wmf/WMFVideoMFTManager.h
+++ b/dom/media/platforms/wmf/WMFVideoMFTManager.h
@@ -35,24 +35,24 @@ public:
   HRESULT Output(int64_t aStreamOffset, RefPtr<MediaData>& aOutput) override;
 
   void Shutdown() override;
 
   bool IsHardwareAccelerated(nsACString& aFailureReason) const override;
 
   TrackInfo::TrackType GetType() override { return TrackInfo::kVideoTrack; }
 
-  const char* GetDescriptionName() const override
+  nsCString GetDescriptionName() const override
   {
     nsCString failureReason;
     return IsHardwareAccelerated(failureReason)
       ? mAMDVP9InUse
-        ? "AMD VP9 hardware video decoder"
-        : "wmf hardware video decoder"
-      : "wmf software video decoder";
+        ? NS_LITERAL_CSTRING("AMD VP9 hardware video decoder")
+        : NS_LITERAL_CSTRING("wmf hardware video decoder")
+      : NS_LITERAL_CSTRING("wmf software video decoder");
   }
 
   void Flush() override
   {
     MFTManager::Flush();
     mDraining = false;
     mSamplesCount = 0;
   }
--- a/dom/media/platforms/wrappers/H264Converter.h
+++ b/dom/media/platforms/wrappers/H264Converter.h
@@ -30,22 +30,22 @@ public:
   virtual ~H264Converter();
 
   RefPtr<InitPromise> Init() override;
   RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
   RefPtr<DecodePromise> Drain() override;
   RefPtr<FlushPromise> Flush() override;
   RefPtr<ShutdownPromise> Shutdown() override;
   bool IsHardwareAccelerated(nsACString& aFailureReason) const override;
-  const char* GetDescriptionName() const override
+  nsCString GetDescriptionName() const override
   {
     if (mDecoder) {
       return mDecoder->GetDescriptionName();
     }
-    return "H264Converter decoder (pending)";
+    return NS_LITERAL_CSTRING("H264Converter decoder (pending)");
   }
   void SetSeekThreshold(const media::TimeUnit& aTime) override;
   bool SupportDecoderRecycling() const override
   {
     if (mDecoder) {
       return mDecoder->SupportDecoderRecycling();
     }
     return false;
--- a/dom/media/platforms/wrappers/MediaDataDecoderProxy.cpp
+++ b/dom/media/platforms/wrappers/MediaDataDecoderProxy.cpp
@@ -74,17 +74,17 @@ MediaDataDecoderProxy::Shutdown()
   if (!mProxyThread) {
     return mProxyDecoder->Shutdown();
   }
   RefPtr<MediaDataDecoderProxy> self = this;
   return InvokeAsync(mProxyThread, __func__,
                      [self, this]() { return mProxyDecoder->Shutdown(); });
 }
 
-const char*
+nsCString
 MediaDataDecoderProxy::GetDescriptionName() const
 {
   MOZ_ASSERT(!mIsShutdown);
 
   return mProxyDecoder->GetDescriptionName();
 }
 
 bool
--- a/dom/media/platforms/wrappers/MediaDataDecoderProxy.h
+++ b/dom/media/platforms/wrappers/MediaDataDecoderProxy.h
@@ -41,17 +41,17 @@ public:
     mProxyDecoder = aProxyDecoder;
   }
 
   RefPtr<InitPromise> Init() override;
   RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
   RefPtr<DecodePromise> Drain() override;
   RefPtr<FlushPromise> Flush() override;
   RefPtr<ShutdownPromise> Shutdown() override;
-  const char* GetDescriptionName() const override;
+  nsCString GetDescriptionName() const override;
   bool IsHardwareAccelerated(nsACString& aFailureReason) const override;
   void SetSeekThreshold(const media::TimeUnit& aTime) override;
   bool SupportDecoderRecycling() const override;
   ConversionRequired NeedsConversion() const override;
 
 private:
   RefPtr<MediaDataDecoder> mProxyDecoder;
   RefPtr<AbstractThread> mProxyThread;