Bug 1319197 - Remove audio decoding from gmp-clearkey. r=cpearce
authorJay Harris <jharris@mozilla.com>
Tue, 22 Nov 2016 14:32:26 +1300
changeset 324137 ee43b0af2a45d0bd9096f06e4aa5ea5c792c2ddc
parent 324136 061d9d4d64ca7c21431c879ad0332aa5544cfe1c
child 324138 b323faf96458c2fc32e6f60f5b49eca69727b8ea
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewerscpearce
bugs1319197
milestone53.0a1
Bug 1319197 - Remove audio decoding from gmp-clearkey. r=cpearce MozReview-Commit-ID: EA0AAoDjWUh
dom/media/gmp/GMPParent.cpp
media/gmp-clearkey/0.1/AudioDecoder.cpp
media/gmp-clearkey/0.1/AudioDecoder.h
media/gmp-clearkey/0.1/WMFAACDecoder.cpp
media/gmp-clearkey/0.1/WMFAACDecoder.h
media/gmp-clearkey/0.1/WMFH264Decoder.cpp
media/gmp-clearkey/0.1/WMFUtils.cpp
media/gmp-clearkey/0.1/WMFUtils.h
media/gmp-clearkey/0.1/clearkey.info.in
media/gmp-clearkey/0.1/gmp-clearkey.cpp
media/gmp-clearkey/0.1/moz.build
--- a/dom/media/gmp/GMPParent.cpp
+++ b/dom/media/gmp/GMPParent.cpp
@@ -595,20 +595,16 @@ GMPCapability::Supports(const nsTArray<G
         // file, but uses Windows Media Foundation to decode. That's not present
         // on Windows XP, and on some Vista, Windows N, and KN variants without
         // certain services packs.
         if (tag.Equals(kEMEKeySystemClearkey)) {
           if (capabilities.mAPIName.EqualsLiteral(GMP_API_VIDEO_DECODER)) {
             if (!WMFDecoderModule::HasH264()) {
               continue;
             }
-          } else if (capabilities.mAPIName.EqualsLiteral(GMP_API_AUDIO_DECODER)) {
-            if (!WMFDecoderModule::HasAAC()) {
-              continue;
-            }
           }
         }
 #endif
         return true;
       }
     }
   }
   return false;
