Bug 1329543 - Remove GMPAudioDecoder and unencrypted GMP decoding. r=gerald
authorChris Pearce <cpearce@mozilla.com>
Sat, 14 Jan 2017 11:44:41 +0800
changeset 357869 182ae7543ea4a0bdf04352bbb3fb062a6ac0351c
parent 357868 a54e6cd31eb643e0dc33ae5859b709cbcdc7a9ff
child 357870 58e504f4afdc59bda4af3c8d7ef061dee95b7f4b
push id10621
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 16:02:43 +0000
treeherdermozilla-aurora@dca7b42e6c67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1329543
milestone53.0a1
Bug 1329543 - Remove GMPAudioDecoder and unencrypted GMP decoding. r=gerald MozReview-Commit-ID: JLlHmyEg6Qo
browser/app/profile/firefox.js
dom/media/platforms/agnostic/eme/EMEAudioDecoder.cpp
dom/media/platforms/agnostic/eme/EMEAudioDecoder.h
dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
dom/media/platforms/agnostic/eme/moz.build
dom/media/platforms/agnostic/gmp/GMPAudioDecoder.cpp
dom/media/platforms/agnostic/gmp/GMPAudioDecoder.h
dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp
dom/media/platforms/agnostic/gmp/GMPDecoderModule.h
dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp
dom/media/platforms/agnostic/gmp/moz.build
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1351,26 +1351,16 @@ pref("ui.key.menuAccessKeyFocuses", true
 // enable DRM, whereupon the EME plugin binaries will be downloaded if
 // permission is granted.
 pref("media.eme.enabled", false);
 #else
 pref("media.eme.enabled", true);
 #endif
 pref("media.eme.apiVisible", true);
 
-// Decode using Gecko Media Plugins in <video>, if a system decoder is not
-// availble and the preferred GMP is available.
-pref("media.gmp.decoder.enabled", false);
-
-// If decoding-via-GMP is turned on for <video>, use Adobe's GMP for decoding,
-// if it's available. Note: We won't fallback to another GMP if Adobe's is not
-// installed.
-pref("media.gmp.decoder.aac", 2);
-pref("media.gmp.decoder.h264", 2);
-
 // Whether we should run a test-pattern through EME GMPs before assuming they'll
 // decode H.264.
 pref("media.gmp.trial-create.enabled", true);
 
 // Note: when media.gmp-*.visible is true, provided we're running on a
 // supported platform/OS version, the corresponding CDM appears in the
 // plugins list, Firefox will download the GMP/CDM if enabled, and our
 // UI to re-enable EME prompts the user to re-enable EME if it's disabled
deleted file mode 100644
--- a/dom/media/platforms/agnostic/eme/EMEAudioDecoder.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "EMEAudioDecoder.h"
-#include "mozilla/CDMProxy.h"
-
-namespace mozilla {
-
-void
-EMEAudioCallbackAdapter::Error(GMPErr aErr)
-{
-  if (aErr == GMPNoKeyErr) {
-    // The GMP failed to decrypt a frame due to not having a key. This can
-    // happen if a key expires or a session is closed during playback.
-    NS_WARNING("GMP failed to decrypt due to lack of key");
-    return;
-  }
-  AudioCallbackAdapter::Error(aErr);
-}
-
-EMEAudioDecoder::EMEAudioDecoder(CDMProxy* aProxy,
-                                 const GMPAudioDecoderParams& aParams)
-  : GMPAudioDecoder(GMPAudioDecoderParams(aParams).WithAdapter(
-                    new EMEAudioCallbackAdapter(aParams.mCallback)))
-  , mProxy(aProxy)
-{}
-
-void
-EMEAudioDecoder::InitTags(nsTArray<nsCString>& aTags)
-{
-  aTags.AppendElement(NS_LITERAL_CSTRING("aac"));
-  aTags.AppendElement(NS_ConvertUTF16toUTF8(mProxy->KeySystem()));
-}
-
-nsCString
-EMEAudioDecoder::GetNodeId()
-{
-  return mProxy->GetNodeId();
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/dom/media/platforms/agnostic/eme/EMEAudioDecoder.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef EMEAudioDecoder_h_
-#define EMEAudioDecoder_h_
-
-#include "GMPAudioDecoder.h"
-#include "PlatformDecoderModule.h"
-
-namespace mozilla {
-
-class EMEAudioCallbackAdapter : public AudioCallbackAdapter {
-public:
-  explicit EMEAudioCallbackAdapter(MediaDataDecoderCallbackProxy* aCallback)
-   : AudioCallbackAdapter(aCallback)
-  {}
-
-  void Error(GMPErr aErr) override;
-};
-
-class EMEAudioDecoder : public GMPAudioDecoder {
-public:
-  EMEAudioDecoder(CDMProxy* aProxy, const GMPAudioDecoderParams& aParams);
-
-private:
-  void InitTags(nsTArray<nsCString>& aTags) override;
-  nsCString GetNodeId() override;
-
-  RefPtr<CDMProxy> mProxy;
-};
-
-} // namespace mozilla
-
-#endif
--- a/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
@@ -1,16 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "EMEDecoderModule.h"
-#include "EMEAudioDecoder.h"
 #include "EMEVideoDecoder.h"
 #include "MediaDataDecoderProxy.h"
 #include "mozIGeckoMediaPluginService.h"
 #include "mozilla/CDMProxy.h"
 #include "mozilla/Unused.h"
 #include "nsAutoPtr.h"
 #include "nsServiceManagerUtils.h"
 #include "MediaInfo.h"
@@ -259,26 +258,20 @@ EMEDecoderModule::CreateVideoDecoder(con
   return emeDecoder.forget();
 }
 
 already_AddRefed<MediaDataDecoder>
 EMEDecoderModule::CreateAudioDecoder(const CreateDecoderParams& aParams)
 {
   MOZ_ASSERT(aParams.mConfig.mCrypto.mValid);
 
-  if (SupportsMimeType(aParams.mConfig.mMimeType, nullptr)) {
-    // GMP decodes. Assume that means it can decrypt too.
-    RefPtr<MediaDataDecoderProxy> wrapper =
-      CreateDecoderWrapper(aParams.mCallback, mProxy, aParams.mTaskQueue);
-    auto gmpParams = GMPAudioDecoderParams(aParams).WithCallback(wrapper);
-    wrapper->SetProxyTarget(new EMEAudioDecoder(mProxy, gmpParams));
-    return wrapper.forget();
-  }
+  // We don't support using the GMP to decode audio.
+  MOZ_ASSERT(!SupportsMimeType(aParams.mConfig.mMimeType, nullptr));
+  MOZ_ASSERT(mPDM);
 
-  MOZ_ASSERT(mPDM);
   RefPtr<MediaDataDecoder> decoder(mPDM->CreateDecoder(aParams));
   if (!decoder) {
     return nullptr;
   }
 
   RefPtr<MediaDataDecoder> emeDecoder(new EMEDecryptor(decoder,
                                                        aParams.mCallback,
                                                        mProxy,
--- a/dom/media/platforms/agnostic/eme/moz.build
+++ b/dom/media/platforms/agnostic/eme/moz.build
@@ -1,23 +1,21 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 EXPORTS += [
-    'EMEAudioDecoder.h',
     'EMEDecoderModule.h',
     'EMEVideoDecoder.h',
     'SamplesWaitingForKey.h',
 ]
 
 UNIFIED_SOURCES += [
-    'EMEAudioDecoder.cpp',
     'EMEDecoderModule.cpp',
     'EMEVideoDecoder.cpp',
     'SamplesWaitingForKey.cpp',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
deleted file mode 100644
--- a/dom/media/platforms/agnostic/gmp/GMPAudioDecoder.cpp
+++ /dev/null
@@ -1,306 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "GMPAudioDecoder.h"
-#include "nsServiceManagerUtils.h"
-#include "MediaInfo.h"
-#include "GMPDecoderModule.h"
-#include "nsPrintfCString.h"
-
-namespace mozilla {
-
-#if defined(DEBUG)
-bool IsOnGMPThread()
-{
-  nsCOMPtr<mozIGeckoMediaPluginService> mps = do_GetService("@mozilla.org/gecko-media-plugin-service;1");
-  MOZ_ASSERT(mps);
-
-  nsCOMPtr<nsIThread> gmpThread;
-  nsresult rv = mps->GetThread(getter_AddRefs(gmpThread));
-  MOZ_ASSERT(NS_SUCCEEDED(rv) && gmpThread);
-  return NS_GetCurrentThread() == gmpThread;
-}
-#endif
-
-void
-AudioCallbackAdapter::Decoded(const nsTArray<int16_t>& aPCM, uint64_t aTimeStamp, uint32_t aChannels, uint32_t aRate)
-{
-  MOZ_ASSERT(IsOnGMPThread());
-
-  if (aRate == 0 || aChannels == 0) {
-    mCallback->Error(MediaResult(
-      NS_ERROR_DOM_MEDIA_FATAL_ERR,
-      RESULT_DETAIL(
-        "Invalid rate or num channels returned on GMP audio samples")));
-    return;
-  }
-
-  size_t numFrames = aPCM.Length() / aChannels;
-  MOZ_ASSERT((aPCM.Length() % aChannels) == 0);
-  AlignedAudioBuffer audioData(aPCM.Length());
-  if (!audioData) {
-    mCallback->Error(
-      MediaResult(NS_ERROR_OUT_OF_MEMORY,
-                  RESULT_DETAIL("Unable to allocate audio buffer")));
-    return;
-  }
-
-  for (size_t i = 0; i < aPCM.Length(); ++i) {
-    audioData[i] = AudioSampleToFloat(aPCM[i]);
-  }
-
-  if (mMustRecaptureAudioPosition) {
-    mAudioFrameSum = 0;
-    auto timestamp = UsecsToFrames(aTimeStamp, aRate);
-    if (!timestamp.isValid()) {
-      mCallback->Error(MediaResult(NS_ERROR_DOM_MEDIA_OVERFLOW_ERR,
-                                   RESULT_DETAIL("Invalid timestamp")));
-      return;
-    }
-    mAudioFrameOffset = timestamp.value();
-    mMustRecaptureAudioPosition = false;
-  }
-
-  auto timestamp = FramesToUsecs(mAudioFrameOffset + mAudioFrameSum, aRate);
-  if (!timestamp.isValid()) {
-    mCallback->Error(
-      MediaResult(NS_ERROR_DOM_MEDIA_OVERFLOW_ERR,
-                  RESULT_DETAIL("Invalid timestamp on audio samples")));
-    return;
-  }
-  mAudioFrameSum += numFrames;
-
-  auto duration = FramesToUsecs(numFrames, aRate);
-  if (!duration.isValid()) {
-    mCallback->Error(
-      MediaResult(NS_ERROR_DOM_MEDIA_OVERFLOW_ERR,
-                  RESULT_DETAIL("Invalid duration on audio samples")));
-    return;
-  }
-
-  RefPtr<AudioData> audio(new AudioData(mLastStreamOffset,
-                                        timestamp.value(),
-                                        duration.value(),
-                                        numFrames,
-                                        Move(audioData),
-                                        aChannels,
-                                        aRate));
-
-#ifdef LOG_SAMPLE_DECODE
-  LOG("Decoded audio sample! timestamp=%lld duration=%lld currentLength=%u",
-      timestamp, duration, currentLength);
-#endif
-
-  mCallback->Output(audio);
-}
-
-void
-AudioCallbackAdapter::InputDataExhausted()
-{
-  MOZ_ASSERT(IsOnGMPThread());
-  mCallback->InputExhausted();
-}
-
-void
-AudioCallbackAdapter::DrainComplete()
-{
-  MOZ_ASSERT(IsOnGMPThread());
-  mCallback->DrainComplete();
-}
-
-void
-AudioCallbackAdapter::ResetComplete()
-{
-  MOZ_ASSERT(IsOnGMPThread());
-  mMustRecaptureAudioPosition = true;
-  mCallback->FlushComplete();
-}
-
-void
-AudioCallbackAdapter::Error(GMPErr aErr)
-{
-  MOZ_ASSERT(IsOnGMPThread());
-  mCallback->Error(MediaResult(aErr == GMPDecodeErr
-                               ? NS_ERROR_DOM_MEDIA_DECODE_ERR
-                               : NS_ERROR_DOM_MEDIA_FATAL_ERR,
-                               RESULT_DETAIL("GMPErr:%x", aErr)));
-}
-
-void
-AudioCallbackAdapter::Terminated()
-{
-  mCallback->Error(MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR,
-                               RESULT_DETAIL("Audio GMP decoder terminated.")));
-}
-
-GMPAudioDecoderParams::GMPAudioDecoderParams(const CreateDecoderParams& aParams)
-  : mConfig(aParams.AudioConfig())
-  , mTaskQueue(aParams.mTaskQueue)
-  , mCallback(nullptr)
-  , mAdapter(nullptr)
-  , mCrashHelper(aParams.mCrashHelper)
-{}
-
-GMPAudioDecoderParams&
-GMPAudioDecoderParams::WithCallback(MediaDataDecoderProxy* aWrapper)
-{
-  MOZ_ASSERT(aWrapper);
-  MOZ_ASSERT(!mCallback); // Should only be called once per instance.
-  mCallback = aWrapper->Callback();
-  mAdapter = nullptr;
-  return *this;
-}
-
-GMPAudioDecoderParams&
-GMPAudioDecoderParams::WithAdapter(AudioCallbackAdapter* aAdapter)
-{
-  MOZ_ASSERT(aAdapter);
-  MOZ_ASSERT(!mAdapter); // Should only be called once per instance.
-  mCallback = aAdapter->Callback();
-  mAdapter = aAdapter;
-  return *this;
-}
-
-GMPAudioDecoder::GMPAudioDecoder(const GMPAudioDecoderParams& aParams)
-  : mConfig(aParams.mConfig)
-  , mCallback(aParams.mCallback)
-  , mGMP(nullptr)
-  , mAdapter(aParams.mAdapter)
-  , mCrashHelper(aParams.mCrashHelper)
-{
-  MOZ_ASSERT(!mAdapter || mCallback == mAdapter->Callback());
-  if (!mAdapter) {
-    mAdapter = new AudioCallbackAdapter(mCallback);
-  }
-}
-
-void
-GMPAudioDecoder::InitTags(nsTArray<nsCString>& aTags)
-{
-  aTags.AppendElement(NS_LITERAL_CSTRING("aac"));
-  const Maybe<nsCString> gmp(
-    GMPDecoderModule::PreferredGMP(NS_LITERAL_CSTRING("audio/mp4a-latm")));
-  if (gmp.isSome()) {
-    aTags.AppendElement(gmp.value());
-  }
-}
-
-nsCString
-GMPAudioDecoder::GetNodeId()
-{
-  return SHARED_GMP_DECODING_NODE_ID;
-}
-
-void
-GMPAudioDecoder::GMPInitDone(GMPAudioDecoderProxy* aGMP)
-{
-  MOZ_ASSERT(IsOnGMPThread());
-
-  if (!aGMP) {
-    mInitPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__);
-    return;
-  }
-  if (mInitPromise.IsEmpty()) {
-    // GMP must have been shutdown while we were waiting for Init operation
-    // to complete.
-    aGMP->Close();
-    return;
-  }
-  nsTArray<uint8_t> codecSpecific;
-  codecSpecific.AppendElements(mConfig.mCodecSpecificConfig->Elements(),
-                               mConfig.mCodecSpecificConfig->Length());
-
-  nsresult rv = aGMP->InitDecode(kGMPAudioCodecAAC,
-                                 mConfig.mChannels,
-                                 mConfig.mBitDepth,
-                                 mConfig.mRate,
-                                 codecSpecific,
-                                 mAdapter);
-  if (NS_FAILED(rv)) {
-    aGMP->Close();
-    mInitPromise.Reject(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__);
-    return;
-  }
-
-  mGMP = aGMP;
-  mInitPromise.Resolve(TrackInfo::kAudioTrack, __func__);
-}
-
-RefPtr<MediaDataDecoder::InitPromise>
-GMPAudioDecoder::Init()
-{
-  MOZ_ASSERT(IsOnGMPThread());
-
-  mMPS = do_GetService("@mozilla.org/gecko-media-plugin-service;1");
-  MOZ_ASSERT(mMPS);
-
-  RefPtr<InitPromise> promise(mInitPromise.Ensure(__func__));
-
-  nsTArray<nsCString> tags;
-  InitTags(tags);
-  UniquePtr<GetGMPAudioDecoderCallback> callback(new GMPInitDoneCallback(this));
-  if (NS_FAILED(mMPS->GetGMPAudioDecoder(mCrashHelper, &tags, GetNodeId(), Move(callback)))) {
-    mInitPromise.Reject(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__);
-  }
-
-  return promise;
-}
-
-void
-GMPAudioDecoder::Input(MediaRawData* aSample)
-{
-  MOZ_ASSERT(IsOnGMPThread());
-
-  RefPtr<MediaRawData> sample(aSample);
-  if (!mGMP) {
-    mCallback->Error(MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR,
-                                 RESULT_DETAIL("mGMP not initialized")));
-    return;
-  }
-
-  mAdapter->SetLastStreamOffset(sample->mOffset);
-
-  gmp::GMPAudioSamplesImpl samples(sample, mConfig.mChannels, mConfig.mRate);
-  nsresult rv = mGMP->Decode(samples);
-  if (NS_FAILED(rv)) {
-    mCallback->Error(MediaResult(rv, __func__));
-  }
-}
-
-void
-GMPAudioDecoder::Flush()
-{
-  MOZ_ASSERT(IsOnGMPThread());
-
-  if (!mGMP || NS_FAILED(mGMP->Reset())) {
-    // Abort the flush.
-    mCallback->FlushComplete();
-  }
-}
-
-void
-GMPAudioDecoder::Drain()
-{
-  MOZ_ASSERT(IsOnGMPThread());
-
-  if (!mGMP || NS_FAILED(mGMP->Drain())) {
-    mCallback->DrainComplete();
-  }
-}
-
-void
-GMPAudioDecoder::Shutdown()
-{
-  mInitPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
-  if (!mGMP) {
-    return;
-  }
-  // Note this unblocks flush and drain operations waiting for callbacks.
-  mGMP->Close();
-  mGMP = nullptr;
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/dom/media/platforms/agnostic/gmp/GMPAudioDecoder.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#if !defined(GMPAudioDecoder_h_)
-#define GMPAudioDecoder_h_
-
-#include "GMPAudioDecoderProxy.h"
-#include "MediaDataDecoderProxy.h"
-#include "PlatformDecoderModule.h"
-#include "mozIGeckoMediaPluginService.h"
-#include "nsAutoPtr.h"
-
-namespace mozilla {
-
-class AudioCallbackAdapter : public GMPAudioDecoderCallbackProxy {
-public:
-  explicit AudioCallbackAdapter(MediaDataDecoderCallbackProxy* aCallback)
-   : mCallback(aCallback)
-   , mLastStreamOffset(0)
-   , mAudioFrameSum(0)
-   , mAudioFrameOffset(0)
-   , mMustRecaptureAudioPosition(true)
-  {}
-
-  MediaDataDecoderCallbackProxy* Callback() const { return mCallback; }
-
-  // GMPAudioDecoderCallbackProxy
-  void Decoded(const nsTArray<int16_t>& aPCM, uint64_t aTimeStamp, uint32_t aChannels, uint32_t aRate) override;
-  void InputDataExhausted() override;
-  void DrainComplete() override;
-  void ResetComplete() override;
-  void Error(GMPErr aErr) override;
-  void Terminated() override;
-
-  void SetLastStreamOffset(int64_t aStreamOffset) {
-    mLastStreamOffset = aStreamOffset;
-  }
-
-private:
-  MediaDataDecoderCallbackProxy* mCallback;
-  int64_t mLastStreamOffset;
-
-  int64_t mAudioFrameSum;
-  int64_t mAudioFrameOffset;
-  bool mMustRecaptureAudioPosition;
-};
-
-struct GMPAudioDecoderParams {
-  explicit GMPAudioDecoderParams(const CreateDecoderParams& aParams);
-  GMPAudioDecoderParams& WithCallback(MediaDataDecoderProxy* aWrapper);
-  GMPAudioDecoderParams& WithAdapter(AudioCallbackAdapter* aAdapter);
-
-  const AudioInfo& mConfig;
-  TaskQueue* mTaskQueue;
-  MediaDataDecoderCallbackProxy* mCallback;
-  AudioCallbackAdapter* mAdapter;
-  RefPtr<GMPCrashHelper> mCrashHelper;
-};
-
-class GMPAudioDecoder : public MediaDataDecoder {
-public:
-  explicit GMPAudioDecoder(const GMPAudioDecoderParams& aParams);
-
-  RefPtr<InitPromise> Init() override;
-  void Input(MediaRawData* aSample) override;
-  void Flush() override;
-  void Drain() override;
-  void Shutdown() override;
-  const char* GetDescriptionName() const override
-  {
-    return "GMP audio decoder";
-  }
-
-protected:
-  virtual void InitTags(nsTArray<nsCString>& aTags);
-  virtual nsCString GetNodeId();
-
-private:
-
-  class GMPInitDoneCallback : public GetGMPAudioDecoderCallback
-  {
-  public:
-    explicit GMPInitDoneCallback(GMPAudioDecoder* aDecoder)
-      : mDecoder(aDecoder)
-    {
-    }
-
-    void Done(GMPAudioDecoderProxy* aGMP) override
-    {
-      mDecoder->GMPInitDone(aGMP);
-    }
-
-  private:
-    RefPtr<GMPAudioDecoder> mDecoder;
-  };
-  void GMPInitDone(GMPAudioDecoderProxy* aGMP);
-
-  const AudioInfo mConfig;
-  MediaDataDecoderCallbackProxy* mCallback;
-  nsCOMPtr<mozIGeckoMediaPluginService> mMPS;
-  GMPAudioDecoderProxy* mGMP;
-  nsAutoPtr<AudioCallbackAdapter> mAdapter;
-  MozPromiseHolder<InitPromise> mInitPromise;
-  RefPtr<GMPCrashHelper> mCrashHelper;
-};
-
-} // namespace mozilla
-
-#endif // GMPAudioDecoder_h_
--- a/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "GMPDecoderModule.h"
 #include "DecoderDoctorDiagnostics.h"
-#include "GMPAudioDecoder.h"
 #include "GMPVideoDecoder.h"
 #include "GMPUtils.h"
 #include "MediaDataDecoderProxy.h"
 #include "MediaPrefs.h"
 #include "VideoUtils.h"
 #include "mozIGeckoMediaPluginService.h"
 #include "nsServiceManagerUtils.h"
 #include "mozilla/StaticMutex.h"
@@ -52,83 +51,40 @@ already_AddRefed<MediaDataDecoder>
 GMPDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams)
 {
   if (!MP4Decoder::IsH264(aParams.mConfig.mMimeType) &&
       !VPXDecoder::IsVP8(aParams.mConfig.mMimeType) &&
       !VPXDecoder::IsVP9(aParams.mConfig.mMimeType)) {
     return nullptr;
   }
 
-  if (aParams.mDiagnostics) {
-    const Maybe<nsCString> preferredGMP = PreferredGMP(aParams.mConfig.mMimeType);
-    if (preferredGMP.isSome()) {
-      aParams.mDiagnostics->SetGMP(preferredGMP.value());
-    }
-  }
-
   RefPtr<MediaDataDecoderProxy> wrapper = CreateDecoderWrapper(aParams.mCallback);
   auto params = GMPVideoDecoderParams(aParams).WithCallback(wrapper);
   wrapper->SetProxyTarget(new GMPVideoDecoder(params));
   return wrapper.forget();
 }
 
 already_AddRefed<MediaDataDecoder>
 GMPDecoderModule::CreateAudioDecoder(const CreateDecoderParams& aParams)
 {
-  if (!aParams.mConfig.mMimeType.EqualsLiteral("audio/mp4a-latm")) {
-    return nullptr;
-  }
-
-  if (aParams.mDiagnostics) {
-    const Maybe<nsCString> preferredGMP = PreferredGMP(aParams.mConfig.mMimeType);
-    if (preferredGMP.isSome()) {
-      aParams.mDiagnostics->SetGMP(preferredGMP.value());
-    }
-  }
-
-  RefPtr<MediaDataDecoderProxy> wrapper = CreateDecoderWrapper(aParams.mCallback);
-  auto params = GMPAudioDecoderParams(aParams).WithCallback(wrapper);
-  wrapper->SetProxyTarget(new GMPAudioDecoder(params));
-  return wrapper.forget();
+  return nullptr;
 }
 
 PlatformDecoderModule::ConversionRequired
 GMPDecoderModule::DecoderNeedsConversion(const TrackInfo& aConfig) const
 {
   // GMPVideoCodecType::kGMPVideoCodecH264 specifies that encoded frames must be in AVCC format.
   if (aConfig.IsVideo() && MP4Decoder::IsH264(aConfig.mMimeType)) {
     return ConversionRequired::kNeedAVCC;
   } else {
     return ConversionRequired::kNeedNone;
   }
 }
 
 /* static */
-const Maybe<nsCString>
-GMPDecoderModule::PreferredGMP(const nsACString& aMimeType)
-{
-  Maybe<nsCString> rv;
-  if (aMimeType.EqualsLiteral("audio/mp4a-latm")) {
-    switch (MediaPrefs::GMPAACPreferred()) {
-      case 1: rv.emplace(kEMEKeySystemClearkey); break;
-      default: break;
-    }
-  }
-
-  if (MP4Decoder::IsH264(aMimeType)) {
-    switch (MediaPrefs::GMPH264Preferred()) {
-      case 1: rv.emplace(kEMEKeySystemClearkey); break;
-      default: break;
-    }
-  }
-
-  return rv;
-}
-
-/* static */
 bool
 GMPDecoderModule::SupportsMimeType(const nsACString& aMimeType,
                                    const Maybe<nsCString>& aGMP)
 {
   if (aGMP.isNothing()) {
     return false;
   }
 
@@ -154,17 +110,12 @@ GMPDecoderModule::SupportsMimeType(const
 
   return false;
 }
 
 bool
 GMPDecoderModule::SupportsMimeType(const nsACString& aMimeType,
                                    DecoderDoctorDiagnostics* aDiagnostics) const
 {
-  const Maybe<nsCString> preferredGMP = PreferredGMP(aMimeType);
-  bool rv = SupportsMimeType(aMimeType, preferredGMP);
-  if (rv && aDiagnostics && preferredGMP.isSome()) {
-    aDiagnostics->SetGMP(preferredGMP.value());
-  }
-  return rv;
+  return false;
 }
 
 } // namespace mozilla
--- a/dom/media/platforms/agnostic/gmp/GMPDecoderModule.h
+++ b/dom/media/platforms/agnostic/gmp/GMPDecoderModule.h
@@ -41,17 +41,15 @@ public:
 
   ConversionRequired
   DecoderNeedsConversion(const TrackInfo& aConfig) const override;
 
   bool
   SupportsMimeType(const nsACString& aMimeType,
                    DecoderDoctorDiagnostics* aDiagnostics) const override;
 
-  static const Maybe<nsCString> PreferredGMP(const nsACString& aMimeType);
-
   static bool SupportsMimeType(const nsACString& aMimeType,
                                const Maybe<nsCString>& aGMP);
 };
 
 } // namespace mozilla
 
 #endif // GMPDecoderModule_h_
--- a/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp
+++ b/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp
@@ -10,17 +10,26 @@
 #include "prsystem.h"
 #include "MediaData.h"
 #include "GMPDecoderModule.h"
 #include "VPXDecoder.h"
 
 namespace mozilla {
 
 #if defined(DEBUG)
-extern bool IsOnGMPThread();
+static bool IsOnGMPThread()
+{
+  nsCOMPtr<mozIGeckoMediaPluginService> mps = do_GetService("@mozilla.org/gecko-media-plugin-service;1");
+  MOZ_ASSERT(mps);
+
+  nsCOMPtr<nsIThread> gmpThread;
+  nsresult rv = mps->GetThread(getter_AddRefs(gmpThread));
+  MOZ_ASSERT(NS_SUCCEEDED(rv) && gmpThread);
+  return NS_GetCurrentThread() == gmpThread;
+}
 #endif
 
 void
 VideoCallbackAdapter::Decoded(GMPVideoi420Frame* aDecodedFrame)
 {
   GMPUniquePtr<GMPVideoi420Frame> decodedFrame(aDecodedFrame);
 
   MOZ_ASSERT(IsOnGMPThread());
@@ -157,21 +166,16 @@ GMPVideoDecoder::GMPVideoDecoder(const G
   }
 }
 
 void
 GMPVideoDecoder::InitTags(nsTArray<nsCString>& aTags)
 {
   if (MP4Decoder::IsH264(mConfig.mMimeType)) {
     aTags.AppendElement(NS_LITERAL_CSTRING("h264"));
-    const Maybe<nsCString> gmp(
-      GMPDecoderModule::PreferredGMP(NS_LITERAL_CSTRING("video/avc")));
-    if (gmp.isSome()) {
-      aTags.AppendElement(gmp.value());
-    }
   } else if (VPXDecoder::IsVP8(mConfig.mMimeType)) {
     aTags.AppendElement(NS_LITERAL_CSTRING("vp8"));
   } else if (VPXDecoder::IsVP9(mConfig.mMimeType)) {
     aTags.AppendElement(NS_LITERAL_CSTRING("vp9"));
   }
 }
 
 nsCString
--- a/dom/media/platforms/agnostic/gmp/moz.build
+++ b/dom/media/platforms/agnostic/gmp/moz.build
@@ -1,23 +1,21 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 EXPORTS += [
-    'GMPAudioDecoder.h',
     'GMPDecoderModule.h',
     'GMPVideoDecoder.h',
     'MediaDataDecoderProxy.h',
 ]
 
 UNIFIED_SOURCES += [
-    'GMPAudioDecoder.cpp',
     'GMPDecoderModule.cpp',
     'GMPVideoDecoder.cpp',
     'MediaDataDecoderProxy.cpp',
 ]
 
 # GMPVideoEncodedFrameImpl.h needs IPC
 include('/ipc/chromium/chromium-config.mozbuild')