deleted file mode 100644
--- a/media/gmp-clearkey/0.1/AudioDecoder.cpp
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * Copyright 2015, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <cstdint>
-#include <limits>
-
-#include "AudioDecoder.h"
-#include "ClearKeyDecryptionManager.h"
-#include "ClearKeyUtils.h"
-#include "gmp-task-utils.h"
-
-using namespace wmf;
-
-AudioDecoder::AudioDecoder(GMPAudioHost *aHostAPI)
-  : mHostAPI(aHostAPI)
-  , mCallback(nullptr)
-  , mWorkerThread(nullptr)
-  , mMutex(nullptr)
-  , mNumInputTasks(0)
-  , mHasShutdown(false)
-{
-  // We drop the ref in DecodingComplete().
-  AddRef();
-}
-
-AudioDecoder::~AudioDecoder()
-{
-  if (mMutex) {
-    mMutex->Destroy();
-  }
-}
-
-void
-AudioDecoder::InitDecode(const GMPAudioCodec& aConfig,
-                         GMPAudioDecoderCallback* aCallback)
-{
-  mCallback = aCallback;
-  assert(mCallback);
-  mDecoder = new WMFAACDecoder();
-  HRESULT hr = mDecoder->Init(aConfig.mChannelCount,
-                              aConfig.mSamplesPerSecond,
-                              (BYTE*)aConfig.mExtraData,
-                              aConfig.mExtraDataLen);
-  LOG("[%p] AudioDecoder::InitializeAudioDecoder() hr=0x%x\n", this, hr);
-  if (FAILED(hr)) {
-    mCallback->Error(GMPGenericErr);
-    return;
-  }
-  auto err = GetPlatform()->createmutex(&mMutex);
-  if (GMP_FAILED(err)) {
-    mCallback->Error(GMPGenericErr);
-    return;
-  }
-}
-
-void
-AudioDecoder::EnsureWorker()
-{
-  if (!mWorkerThread) {
-    GetPlatform()->createthread(&mWorkerThread);
-    if (!mWorkerThread) {
-      mCallback->Error(GMPAllocErr);
-      return;
-    }
-  }
-}
-
-void
-AudioDecoder::Decode(GMPAudioSamples* aInput)
-{
-  EnsureWorker();
-  {
-    AutoLock lock(mMutex);
-    mNumInputTasks++;
-  }
-  mWorkerThread->Post(WrapTaskRefCounted(this,
-                                         &AudioDecoder::DecodeTask,
-                                         aInput));
-}
-
-void
-AudioDecoder::DecodeTask(GMPAudioSamples* aInput)
-{
-  HRESULT hr;
-
-  {
-    AutoLock lock(mMutex);
-    mNumInputTasks--;
-    assert(mNumInputTasks >= 0);
-  }
-
-  if (!aInput || !mHostAPI || !mDecoder) {
-    LOG("Decode job not set up correctly!");
-    return;
-  }
-
-  const uint8_t* inBuffer = aInput->Buffer();
-  if (!inBuffer) {
-    LOG("No buffer for encoded samples!\n");
-    return;
-  }
-
-  const GMPEncryptedBufferMetadata* crypto = aInput->GetDecryptionData();
-  std::vector<uint8_t> buffer(inBuffer, inBuffer + aInput->Size());
-  if (crypto) {
-    // Plugin host should have set up its decryptor/key sessions
-    // before trying to decode!
-    GMPErr rv =
-      ClearKeyDecryptionManager::Get()->Decrypt(buffer, CryptoMetaData(crypto));
-
-    if (GMP_FAILED(rv)) {
-      CK_LOGE("Failed to decrypt with key id %08x...", *(uint32_t*)crypto->KeyId());
-      MaybeRunOnMainThread(WrapTask(mCallback, &GMPAudioDecoderCallback::Error, rv));
-      return;
-    }
-  }
-
-  hr = mDecoder->Input(&buffer[0],
-                       buffer.size(),
-                       aInput->TimeStamp());
-
-  // We must delete the input sample!
-  GetPlatform()->runonmainthread(WrapTask(aInput, &GMPAudioSamples::Destroy));
-
-  SAMPLE_LOG("AudioDecoder::DecodeTask() Input ret hr=0x%x\n", hr);
-  if (FAILED(hr)) {
-    LOG("AudioDecoder::DecodeTask() decode failed ret=0x%x%s\n",
-        hr,
-        ((hr == MF_E_NOTACCEPTING) ? " (MF_E_NOTACCEPTING)" : ""));
-    return;
-  }
-
-  while (hr == S_OK) {
-    CComPtr<IMFSample> output;
-    hr = mDecoder->Output(&output);
-    SAMPLE_LOG("AudioDecoder::DecodeTask() output ret=0x%x\n", hr);
-    if (hr == S_OK) {
-      ReturnOutput(output);
-    }
-    if (hr == MF_E_TRANSFORM_NEED_MORE_INPUT) {
-      AutoLock lock(mMutex);
-      if (mNumInputTasks == 0) {
-        // We have run all input tasks. We *must* notify Gecko so that it will
-        // send us more data.
-        MaybeRunOnMainThread(WrapTask(mCallback, &GMPAudioDecoderCallback::InputDataExhausted));
-      }
-    } else if (FAILED(hr)) {
-      LOG("AudioDecoder::DecodeTask() output failed hr=0x%x\n", hr);
-    }
-  }
-}
-
-void
-AudioDecoder::ReturnOutput(IMFSample* aSample)
-{
-  SAMPLE_LOG("[%p] AudioDecoder::ReturnOutput()\n", this);
-  assert(aSample);
-
-  HRESULT hr;
-
-  GMPAudioSamples* samples = nullptr;
-  mHostAPI->CreateSamples(kGMPAudioIS16Samples, &samples);
-  if (!samples) {
-    LOG("Failed to create i420 frame!\n");
-    return;
-  }
-
-  hr = MFToGMPSample(aSample, samples);
-  if (FAILED(hr)) {
-    samples->Destroy();
-    LOG("Failed to prepare output sample!");
-    return;
-  }
-  ENSURE(SUCCEEDED(hr), /*void*/);
-
-  MaybeRunOnMainThread(WrapTask(mCallback, &GMPAudioDecoderCallback::Decoded, samples));
-}
-
-HRESULT
-AudioDecoder::MFToGMPSample(IMFSample* aInput,
-                            GMPAudioSamples* aOutput)
-{
-  ENSURE(aInput != nullptr, E_POINTER);
-  ENSURE(aOutput != nullptr, E_POINTER);
-
-  HRESULT hr;
-  CComPtr<IMFMediaBuffer> mediaBuffer;
-
-  hr = aInput->ConvertToContiguousBuffer(&mediaBuffer);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  BYTE* data = nullptr; // Note: *data will be owned by the IMFMediaBuffer, we don't need to free it.
-  DWORD maxLength = 0, currentLength = 0;
-  hr = mediaBuffer->Lock(&data, &maxLength, &currentLength);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  auto err = aOutput->SetBufferSize(currentLength);
-  ENSURE(GMP_SUCCEEDED(err), E_FAIL);
-
-  memcpy(aOutput->Buffer(), data, currentLength);
-
-  mediaBuffer->Unlock();
-
-  LONGLONG hns = 0;
-  hr = aInput->GetSampleTime(&hns);
-  ENSURE(SUCCEEDED(hr), hr);
-  aOutput->SetTimeStamp(HNsToUsecs(hns));
-  aOutput->SetChannels(mDecoder->Channels());
-  aOutput->SetRate(mDecoder->Rate());
-
-  return S_OK;
-}
-
-void
-AudioDecoder::Reset()
-{
-  if (mDecoder) {
-    mDecoder->Reset();
-  }
-  if (mCallback) {
-    mCallback->ResetComplete();
-  }
-}
-
-void
-AudioDecoder::DrainTask()
-{
-  mDecoder->Drain();
-
-  // Return any pending output.
-  HRESULT hr = S_OK;
-  while (hr == S_OK) {
-    CComPtr<IMFSample> output;
-    hr = mDecoder->Output(&output);
-    SAMPLE_LOG("AudioDecoder::DrainTask() output ret=0x%x\n", hr);
-    if (hr == S_OK) {
-      ReturnOutput(output);
-    }
-  }
-  MaybeRunOnMainThread(WrapTask(mCallback, &GMPAudioDecoderCallback::DrainComplete));
-}
-
-void
-AudioDecoder::Drain()
-{
-  if (!mDecoder) {
-    return;
-  }
-  EnsureWorker();
-  mWorkerThread->Post(WrapTaskRefCounted(this,
-                                         &AudioDecoder::DrainTask));
-}
-
-void
-AudioDecoder::DecodingComplete()
-{
-  if (mWorkerThread) {
-    mWorkerThread->Join();
-  }
-  mHasShutdown = true;
-
-  // Release the reference we added in the constructor. There may be
-  // WrapRefCounted tasks that also hold references to us, and keep
-  // us alive a little longer.
-  Release();
-}
-
-void
-AudioDecoder::MaybeRunOnMainThread(GMPTask* aTask)
-{
-  class MaybeRunTask : public GMPTask
-  {
-  public:
-    MaybeRunTask(AudioDecoder* aDecoder, GMPTask* aTask)
-      : mDecoder(aDecoder), mTask(aTask)
-    { }
-
-    virtual void Run(void) {
-      if (mDecoder->HasShutdown()) {
-        CK_LOGD("Trying to dispatch to main thread after AudioDecoder has shut down");
-        return;
-      }
-
-      mTask->Run();
-    }
-
-    virtual void Destroy()
-    {
-      mTask->Destroy();
-      delete this;
-    }
-
-  private:
-    RefPtr<AudioDecoder> mDecoder;
-    GMPTask* mTask;
-  };
-
-  GetPlatform()->runonmainthread(new MaybeRunTask(this, aTask));
-}
deleted file mode 100644
--- a/media/gmp-clearkey/0.1/AudioDecoder.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2015, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __AudioDecoder_h__
-#define __AudioDecoder_h__
-
-#include "gmp-audio-decode.h"
-#include "gmp-audio-host.h"
-#include "gmp-task-utils.h"
-#include "WMFAACDecoder.h"
-#include "RefCounted.h"
-
-#include "mfobjects.h"
-
-class AudioDecoder : public GMPAudioDecoder
-                   , public RefCounted
-{
-public:
-  AudioDecoder(GMPAudioHost *aHostAPI);
-
-  virtual void InitDecode(const GMPAudioCodec& aCodecSettings,
-                          GMPAudioDecoderCallback* aCallback) override;
-
-  virtual void Decode(GMPAudioSamples* aEncodedSamples);
-
-  virtual void Reset() override;
-
-  virtual void Drain() override;
-
-  virtual void DecodingComplete() override;
-
-  bool HasShutdown() { return mHasShutdown; }
-
-private:
-  virtual ~AudioDecoder();
-
-  void EnsureWorker();
-
-  void DecodeTask(GMPAudioSamples* aEncodedSamples);
-  void DrainTask();
-
-  void ReturnOutput(IMFSample* aSample);
-
-  HRESULT MFToGMPSample(IMFSample* aSample,
-                        GMPAudioSamples* aAudioFrame);
-
-  void MaybeRunOnMainThread(GMPTask* aTask);
-
-  GMPAudioHost *mHostAPI; // host-owned, invalid at DecodingComplete
-  GMPAudioDecoderCallback* mCallback; // host-owned, invalid at DecodingComplete
-  GMPThread* mWorkerThread;
-  GMPMutex* mMutex;
-  wmf::AutoPtr<wmf::WMFAACDecoder> mDecoder;
-
-  int32_t mNumInputTasks;
-
-  bool mHasShutdown;
-};
-
-#endif // __AudioDecoder_h__
deleted file mode 100644
--- a/media/gmp-clearkey/0.1/WMFAACDecoder.cpp
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * Copyright 2013, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "WMFAACDecoder.h"
-#include <algorithm>
-#include <stdint.h>
-#include <vector>
-
-using std::vector;
-
-namespace wmf {
-
-WMFAACDecoder::WMFAACDecoder()
-  : mDecoder(nullptr)
-  , mChannels(0)
-  , mRate(0)
-{
-  memset(&mInputStreamInfo, 0, sizeof(MFT_INPUT_STREAM_INFO));
-  memset(&mOutputStreamInfo, 0, sizeof(MFT_OUTPUT_STREAM_INFO));
-}
-
-WMFAACDecoder::~WMFAACDecoder()
-{
-  Reset();
-}
-
-HRESULT
-AACAudioSpecificConfigToUserData(BYTE* aAudioSpecConfig, UINT32 aConfigLength,
-                                 BYTE** aOutUserData, UINT32* aOutUserDataLength)
-{
-  // For MFAudioFormat_AAC, MF_MT_USER_DATA
-  // Contains the portion of the HEAACWAVEINFO structure that appears
-  // after the WAVEFORMATEX structure (that is, after the wfx member).
-  // This is followed by the AudioSpecificConfig() data, as defined
-  // by ISO/IEC 14496-3.
-  // ...
-  // The length of the AudioSpecificConfig() data is 2 bytes for AAC-LC
-  // or HE-AAC with implicit signaling of SBR/PS. It is more than 2 bytes
-  // for HE-AAC with explicit signaling of SBR/PS.
-  //
-  // The value of audioObjectType as defined in AudioSpecificConfig()
-  // must be 2, indicating AAC-LC. The value of extensionAudioObjectType
-  // must be 5 for SBR or 29 for PS.
-  //
-  // See:
-  // http://msdn.microsoft.com/en-us/library/windows/desktop/dd742784%28v=vs.85%29.aspx
-  //
-  // HEAACWAVEINFO structure:
-  //    typedef struct heaacwaveinfo_tag {
-  //      WAVEFORMATEX wfx;
-  //      WORD         wPayloadType;
-  //      WORD         wAudioProfileLevelIndication;
-  //      WORD         wStructType;
-  //      WORD         wReserved1;
-  //      DWORD        dwReserved2;
-  //    }
-  const UINT32 heeInfoLen = 4 * sizeof(WORD) + sizeof(DWORD);
-  BYTE heeInfo[heeInfoLen] = {0};
-  WORD* w = (WORD*)heeInfo;
-  w[0] = 0x0; // Payload type raw AAC
-  w[1] = 0; // Profile level unspecified
-
-  const UINT32 len =  heeInfoLen + aConfigLength;
-  BYTE* data = new BYTE[len];
-  memcpy(data, heeInfo, heeInfoLen);
-  memcpy(data+heeInfoLen, aAudioSpecConfig, aConfigLength);
-  *aOutUserData = data;
-  *aOutUserDataLength = len;
-  return S_OK;
-}
-
-HRESULT
-WMFAACDecoder::Init(int32_t aChannelCount,
-                    int32_t aSampleRate,
-                    BYTE* aAACAudioSpecificConfig,
-                    UINT32 aAudioConfigLength)
-{
-  HRESULT hr;
-
-  // AAC decoder is in msauddecmft on Win8, and msmpeg2adec in earlier versions.
-  hr = CreateMFT(CLSID_CMSAACDecMFT,
-                 WMFDecoderDllNameFor(AAC),
-                 mDecoder);
-  if (FAILED(hr)) {
-    hr = CreateMFT(CLSID_CMSAACDecMFT,
-                   WMFDecoderDllNameFor(AAC),
-                   mDecoder);
-    if (FAILED(hr)) {
-      LOG("Failed to create AAC decoder\n");
-      return E_FAIL;
-    }
-  }
-
-  BYTE* userData = nullptr;
-  UINT32 userDataLength;
-  hr = AACAudioSpecificConfigToUserData(aAACAudioSpecificConfig,
-                                        aAudioConfigLength,
-                                        &userData,
-                                        &userDataLength);
-  ENSURE(SUCCEEDED(hr), hr);
-  hr = SetDecoderInputType(aChannelCount, aSampleRate, userData, userDataLength);
-  delete userData;
-  ENSURE(SUCCEEDED(hr), hr);
-
-  hr = SetDecoderOutputType();
-  ENSURE(SUCCEEDED(hr), hr);
-
-  hr = SendMFTMessage(MFT_MESSAGE_NOTIFY_BEGIN_STREAMING, 0);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  hr = SendMFTMessage(MFT_MESSAGE_NOTIFY_START_OF_STREAM, 0);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  hr = mDecoder->GetInputStreamInfo(0, &mInputStreamInfo);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  hr = mDecoder->GetOutputStreamInfo(0, &mOutputStreamInfo);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  return S_OK;
-}
-
-HRESULT
-WMFAACDecoder::SetDecoderInputType(int32_t aChannelCount,
-                                   int32_t aSampleRate,
-                                   BYTE* aUserData,
-                                   UINT32 aUserDataLength)
-{
-  HRESULT hr;
-
-  CComPtr<IMFMediaType> type;
-  hr = MFCreateMediaType(&type);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  hr = type->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  hr = type->SetGUID(MF_MT_SUBTYPE, MFAudioFormat_AAC);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  mRate = aSampleRate;
-  hr = type->SetUINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND, mRate);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  mChannels = aChannelCount;
-  hr = type->SetUINT32(MF_MT_AUDIO_NUM_CHANNELS, mChannels);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  hr = type->SetBlob(MF_MT_USER_DATA, aUserData, aUserDataLength);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  hr = mDecoder->SetInputType(0, type, 0);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  return S_OK;
-}
-
-HRESULT
-WMFAACDecoder::SetDecoderOutputType()
-{
-  HRESULT hr;
-
-  CComPtr<IMFMediaType> type;
-
-  UINT32 typeIndex = 0;
-  while (type = nullptr, SUCCEEDED(mDecoder->GetOutputAvailableType(0, typeIndex++, &type))) {
-    GUID subtype;
-    hr = type->GetGUID(MF_MT_SUBTYPE, &subtype);
-    if (FAILED(hr)) {
-      continue;
-    }
-    if (subtype == MFAudioFormat_PCM) {
-      hr = mDecoder->SetOutputType(0, type, 0);
-      ENSURE(SUCCEEDED(hr), hr);
-
-      hr = type->GetUINT32(MF_MT_AUDIO_NUM_CHANNELS, &mChannels);
-      ENSURE(SUCCEEDED(hr), hr);
-
-      hr = type->GetUINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND, &mRate);
-      ENSURE(SUCCEEDED(hr), hr);
-
-      return S_OK;
-    }
-  }
-
-  return E_FAIL;
-}
-
-HRESULT
-WMFAACDecoder::SendMFTMessage(MFT_MESSAGE_TYPE aMsg, UINT32 aData)
-{
-  ENSURE(mDecoder != nullptr, E_POINTER);
-  HRESULT hr = mDecoder->ProcessMessage(aMsg, aData);
-  ENSURE(SUCCEEDED(hr), hr);
-  return S_OK;
-}
-
-HRESULT
-WMFAACDecoder::CreateInputSample(const uint8_t* aData,
-                                 uint32_t aDataSize,
-                                 Microseconds aTimestamp,
-                                 IMFSample** aOutSample)
-{
-  HRESULT hr;
-  CComPtr<IMFSample> sample = nullptr;
-  hr = MFCreateSample(&sample);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  CComPtr<IMFMediaBuffer> buffer = nullptr;
-  int32_t bufferSize = std::max<uint32_t>(uint32_t(mInputStreamInfo.cbSize), aDataSize);
-  UINT32 alignment = (mInputStreamInfo.cbAlignment > 1) ? mInputStreamInfo.cbAlignment - 1 : 0;
-  hr = MFCreateAlignedMemoryBuffer(bufferSize, alignment, &buffer);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  DWORD maxLength = 0;
-  DWORD currentLength = 0;
-  BYTE* dst = nullptr;
-  hr = buffer->Lock(&dst, &maxLength, &currentLength);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  // Copy data into sample's buffer.
-  memcpy(dst, aData, aDataSize);
-
-  hr = buffer->Unlock();
-  ENSURE(SUCCEEDED(hr), hr);
-
-  hr = buffer->SetCurrentLength(aDataSize);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  hr = sample->AddBuffer(buffer);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  hr = sample->SetSampleTime(UsecsToHNs(aTimestamp));
-  ENSURE(SUCCEEDED(hr), hr);
-
-  *aOutSample = sample.Detach();
-
-  return S_OK;
-}
-
-HRESULT
-WMFAACDecoder::CreateOutputSample(IMFSample** aOutSample)
-{
-  HRESULT hr;
-  CComPtr<IMFSample> sample = nullptr;
-  hr = MFCreateSample(&sample);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  CComPtr<IMFMediaBuffer> buffer = nullptr;
-  int32_t bufferSize = mOutputStreamInfo.cbSize;
-  UINT32 alignment = (mOutputStreamInfo.cbAlignment > 1) ? mOutputStreamInfo.cbAlignment - 1 : 0;
-  hr = MFCreateAlignedMemoryBuffer(bufferSize, alignment, &buffer);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  hr = sample->AddBuffer(buffer);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  *aOutSample = sample.Detach();
-
-  return S_OK;
-}
-
-
-HRESULT
-WMFAACDecoder::GetOutputSample(IMFSample** aOutSample)
-{
-  HRESULT hr;
-  // We allocate samples for MFT output.
-  MFT_OUTPUT_DATA_BUFFER output = {0};
-
-  CComPtr<IMFSample> sample = nullptr;
-  hr = CreateOutputSample(&sample);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  output.pSample = sample;
-
-  DWORD status = 0;
-  hr = mDecoder->ProcessOutput(0, 1, &output, &status);
-  CComPtr<IMFCollection> events = output.pEvents; // Ensure this is released.
-
-  if (hr == MF_E_TRANSFORM_STREAM_CHANGE) {
-    // Type change. Probably geometric apperature change.
-    hr = SetDecoderOutputType();
-    ENSURE(SUCCEEDED(hr), hr);
-
-    return GetOutputSample(aOutSample);
-  } else if (hr == MF_E_TRANSFORM_NEED_MORE_INPUT || !sample) {
-    return MF_E_TRANSFORM_NEED_MORE_INPUT;
-  }
-  // Treat other errors as fatal.
-  ENSURE(SUCCEEDED(hr), hr);
-
-  assert(sample);
-
-  *aOutSample = sample.Detach();
-  return S_OK;
-}
-
-HRESULT
-WMFAACDecoder::Input(const uint8_t* aData,
-                     uint32_t aDataSize,
-                     Microseconds aTimestamp)
-{
-  CComPtr<IMFSample> input = nullptr;
-  HRESULT hr = CreateInputSample(aData, aDataSize, aTimestamp, &input);
-  ENSURE(SUCCEEDED(hr) && input!=nullptr, hr);
-
-  hr = mDecoder->ProcessInput(0, input, 0);
-  if (hr == MF_E_NOTACCEPTING) {
-    // MFT *already* has enough data to produce a sample. Retrieve it.
-    LOG("ProcessInput returned MF_E_NOTACCEPTING\n");
-    return MF_E_NOTACCEPTING;
-  }
-  ENSURE(SUCCEEDED(hr), hr);
-
-  return S_OK;
-}
-
-HRESULT
-WMFAACDecoder::Output(IMFSample** aOutput)
-{
-  CComPtr<IMFSample> outputSample = nullptr;
-  HRESULT hr = GetOutputSample(&outputSample);
-  if (hr == MF_E_TRANSFORM_NEED_MORE_INPUT) {
-    return MF_E_TRANSFORM_NEED_MORE_INPUT;
-  }
-  // Treat other errors as fatal.
-  ENSURE(SUCCEEDED(hr) && outputSample, hr);
-
-  *aOutput = outputSample.Detach();
-
-  return S_OK;
-}
-
-HRESULT
-WMFAACDecoder::Reset()
-{
-  HRESULT hr = SendMFTMessage(MFT_MESSAGE_COMMAND_FLUSH, 0);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  return S_OK;
-}
-
-HRESULT
-WMFAACDecoder::Drain()
-{
-  HRESULT hr = SendMFTMessage(MFT_MESSAGE_COMMAND_DRAIN, 0);
-  ENSURE(SUCCEEDED(hr), hr);
-
-  return S_OK;
-}
-
-}
deleted file mode 100644
--- a/media/gmp-clearkey/0.1/WMFAACDecoder.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2013, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if !defined(WMFAACDecoder_h_)
-#define WMFAACDecoder_h_
-
-#include "WMFUtils.h"
-
-namespace wmf {
-
-class WMFAACDecoder {
-public:
-  WMFAACDecoder();
-  ~WMFAACDecoder();
-
-  HRESULT Init(int32_t aChannelCount,
-               int32_t aSampleRate,
-               BYTE* aUserData,
-               UINT32 aUserDataLength);
-
-  HRESULT Input(const uint8_t* aData,
-                uint32_t aDataSize,
-                Microseconds aTimestamp);
-
-  HRESULT Output(IMFSample** aOutput);
-
-  HRESULT Reset();
-
-  HRESULT Drain();
-
-  UINT32 Channels() const { return mChannels; }
-  UINT32 Rate() const { return mRate; }
-
-private:
-
-  HRESULT GetOutputSample(IMFSample** aOutSample);
-  HRESULT CreateOutputSample(IMFSample** aOutSample);
-  HRESULT CreateInputSample(const uint8_t* aData,
-                            uint32_t aDataSize,
-                            Microseconds aTimestamp,
-                            IMFSample** aOutSample);
-
-  HRESULT SetDecoderInputType(int32_t aChannelCount,
-                              int32_t aSampleRate,
-                              BYTE* aUserData,
-                              UINT32 aUserDataLength);
-  HRESULT SetDecoderOutputType();
-  HRESULT SendMFTMessage(MFT_MESSAGE_TYPE aMsg, UINT32 aData);
-
-  MFT_INPUT_STREAM_INFO mInputStreamInfo;
-  MFT_OUTPUT_STREAM_INFO mOutputStreamInfo;
-
-  CComPtr<IMFTransform> mDecoder;
-
-  UINT32 mChannels;
-  UINT32 mRate;
-};
-
-}
-
-#endif
--- a/media/gmp-clearkey/0.1/WMFH264Decoder.cpp
+++ b/media/gmp-clearkey/0.1/WMFH264Decoder.cpp
@@ -32,23 +32,23 @@ WMFH264Decoder::~WMFH264Decoder()
 }
 
 HRESULT
 WMFH264Decoder::Init(int32_t aCoreCount)
 {
   HRESULT hr;
 
   hr = CreateMFT(__uuidof(CMSH264DecoderMFT),
-                 WMFDecoderDllNameFor(H264),
+                 WMFDecoderDllName(),
                  mDecoder);
   if (FAILED(hr)) {
     // Windows 7 Enterprise Server N (which is what Mozilla's mochitests run
     // on) need a different CLSID to instantiate the H.264 decoder.
     hr = CreateMFT(CLSID_CMSH264DecMFT,
-                   WMFDecoderDllNameFor(H264),
+                   WMFDecoderDllName(),
                    mDecoder);
   }
   ENSURE(SUCCEEDED(hr), hr);
 
   CComPtr<IMFAttributes> attr;
   hr = mDecoder->GetAttributes(&attr);
   ENSURE(SUCCEEDED(hr), hr);
   hr = attr->SetUINT32(CODECAPI_AVDecNumWorkerThreads,
--- a/media/gmp-clearkey/0.1/WMFUtils.cpp
+++ b/media/gmp-clearkey/0.1/WMFUtils.cpp
@@ -31,22 +31,16 @@ void LOG(const char* format, ...)
 {
 #ifdef WMF_DECODER_LOG
   va_list args;
   va_start(args, format);
   vprintf(format, args);
 #endif
 }
 
-#ifdef WMF_MUST_DEFINE_AAC_MFT_CLSID
-// Some SDK versions don't define the AAC decoder CLSID.
-// {32D186A7-218F-4C75-8876-DD77273A8999}
-DEFINE_GUID(CLSID_CMSAACDecMFT, 0x32D186A7, 0x218F, 0x4C75, 0x88, 0x76, 0xDD, 0x77, 0x27, 0x3A, 0x89, 0x99);
-#endif
-
 DEFINE_GUID(CLSID_CMSH264DecMFT, 0x62CE7E72, 0x4C71, 0x4d20, 0xB1, 0x5D, 0x45, 0x28, 0x31, 0xA8, 0x7D, 0x9D);
 
 namespace wmf {
 
 
 #define MFPLAT_FUNC(_func, _dllname) \
   decltype(::_func)* _func;
 #include "WMFSymbols.h"
@@ -70,51 +64,37 @@ LinkMfplat()
 #include "WMFSymbols.h"
 #undef MFPLAT_FUNC
     sInitOk = true;
   }
   return sInitOk;
 }
 
 const char*
-WMFDecoderDllNameFor(CodecType aCodec)
+WMFDecoderDllName()
 {
-  if (aCodec == H264) {
-    // For H.264 decoding, we need msmpeg2vdec.dll on Win 7 & 8,
-    // and mfh264dec.dll on Vista.
-    if (IsWindows7OrGreater()) {
-      return "msmpeg2vdec.dll";
-    } else {
-      return "mfh264dec.dll";
-    }
-  } else if (aCodec == AAC) {
-    // For AAC decoding, we need to use msauddecmft.dll on Win8,
-    // msmpeg2adec.dll on Win7, and msheaacdec.dll on Vista.
-    if (IsWindows8OrGreater()) {
-      return "msauddecmft.dll";
-    } else if (IsWindows7OrGreater()) {
-      return "msmpeg2adec.dll";
-    } else {
-      return "mfheaacdec.dll";
-    }
-  } else {
-    return "";
+  // For H.264 decoding, we need msmpeg2vdec.dll on Win 7 & 8,
+  // and mfh264dec.dll on Vista.
+  if (IsWindows7OrGreater()) {
+    return "msmpeg2vdec.dll";
+  }
+  else {
+    return "mfh264dec.dll";
   }
 }
 
 
 bool
 EnsureLibs()
 {
   static bool sInitDone = false;
   static bool sInitOk = false;
   if (!sInitDone) {
     sInitOk = LinkMfplat() &&
-              !!GetModuleHandleA(WMFDecoderDllNameFor(AAC)) &&
-              !!GetModuleHandleA(WMFDecoderDllNameFor(H264));
+              !!GetModuleHandleA(WMFDecoderDllName());
     sInitDone = true;
   }
   return sInitOk;
 }
 
 int32_t
 MFOffsetToInt32(const MFOffset& aOffset)
 {
--- a/media/gmp-clearkey/0.1/WMFUtils.h
+++ b/media/gmp-clearkey/0.1/WMFUtils.h
@@ -245,24 +245,19 @@ inline uint32_t MicrosecondsToRTPTime(Mi
 
 void dump(const uint8_t* data, uint32_t len, const char* filename);
 
 HRESULT
 CreateMFT(const CLSID& clsid,
           const char* aDllName,
           CComPtr<IMFTransform>& aOutMFT);
 
-enum CodecType {
-  H264,
-  AAC,
-};
-
-// Returns the name of the DLL that is needed to decode H.264 or AAC on
+// Returns the name of the DLL that is needed to decode H.264 on
 // the given windows version we're running on.
-const char* WMFDecoderDllNameFor(CodecType aCodec);
+const char* WMFDecoderDllName();
 
 // Returns the maximum number of threads we want WMF to use for decoding
 // given the number of logical processors available.
 int32_t GetNumThreads(int32_t aCoreCount);
 
 } // namespace wmf
 
 #endif // __WMFUtils_h__
--- a/media/gmp-clearkey/0.1/clearkey.info.in
+++ b/media/gmp-clearkey/0.1/clearkey.info.in
@@ -1,10 +1,10 @@
 Name: clearkey
 Description: ClearKey Gecko Media Plugin
 Version: 1
 #ifdef ENABLE_WMF
-APIs: eme-decrypt-v9[org.w3.clearkey], decode-audio[aac:org.w3.clearkey], decode-video[h264:org.w3.clearkey]
+APIs: eme-decrypt-v9[org.w3.clearkey], decode-video[h264:org.w3.clearkey]
 Libraries: dxva2.dll, d3d9.dll, msmpeg2vdec.dll, msmpeg2adec.dll, MSAudDecMFT.dll, evr.dll, mfheaacdec.dll, mfh264dec.dll, mfplat.dll
 #else
 APIs: eme-decrypt-v9[org.w3.clearkey]
 Libraries:
 #endif
--- a/media/gmp-clearkey/0.1/gmp-clearkey.cpp
+++ b/media/gmp-clearkey/0.1/gmp-clearkey.cpp
@@ -21,17 +21,16 @@
 #include "ClearKeyAsyncShutdown.h"
 #include "ClearKeySessionManager.h"
 #include "gmp-api/gmp-async-shutdown.h"
 #include "gmp-api/gmp-decryption.h"
 #include "gmp-api/gmp-platform.h"
 
 #if defined(ENABLE_WMF)
 #include "WMFUtils.h"
-#include "AudioDecoder.h"
 #include "VideoDecoder.h"
 #endif
 
 #if defined(WIN32)
 #define GMP_EXPORT __declspec(dllexport)
 #else
 #define GMP_EXPORT __attribute__((visibility("default")))
 #endif
@@ -57,20 +56,17 @@ GMPGetAPI(const char* aApiName, void* aH
 {
   CK_LOGD("ClearKey GMPGetAPI |%s|", aApiName);
   assert(!*aPluginAPI);
 
   if (!strcmp(aApiName, GMP_API_DECRYPTOR)) {
     *aPluginAPI = new ClearKeySessionManager();
   }
 #if defined(ENABLE_WMF)
-  else if (!strcmp(aApiName, GMP_API_AUDIO_DECODER) &&
-           wmf::EnsureLibs()) {
-    *aPluginAPI = new AudioDecoder(static_cast<GMPAudioHost*>(aHostAPI));
-  } else if (!strcmp(aApiName, GMP_API_VIDEO_DECODER) &&
+ else if (!strcmp(aApiName, GMP_API_VIDEO_DECODER) &&
              wmf::EnsureLibs()) {
     *aPluginAPI = new VideoDecoder(static_cast<GMPVideoHost*>(aHostAPI));
   }
 #endif
   else if (!strcmp(aApiName, GMP_API_ASYNC_SHUTDOWN)) {
     *aPluginAPI = new ClearKeyAsyncShutdown(static_cast<GMPAsyncShutdownHost*> (aHostAPI));
   } else {
     CK_LOGE("GMPGetAPI couldn't resolve API name |%s|\n", aApiName);
--- a/media/gmp-clearkey/0.1/moz.build
+++ b/media/gmp-clearkey/0.1/moz.build
@@ -24,19 +24,17 @@ UNIFIED_SOURCES += [
 
 SOURCES += [
     'openaes/oaes_lib.c',
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     UNIFIED_SOURCES += [
         'AnnexB.cpp',
-        'AudioDecoder.cpp',
         'VideoDecoder.cpp',
-        'WMFAACDecoder.cpp',
         'WMFH264Decoder.cpp',
     ]
 
     SOURCES += [
         'WMFUtils.cpp',
     ]
 
     OS_LIBS += [