Backed out 5 changesets (bug 941302) for non-unified bustage. a=backout
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 06 Aug 2014 12:54:17 -0400
changeset 198238 41e5029a4b7dd6aa1919816b7bedd546ece039d4
parent 198237 a21244068b7f012343ff2172a960fcba817aa2dc
child 198239 f932237f00424afe9bbf36e055be5be7498fe480
push id47332
push userkwierso@gmail.com
push dateThu, 07 Aug 2014 01:18:56 +0000
treeherdermozilla-inbound@118d2e5256e5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs941302
milestone34.0a1
backs out73cfc50bcd3797bacb32ddf7644efab8e1c2db9a
13efa442f3bd0e363b7146b16f3985e89ddbd152
6cf06baf92e1b5e28b86ee6885bf7cf143a8727f
0ee6c16041e0cc3ec88a1f21a7a5b563176103f8
2bc3c5dfbe97a8c44000cc18d01b7b13ff6c713e
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
Backed out 5 changesets (bug 941302) for non-unified bustage. a=backout Backed out changeset 73cfc50bcd37 (bug 941302) Backed out changeset 13efa442f3bd (bug 941302) Backed out changeset 6cf06baf92e1 (bug 941302) Backed out changeset 0ee6c16041e0 (bug 941302) Backed out changeset 2bc3c5dfbe97 (bug 941302)
b2g/app/b2g.js
configure.in
content/media/fmp4/MP4Decoder.cpp
content/media/fmp4/MP4Reader.cpp
content/media/fmp4/MP4Reader.h
content/media/fmp4/PlatformDecoderModule.cpp
content/media/fmp4/PlatformDecoderModule.h
content/media/fmp4/gonk/GonkAudioDecoderManager.cpp
content/media/fmp4/gonk/GonkAudioDecoderManager.h
content/media/fmp4/gonk/GonkDecoderModule.cpp
content/media/fmp4/gonk/GonkDecoderModule.h
content/media/fmp4/gonk/GonkMediaDataDecoder.cpp
content/media/fmp4/gonk/GonkMediaDataDecoder.h
content/media/fmp4/gonk/GonkVideoDecoderManager.cpp
content/media/fmp4/gonk/GonkVideoDecoderManager.h
content/media/fmp4/gonk/moz.build
content/media/fmp4/moz.build
content/media/omx/MediaCodecProxy.cpp
content/media/omx/MediaCodecProxy.h
media/libstagefright/binding/include/mp4_demuxer/DecoderData.h
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -304,20 +304,17 @@ pref("notification.feature.enabled", tru
 
 // IndexedDB
 pref("dom.indexedDB.warningQuota", 5);
 
 // prevent video elements from preloading too much data
 pref("media.preload.default", 1); // default to preload none
 pref("media.preload.auto", 2);    // preload metadata if preload=auto
 pref("media.cache_size", 4096);    // 4MB media cache
-#ifdef MOZ_FMP4
-// Enable/Disable Gonk Decoder Module
-pref("media.fragmented-mp4.gonk.enabled", false);
-#endif
+
 // The default number of decoded video frames that are enqueued in
 // MediaDecoderReader's mVideoQueue.
 pref("media.video-queue.default-size", 3);
 
 // optimize images' memory usage
 pref("image.mem.decodeondraw", true);
 pref("image.mem.allow_locking_in_content_processes", false); /* don't allow image locking */
 pref("image.mem.min_discard_timeout_ms", 86400000); /* 24h, we rely on the out of memory hook */
--- a/configure.in
+++ b/configure.in
@@ -256,32 +256,31 @@ if test -n "$gonkdir" ; then
         MOZ_RTSP=1
         MOZ_NFC=1
         MOZ_B2G_CAMERA=1
         MOZ_OMX_DECODER=1
         AC_SUBST(MOZ_OMX_DECODER)
         MOZ_OMX_ENCODER=1
         AC_SUBST(MOZ_OMX_ENCODER)
         AC_DEFINE(MOZ_OMX_ENCODER)
-	MOZ_FMP4=1
         ;;
     19)
         GONK_INCLUDES="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include"
         MOZ_B2G_CAMERA=1
         MOZ_B2G_BT=1
         MOZ_B2G_BT_BLUEDROID=1
         MOZ_NFC=1
         MOZ_RTSP=1
         MOZ_OMX_DECODER=1
         MOZ_OMX_ENCODER=1
         AC_DEFINE(MOZ_OMX_ENCODER)
         MOZ_AUDIO_OFFLOAD=1
         AC_SUBST(MOZ_AUDIO_OFFLOAD)
         AC_DEFINE(MOZ_AUDIO_OFFLOAD)
-	MOZ_FMP4=1
+
         ;;
     *)
         AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
         ;;
     esac
     CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/hardware/libhardware/include -I$gonkdir/external/valgrind/fxos-include $GONK_INCLUDES $CPPFLAGS"
     CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
     CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
@@ -3771,21 +3770,17 @@ MOZ_TREMOR=
 MOZ_WAVE=1
 MOZ_SAMPLE_TYPE_FLOAT32=
 MOZ_SAMPLE_TYPE_S16=
 MOZ_OPUS=1
 MOZ_WEBM=1
 MOZ_GSTREAMER=
 MOZ_DIRECTSHOW=
 MOZ_WMF=
-if test -n "$MOZ_FMP4"; then
-  MOZ_FMP4=1
-else
-  MOZ_FMP4 =
-fi
+MOZ_FMP4=
 MOZ_EME=1
 MOZ_FFMPEG=
 MOZ_WEBRTC=1
 MOZ_PEERCONNECTION=
 MOZ_SRTP=
 MOZ_WEBRTC_SIGNALING=
 MOZ_WEBRTC_ASSERT_ALWAYS=1
 MOZ_SCTP=
--- a/content/media/fmp4/MP4Decoder.cpp
+++ b/content/media/fmp4/MP4Decoder.cpp
@@ -127,32 +127,25 @@ IsAppleAvailable()
     return false;
   }
   // All hurdles cleared!
   return true;
 #endif
 }
 
 static bool
-IsGonkMP4DecoderAvailable()
-{
-  return Preferences::GetBool("media.fragmented-mp4.gonk.enabled", false);
-}
-
-static bool
 HavePlatformMPEGDecoders()
 {
   return Preferences::GetBool("media.fragmented-mp4.use-blank-decoder") ||
 #ifdef XP_WIN
          // We have H.264/AAC platform decoders on Windows Vista and up.
          IsVistaOrLater() ||
 #endif
          IsFFmpegAvailable() ||
          IsAppleAvailable() ||
-	 IsGonkMP4DecoderAvailable() ||
          // TODO: Other platforms...
          false;
 }
 
 /* static */
 bool
 MP4Decoder::IsEnabled()
 {
--- a/content/media/fmp4/MP4Reader.cpp
+++ b/content/media/fmp4/MP4Reader.cpp
@@ -225,24 +225,18 @@ public:
     return NS_OK;
   }
 private:
   nsRefPtr<AbstractMediaDecoder> mDecoder;
   nsTArray<uint8_t> mInitData;
   nsString mInitDataType;
 };
 
-bool MP4Reader::IsWaitingOnCodecResource() {
-#ifdef MOZ_GONK_MEDIACODEC
-  return mVideo.mDecoder && mVideo.mDecoder->IsWaitingMediaResources();
-#endif
-  return false;
-}
-
-bool MP4Reader::IsWaitingOnCDMResource() {
+bool MP4Reader::IsWaitingMediaResources()
+{
   nsRefPtr<CDMProxy> proxy;
   {
     ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
     if (!mIsEncrypted) {
       // Not encrypted, no need to wait for CDMProxy.
       return false;
     }
     proxy = mDecoder->GetCDMProxy();
@@ -254,25 +248,16 @@ bool MP4Reader::IsWaitingOnCDMResource()
   // We'll keep waiting if the CDM hasn't informed Gecko of its capabilities.
   {
     CDMCaps::AutoLock caps(proxy->Capabilites());
     LOG("MP4Reader::IsWaitingMediaResources() capsKnown=%d", caps.AreCapsKnown());
     return !caps.AreCapsKnown();
   }
 }
 
-bool MP4Reader::IsWaitingMediaResources()
-{
-  // IsWaitingOnCDMResource() *must* come first, because we don't know whether
-  // we can create a decoder until the CDM is initialized and it has told us
-  // whether *it* will decode, or whether we need to create a PDM to do the
-  // decoding
-  return IsWaitingOnCDMResource() || IsWaitingOnCodecResource();
-}
-
 void
 MP4Reader::ExtractCryptoInitData(nsTArray<uint8_t>& aInitData)
 {
   MOZ_ASSERT(mDemuxer->Crypto().valid);
   const nsTArray<mp4_demuxer::PsshInfo>& psshs = mDemuxer->Crypto().pssh;
   for (uint32_t i = 0; i < psshs.Length(); i++) {
     aInitData.AppendElements(psshs[i].data);
   }
@@ -304,22 +289,17 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo
       ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
       mIsEncrypted = mDemuxer->Crypto().valid;
     }
 
     // Remember that we've initialized the demuxer, so that if we're decoding
     // an encrypted stream and we need to wait for a CDM to be set, we don't
     // need to reinit the demuxer.
     mDemuxerInitialized = true;
-  } else if (mPlatform && !IsWaitingMediaResources()) {
-    *aInfo = mInfo;
-    *aTags = nullptr;
-    return NS_OK;
   }
-
   if (mDemuxer->Crypto().valid) {
     if (!sIsEMEEnabled) {
       // TODO: Need to signal DRM/EME required somehow...
       return NS_ERROR_FAILURE;
     }
 
     // We have encrypted audio or video. We'll need a CDM to decrypt and
     // possibly decode this. Wait until we've received a CDM from the
@@ -750,41 +730,9 @@ MP4Reader::GetBuffered(dom::TimeRanges* 
   for (size_t i = 0; i < mTimeRanges.Length(); i++) {
     aBuffered->Add((mTimeRanges[i].start - aStartTime) / 1000000.0,
                    (mTimeRanges[i].end - aStartTime) / 1000000.0);
   }
 
   return NS_OK;
 }
 
-bool MP4Reader::IsDormantNeeded()
-{
-#ifdef MOZ_GONK_MEDIACODEC
-  return mVideo.mDecoder && mVideo.mDecoder->IsDormantNeeded();
-#endif
-  return false;
-}
-
-void MP4Reader::ReleaseMediaResources()
-{
-#ifdef MOZ_GONK_MEDIACODEC
-  // Before freeing a video codec, all video buffers needed to be released
-  // even from graphics pipeline.
-  VideoFrameContainer* container = mDecoder->GetVideoFrameContainer();
-  if (container) {
-    container->ClearCurrentFrame();
-  }
-  if (mVideo.mDecoder) {
-    mVideo.mDecoder->ReleaseMediaResources();
-  }
-#endif
-}
-
-void MP4Reader::NotifyResourcesStatusChanged()
-{
-#ifdef MOZ_GONK_MEDIACODEC
-  if (mDecoder) {
-    mDecoder->NotifyWaitingForResourcesStatusChanged();
-  }
-#endif
-}
-
 } // namespace mozilla
--- a/content/media/fmp4/MP4Reader.h
+++ b/content/media/fmp4/MP4Reader.h
@@ -54,20 +54,17 @@ public:
   virtual bool IsMediaSeekable() MOZ_OVERRIDE;
 
   virtual void NotifyDataArrived(const char* aBuffer, uint32_t aLength,
                                  int64_t aOffset) MOZ_OVERRIDE;
 
   virtual nsresult GetBuffered(dom::TimeRanges* aBuffered,
                                int64_t aStartTime) MOZ_OVERRIDE;
 
-  // For Media Resource Management
   virtual bool IsWaitingMediaResources() MOZ_OVERRIDE;
-  virtual bool IsDormantNeeded() MOZ_OVERRIDE;
-  virtual void ReleaseMediaResources() MOZ_OVERRIDE;
 
   virtual nsresult ResetDecode() MOZ_OVERRIDE;
 
   virtual void Shutdown() MOZ_OVERRIDE;
 
 private:
 
   void ExtractCryptoInitData(nsTArray<uint8_t>& aInitData);
@@ -82,19 +79,16 @@ private:
   bool SkipVideoDemuxToNextKeyFrame(int64_t aTimeThreshold, uint32_t& parsed);
 
   void Output(mp4_demuxer::TrackType aType, MediaData* aSample);
   void InputExhausted(mp4_demuxer::TrackType aTrack);
   void Error(mp4_demuxer::TrackType aTrack);
   bool Decode(mp4_demuxer::TrackType aTrack);
   void Flush(mp4_demuxer::TrackType aTrack);
   void DrainComplete(mp4_demuxer::TrackType aTrack);
-  void NotifyResourcesStatusChanged();
-  bool IsWaitingOnCodecResource();
-  bool IsWaitingOnCDMResource();
 
   nsAutoPtr<mp4_demuxer::MP4Demuxer> mDemuxer;
   nsAutoPtr<PlatformDecoderModule> mPlatform;
 
   class DecoderCallback : public MediaDataDecoderCallback {
   public:
     DecoderCallback(MP4Reader* aReader,
                     mp4_demuxer::TrackType aType)
@@ -109,22 +103,16 @@ private:
       mReader->InputExhausted(mType);
     }
     virtual void Error() MOZ_OVERRIDE {
       mReader->Error(mType);
     }
     virtual void DrainComplete() MOZ_OVERRIDE {
       mReader->DrainComplete(mType);
     }
-    virtual void NotifyResourcesStatusChanged() MOZ_OVERRIDE {
-      mReader->NotifyResourcesStatusChanged();
-    }
-    virtual void ReleaseMediaResources() MOZ_OVERRIDE {
-      mReader->ReleaseMediaResources();
-    }
   private:
     MP4Reader* mReader;
     mp4_demuxer::TrackType mType;
   };
 
   struct DecoderData {
     DecoderData(const char* aMonitorName,
                 uint32_t aDecodeAhead)
--- a/content/media/fmp4/PlatformDecoderModule.cpp
+++ b/content/media/fmp4/PlatformDecoderModule.cpp
@@ -9,53 +9,44 @@
 #include "WMFDecoderModule.h"
 #endif
 #ifdef MOZ_FFMPEG
 #include "FFmpegRuntimeLinker.h"
 #endif
 #ifdef MOZ_APPLEMEDIA
 #include "AppleDecoderModule.h"
 #endif
-#ifdef MOZ_GONK_MEDIACODEC
-#include "GonkDecoderModule.h"
-#endif
-
 #include "mozilla/Preferences.h"
 #include "EMEDecoderModule.h"
 #include "mozilla/CDMProxy.h"
 #include "SharedThreadPool.h"
 #include "MediaTaskQueue.h"
 
 namespace mozilla {
 
 extern PlatformDecoderModule* CreateBlankDecoderModule();
 
 bool PlatformDecoderModule::sUseBlankDecoder = false;
 bool PlatformDecoderModule::sFFmpegDecoderEnabled = false;
-bool PlatformDecoderModule::sGonkDecoderEnabled = false;
 
 /* static */
 void
 PlatformDecoderModule::Init()
 {
   MOZ_ASSERT(NS_IsMainThread());
   static bool alreadyInitialized = false;
   if (alreadyInitialized) {
     return;
   }
   alreadyInitialized = true;
 
   Preferences::AddBoolVarCache(&sUseBlankDecoder,
                                "media.fragmented-mp4.use-blank-decoder");
   Preferences::AddBoolVarCache(&sFFmpegDecoderEnabled,
                                "media.fragmented-mp4.ffmpeg.enabled", false);
-#ifdef MOZ_GONK_MEDIACODEC
-  Preferences::AddBoolVarCache(&sGonkDecoderEnabled,
-                               "media.fragmented-mp4.gonk.enabled", false);
-#endif
 #ifdef XP_WIN
   WMFDecoderModule::Init();
 #endif
 #ifdef MOZ_APPLEMEDIA
   AppleDecoderModule::Init();
 #endif
 }
 
@@ -133,17 +124,12 @@ PlatformDecoderModule::Create()
   }
 #endif
 #ifdef MOZ_APPLEMEDIA
   nsAutoPtr<AppleDecoderModule> m(new AppleDecoderModule());
   if (NS_SUCCEEDED(m->Startup())) {
     return m.forget();
   }
 #endif
-#ifdef MOZ_GONK_MEDIACODEC
-  if (sGonkDecoderEnabled) {
-    return new GonkDecoderModule();
-  }
-#endif
   return nullptr;
 }
 
 } // namespace mozilla
--- a/content/media/fmp4/PlatformDecoderModule.h
+++ b/content/media/fmp4/PlatformDecoderModule.h
@@ -118,17 +118,16 @@ public:
 
   virtual ~PlatformDecoderModule() {}
 
 protected:
   PlatformDecoderModule() {}
   // Caches pref media.fragmented-mp4.use-blank-decoder
   static bool sUseBlankDecoder;
   static bool sFFmpegDecoderEnabled;
-  static bool sGonkDecoderEnabled;
 };
 
 // A callback used by MediaDataDecoder to return output/errors to the
 // MP4Reader. Implementation is threadsafe, and can be called on any thread.
 class MediaDataDecoderCallback {
 public:
   virtual ~MediaDataDecoderCallback() {}
 
@@ -140,20 +139,16 @@ public:
   // the decoder.
   virtual void Error() = 0;
 
   // Denotes that the last input sample has been inserted into the decoder,
   // and no more output can be produced unless more input is sent.
   virtual void InputExhausted() = 0;
 
   virtual void DrainComplete() = 0;
-
-  virtual void NotifyResourcesStatusChanged() {};
-
-  virtual void ReleaseMediaResources() {};
 };
 
 // MediaDataDecoder is the interface exposed by decoders created by the
 // PlatformDecoderModule's Create*Decoder() functions. The type of
 // media data that the decoder accepts as valid input and produces as
 // output is determined when the MediaDataDecoder is created.
 //
 // All functions must be threadsafe, and be able to be called on an
@@ -209,22 +204,13 @@ public:
   // decoder. The platform decoder should clean up any resources it's using
   // and release memory etc. Shutdown() must block until the decoder has
   // completed shutdown. The reader calls Flush() before calling Shutdown().
   // The reader will delete the decoder once Shutdown() returns.
   // The MediaDataDecoderCallback *must* not be called after Shutdown() has
   // returned.
   virtual nsresult Shutdown() = 0;
 
-  // For Codec Resource Management
-  virtual bool IsWaitingMediaResources() {
-    return false;
-  };
-  virtual bool IsDormantNeeded() {
-    return false;
-  };
-  virtual void ReleaseMediaResources() {};
-  virtual void ReleaseDecoder() {};
 };
 
 } // namespace mozilla
 
 #endif
deleted file mode 100644
--- a/content/media/fmp4/gonk/GonkAudioDecoderManager.cpp
+++ /dev/null
@@ -1,197 +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 "GonkAudioDecoderManager.h"
-#include "MediaDecoderReader.h"
-#include "VideoUtils.h"
-#include "nsTArray.h"
-#include "prlog.h"
-#include "stagefright/MediaBuffer.h"
-#include "stagefright/MetaData.h"
-#include "stagefright/MediaErrors.h"
-#include <stagefright/foundation/AMessage.h>
-#include "media/openmax/OMX_Audio.h"
-
-#define LOG_TAG "GonkAudioDecoderManager"
-#include <android/log.h>
-#define ALOG(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
-
-#ifdef PR_LOGGING
-PRLogModuleInfo* GetDemuxerLog();
-#define LOG(...) PR_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (__VA_ARGS__))
-#else
-#define LOG(...)
-#endif
-#define READ_OUTPUT_BUFFER_TIMEOUT_US  3000
-
-using namespace android;
-typedef android::MediaCodecProxy MediaCodecProxy;
-
-namespace mozilla {
-
-GonkAudioDecoderManager::GonkAudioDecoderManager(
-  const mp4_demuxer::AudioDecoderConfig& aConfig)
-  : mAudioChannels(aConfig.channel_count)
-  , mAudioRate(aConfig.samples_per_second)
-  , mAudioProfile(aConfig.aac_profile)
-  , mAudioBuffer(nullptr)
-{
-  MOZ_COUNT_CTOR(GonkAudioDecoderManager);
-  MOZ_ASSERT(mAudioChannels);
-  mUserData.AppendElements(&aConfig.audio_specific_config[0],
-                           aConfig.audio_specific_config.length());
-}
-
-GonkAudioDecoderManager::~GonkAudioDecoderManager()
-{
-  MOZ_COUNT_DTOR(GonkAudioDecoderManager);
-}
-
-android::sp<MediaCodecProxy>
-GonkAudioDecoderManager::Init(MediaDataDecoderCallback* aCallback)
-{
-  if (mLooper != nullptr) {
-    return nullptr;
-  }
-  // Create ALooper
-  mLooper = new ALooper;
-  mLooper->setName("GonkAudioDecoderManager");
-  mLooper->start();
-
-  mDecoder = MediaCodecProxy::CreateByType(mLooper, "audio/mp4a-latm", false, false, nullptr);
-  if (!mDecoder.get()) {
-    return nullptr;
-  }
-  sp<AMessage> format = new AMessage;
-  // Fixed values
-  ALOG("Init Audio channel no:%d, sample-rate:%d", mAudioChannels, mAudioRate);
-  format->setString("mime", "audio/mp4a-latm");
-  format->setInt32("channel-count", mAudioChannels);
-  format->setInt32("sample-rate", mAudioRate);
-  format->setInt32("aac-profile", mAudioProfile);
-  format->setInt32("is-adts", true);
-  status_t err = mDecoder->configure(format, nullptr, nullptr, 0);
-  if (err != OK || !mDecoder->Prepare()) {
-    return nullptr;
-  }
-  status_t rv = mDecoder->Input(mUserData.Elements(), mUserData.Length(), 0,
-                                android::MediaCodec::BUFFER_FLAG_CODECCONFIG);
-
-  if (rv == OK) {
-    return mDecoder;
-  } else {
-    ALOG("Failed to input codec specific data!");
-    return nullptr;
-  }
-}
-
-nsresult
-GonkAudioDecoderManager::CreateAudioData(int64_t aStreamOffset, AudioData **v) {
-
-  void *data;
-  size_t dataOffset;
-  size_t size;
-  int64_t timeUs;
-
-  if (!mAudioBuffer->meta_data()->findInt64(kKeyTime, &timeUs)) {
-    return NS_ERROR_UNEXPECTED;
-  }
-  data = mAudioBuffer->data();
-  dataOffset = mAudioBuffer->range_offset();
-  size = mAudioBuffer->range_length();
-
-  nsAutoArrayPtr<AudioDataValue> buffer(new AudioDataValue[size/2] );
-  memcpy(buffer.get(), data+dataOffset, size);
-  uint32_t frames = size / (2 * mAudioChannels);
-
-  CheckedInt64 duration = FramesToUsecs(frames, mAudioRate);
-  if (!duration.isValid()) {
-    return NS_ERROR_UNEXPECTED;
-  }
-  *v = new AudioData(aStreamOffset, timeUs, duration.value(), frames, buffer.forget(),
-		     mAudioChannels);
-  ReleaseAudioBuffer();
-  return NS_OK;
-}
-
-nsresult
-GonkAudioDecoderManager::Output(int64_t aStreamOffset,
-                                nsAutoPtr<MediaData>& aOutData)
-{
-  aOutData = nullptr;
-  status_t err;
-  err = mDecoder->Output(&mAudioBuffer, READ_OUTPUT_BUFFER_TIMEOUT_US);
-
-  switch (err) {
-    case OK:
-    {
-      if (mAudioBuffer && mAudioBuffer->range_length() != 0) {
-        int64_t timeUs;
-        if (!mAudioBuffer->meta_data()->findInt64(kKeyTime, &timeUs)) {
-          return NS_ERROR_UNEXPECTED;
-	}
-      }
-      AudioData* data = nullptr;
-      nsresult rv = CreateAudioData(aStreamOffset, &data);
-      // Frame should be non null only when we succeeded.
-      if (rv != NS_OK) {
-        return NS_ERROR_UNEXPECTED;
-      }
-      aOutData = data;
-      return NS_OK;
-    }
-    case android::INFO_FORMAT_CHANGED:
-    case android::INFO_OUTPUT_BUFFERS_CHANGED:
-    {
-      // If the format changed, update our cached info.
-      ALOG("Decoder format changed");
-      return Output(aStreamOffset, aOutData);
-    }
-    case -EAGAIN:
-    {
-      return NS_ERROR_NOT_AVAILABLE;
-    }
-    case android::ERROR_END_OF_STREAM:
-    {
-      ALOG("End of Stream");
-      return NS_ERROR_ABORT;
-    }
-    case -ETIMEDOUT:
-    {
-      ALOG("Timeout. can try again next time");
-      return NS_ERROR_UNEXPECTED;
-    }
-    default:
-    {
-      ALOG("Decoder failed, err=%d", err);
-      return NS_ERROR_UNEXPECTED;
-    }
-  }
-
-  return NS_OK;
-}
-
-void GonkAudioDecoderManager::ReleaseAudioBuffer() {
-  if (mAudioBuffer) {
-    sp<MetaData> metaData = mAudioBuffer->meta_data();
-    int32_t index;
-    metaData->findInt32(android::MediaCodecProxy::kKeyBufferIndex, &index);
-    mAudioBuffer->release();
-    mAudioBuffer = nullptr;
-    mDecoder->releaseOutputBuffer(index);
-  }
-}
-
-nsresult
-GonkAudioDecoderManager::Input(mp4_demuxer::MP4Sample* aSample)
-{
-  const uint8_t* data = reinterpret_cast<const uint8_t*>(aSample->data);
-  uint32_t length = aSample->size;
-  status_t rv = mDecoder->Input(data, length, aSample->composition_timestamp, 0);
-  return rv == OK ? NS_OK : NS_ERROR_UNEXPECTED;
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/content/media/fmp4/gonk/GonkAudioDecoderManager.h
+++ /dev/null
@@ -1,51 +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(GonkAudioDecoderManager_h_)
-#define GonkAudioDecoderManager_h_
-
-#include "mozilla/RefPtr.h"
-#include "MP4Reader.h"
-#include "GonkMediaDataDecoder.h"
-
-using namespace android;
-
-namespace mozilla {
-
-class GonkAudioDecoderManager : public GonkDecoderManager {
-typedef android::MediaCodecProxy MediaCodecProxy;
-public:
-  GonkAudioDecoderManager(const mp4_demuxer::AudioDecoderConfig& aConfig);
-  ~GonkAudioDecoderManager();
-
-  virtual android::sp<MediaCodecProxy> Init(MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE;
-
-  virtual nsresult Input(mp4_demuxer::MP4Sample* aSample) MOZ_OVERRIDE;
-
-  virtual nsresult Output(int64_t aStreamOffset,
-                          nsAutoPtr<MediaData>& aOutput) MOZ_OVERRIDE;
-private:
-
-  nsresult CreateAudioData(int64_t aStreamOffset,
-                              AudioData** aOutData);
-
-  void ReleaseAudioBuffer();
-  // MediaCodedc's wrapper that performs the decoding.
-  android::sp<MediaCodecProxy> mDecoder;
-
-  const uint32_t mAudioChannels;
-  const uint32_t mAudioRate;
-  const uint32_t mAudioProfile;
-  nsTArray<uint8_t> mUserData;
-
-  MediaDataDecoderCallback*  mReaderCallback;
-  android::MediaBuffer* mAudioBuffer;
-  android::sp<ALooper> mLooper;
-};
-
-} // namespace mozilla
-
-#endif // GonkAudioDecoderManager_h_
deleted file mode 100644
--- a/content/media/fmp4/gonk/GonkDecoderModule.cpp
+++ /dev/null
@@ -1,61 +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 "GonkDecoderModule.h"
-#include "GonkVideoDecoderManager.h"
-#include "GonkAudioDecoderManager.h"
-#include "mozilla/Preferences.h"
-#include "mozilla/DebugOnly.h"
-#include "GonkMediaDataDecoder.h"
-
-namespace mozilla {
-GonkDecoderModule::GonkDecoderModule()
-{
-}
-
-GonkDecoderModule::~GonkDecoderModule()
-{
-}
-
-/* static */
-void
-GonkDecoderModule::Init()
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Must be on main thread.");
-}
-
-nsresult
-GonkDecoderModule::Shutdown()
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Must be on main thread.");
-
-  return NS_OK;
-}
-
-already_AddRefed<MediaDataDecoder>
-GonkDecoderModule::CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
-                                    mozilla::layers::LayersBackend aLayersBackend,
-                                    mozilla::layers::ImageContainer* aImageContainer,
-                                    MediaTaskQueue* aVideoTaskQueue,
-                                    MediaDataDecoderCallback* aCallback)
-{
-  nsRefPtr<MediaDataDecoder> decoder =
-  new GonkMediaDataDecoder(new GonkVideoDecoderManager(aImageContainer,aConfig),
-                           aVideoTaskQueue, aCallback);
-  return decoder.forget();
-}
-
-already_AddRefed<MediaDataDecoder>
-GonkDecoderModule::CreateAACDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
-                                   MediaTaskQueue* aAudioTaskQueue,
-                                   MediaDataDecoderCallback* aCallback)
-{
-  nsRefPtr<MediaDataDecoder> decoder =
-  new GonkMediaDataDecoder(new GonkAudioDecoderManager(aConfig), aAudioTaskQueue,
-                           aCallback);
-  return decoder.forget();
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/content/media/fmp4/gonk/GonkDecoderModule.h
+++ /dev/null
@@ -1,41 +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(GonkPlatformDecoderModule_h_)
-#define GonkPlatformDecoderModule_h_
-
-#include "PlatformDecoderModule.h"
-
-namespace mozilla {
-
-class GonkDecoderModule : public PlatformDecoderModule {
-public:
-  GonkDecoderModule();
-  virtual ~GonkDecoderModule();
-
-  // Called when the decoders have shutdown.
-  virtual nsresult Shutdown() MOZ_OVERRIDE;
-
-  // Decode thread.
-  virtual already_AddRefed<MediaDataDecoder>
-  CreateH264Decoder(const mp4_demuxer::VideoDecoderConfig& aConfig,
-                    mozilla::layers::LayersBackend aLayersBackend,
-                    mozilla::layers::ImageContainer* aImageContainer,
-                    MediaTaskQueue* aVideoTaskQueue,
-                    MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE;
-
-  // Decode thread.
-  virtual already_AddRefed<MediaDataDecoder>
-  CreateAACDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig,
-                   MediaTaskQueue* aAudioTaskQueue,
-                   MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE;
-
-  static void Init();
-};
-
-} // namespace mozilla
-
-#endif
deleted file mode 100644
--- a/content/media/fmp4/gonk/GonkMediaDataDecoder.cpp
+++ /dev/null
@@ -1,154 +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 "mp4_demuxer/mp4_demuxer.h"
-#include "GonkMediaDataDecoder.h"
-#include "VideoUtils.h"
-#include "nsTArray.h"
-
-#include "prlog.h"
-#define LOG_TAG "GonkMediaDataDecoder(blake)"
-#include <android/log.h>
-#define ALOG(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
-
-#ifdef PR_LOGGING
-PRLogModuleInfo* GetDemuxerLog();
-#define LOG(...) PR_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (__VA_ARGS__))
-#else
-#define LOG(...)
-#endif
-
-using namespace android;
-
-namespace mozilla {
-
-GonkMediaDataDecoder::GonkMediaDataDecoder(GonkDecoderManager* aManager,
-                                           MediaTaskQueue* aTaskQueue,
-                                           MediaDataDecoderCallback* aCallback)
-  : mTaskQueue(aTaskQueue)
-  , mCallback(aCallback)
-  , mManager(aManager)
-{
-  MOZ_COUNT_CTOR(GonkMediaDataDecoder);
-}
-
-GonkMediaDataDecoder::~GonkMediaDataDecoder()
-{
-  MOZ_COUNT_DTOR(GonkMediaDataDecoder);
-}
-
-nsresult
-GonkMediaDataDecoder::Init()
-{
-  mDecoder = mManager->Init(mCallback);
-  return mDecoder.get() ? NS_OK : NS_ERROR_UNEXPECTED;
-}
-
-nsresult
-GonkMediaDataDecoder::Shutdown()
-{
-  mDecoder->stop();
-  mDecoder = nullptr;
-  return NS_OK;
-}
-
-// Inserts data into the decoder's pipeline.
-nsresult
-GonkMediaDataDecoder::Input(mp4_demuxer::MP4Sample* aSample)
-{
-  mTaskQueue->Dispatch(
-    NS_NewRunnableMethodWithArg<nsAutoPtr<mp4_demuxer::MP4Sample>>(
-      this,
-      &GonkMediaDataDecoder::ProcessDecode,
-      nsAutoPtr<mp4_demuxer::MP4Sample>(aSample)));
-  return NS_OK;
-}
-
-void
-GonkMediaDataDecoder::ProcessDecode(mp4_demuxer::MP4Sample* aSample)
-{
-  nsresult rv = mManager->Input(aSample);
-  if (rv != NS_OK) {
-    NS_WARNING("GonkAudioDecoder failed to input data");
-    ALOG("Failed to input data err: %d",rv);
-    mCallback->Error();
-    return;
-  }
-
-  mLastStreamOffset = aSample->byte_offset;
-  ProcessOutput();
-}
-
-void
-GonkMediaDataDecoder::ProcessOutput()
-{
-  nsAutoPtr<MediaData> output;
-  nsresult rv;
-  while (true) {
-    rv = mManager->Output(mLastStreamOffset, output);
-    if (rv == NS_OK) {
-      mCallback->Output(output.forget());
-      continue;
-    }
-    else {
-      break;
-    }
-  }
-
-  if (rv == NS_ERROR_NOT_AVAILABLE) {
-    mCallback->InputExhausted();
-    return;
-  }
-  if (rv != NS_OK) {
-    NS_WARNING("GonkMediaDataDecoder failed to output data");
-    ALOG("Failed to output data");
-    mCallback->Error();
-  }
-}
-
-nsresult
-GonkMediaDataDecoder::Flush()
-{
-  // Flush the input task queue. This cancels all pending Decode() calls.
-  // Note this blocks until the task queue finishes its current job, if
-  // it's executing at all. Note the MP4Reader ignores all output while
-  // flushing.
-  mTaskQueue->Flush();
-
-  status_t err = mDecoder->flush();
-  return err == OK ? NS_OK : NS_ERROR_FAILURE;
-}
-
-void
-GonkMediaDataDecoder::ProcessDrain()
-{
-  // Then extract all available output.
-  ProcessOutput();
-  mCallback->DrainComplete();
-}
-
-nsresult
-GonkMediaDataDecoder::Drain()
-{
-  mTaskQueue->Dispatch(NS_NewRunnableMethod(this, &GonkMediaDataDecoder::ProcessDrain));
-  return NS_OK;
-}
-
-bool
-GonkMediaDataDecoder::IsWaitingMediaResources() {
-  return mDecoder->IsWaitingResources();
-}
-
-bool
-GonkMediaDataDecoder::IsDormantNeeded() {
-  return mDecoder->IsDormantNeeded();
-}
-
-void
-GonkMediaDataDecoder::ReleaseMediaResources() {
-  mDecoder->ReleaseMediaResources();
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/content/media/fmp4/gonk/GonkMediaDataDecoder.h
+++ /dev/null
@@ -1,92 +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(GonkMediaDataDecoder_h_)
-#define GonkMediaDataDecoder_h_
-#include "mp4_demuxer/mp4_demuxer.h"
-#include "mozilla/RefPtr.h"
-#include "MP4Reader.h"
-#include "MediaCodecProxy.h"
-
-namespace mozilla {
-
-// Manage the data flow from inputting encoded data and outputting decode data.
-class GonkDecoderManager {
-public:
-  virtual ~GonkDecoderManager() {}
-
-  // Creates and initializs the GonkDecoder.
-  // Returns nullptr on failure.
-  virtual android::sp<android::MediaCodecProxy> Init(MediaDataDecoderCallback* aCallback) = 0;
-
-  // Produces decoded output, it blocks until output can be produced or a timeout
-  // is expired or until EOS. Returns NS_OK on success, or NS_ERROR_NOT_AVAILABLE
-  // if there's not enough data to produce more output. If this returns a failure
-  // code other than NS_ERROR_NOT_AVAILABLE, an error will be reported to the
-  // MP4Reader.
-  virtual nsresult Input(mp4_demuxer::MP4Sample* aSample) = 0;
-  virtual nsresult Output(int64_t aStreamOffset,
-                          nsAutoPtr<MediaData>& aOutput) = 0;
-
-};
-
-// Samples are decoded using the GonkDecoder (MediaCodec)
-// created by the GonkDecoderManager. This class implements
-// the higher-level logic that drives mapping the Gonk to the async
-// MediaDataDecoder interface. The specifics of decoding the exact stream
-// type are handled by GonkDecoderManager and the GonkDecoder it creates.
-class GonkMediaDataDecoder : public MediaDataDecoder {
-public:
-  GonkMediaDataDecoder(GonkDecoderManager* aDecoderManager,
-                       MediaTaskQueue* aTaskQueue,
-                       MediaDataDecoderCallback* aCallback);
-
-  ~GonkMediaDataDecoder();
-
-  virtual nsresult Init() MOZ_OVERRIDE;
-
-  virtual nsresult Input(mp4_demuxer::MP4Sample* aSample);
-
-  virtual nsresult Flush() MOZ_OVERRIDE;
-
-  virtual nsresult Drain() MOZ_OVERRIDE;
-
-  virtual nsresult Shutdown() MOZ_OVERRIDE;
-
-  virtual bool IsWaitingMediaResources() MOZ_OVERRIDE;
-
-  virtual bool IsDormantNeeded() MOZ_OVERRIDE;
-
-  virtual void ReleaseMediaResources() MOZ_OVERRIDE;
-
-private:
-
-  // Called on the task queue. Inserts the sample into the decoder, and
-  // extracts output if available.
-  void ProcessDecode(mp4_demuxer::MP4Sample* aSample);
-
-  // Called on the task queue. Extracts output if available, and delivers
-  // it to the reader. Called after ProcessDecode() and ProcessDrain().
-  void ProcessOutput();
-
-  // Called on the task queue. Orders the Gonk to drain, and then extracts
-  // all available output.
-  void ProcessDrain();
-
-  RefPtr<MediaTaskQueue> mTaskQueue;
-  MediaDataDecoderCallback* mCallback;
-
-  android::sp<android::MediaCodecProxy> mDecoder;
-  nsAutoPtr<GonkDecoderManager> mManager;
-
-  // The last offset into the media resource that was passed into Input().
-  // This is used to approximate the decoder's position in the media resource.
-  int64_t mLastStreamOffset;
-};
-
-} // namespace mozilla
-
-#endif // GonkMediaDataDecoder_h_
deleted file mode 100644
--- a/content/media/fmp4/gonk/GonkVideoDecoderManager.cpp
+++ /dev/null
@@ -1,456 +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 <OMX_IVCommon.h>
-#include <gui/Surface.h>
-#include <ICrypto.h>
-#include "GonkVideoDecoderManager.h"
-#include "MediaDecoderReader.h"
-#include "ImageContainer.h"
-#include "VideoUtils.h"
-#include "nsThreadUtils.h"
-#include "Layers.h"
-#include "prlog.h"
-#include "stagefright/MediaBuffer.h"
-#include "stagefright/MetaData.h"
-#include "stagefright/MediaErrors.h"
-#include <stagefright/foundation/ADebug.h>
-#include <stagefright/foundation/AMessage.h>
-#include "mp4_demuxer/AnnexB.h"
-
-#define READ_OUTPUT_BUFFER_TIMEOUT_US  3000
-
-#define LOG_TAG "GonkVideoDecoderManager"
-#include <android/log.h>
-#define ALOG(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
-
-#ifdef PR_LOGGING
-PRLogModuleInfo* GetDemuxerLog();
-#define LOG(...) PR_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (__VA_ARGS__))
-#else
-#define LOG(...)
-#endif
-using namespace mozilla::layers;
-using namespace android;
-typedef android::MediaCodecProxy MediaCodecProxy;
-
-namespace mozilla {
-enum {
-  kNotifyCodecReserved = 'core',
-  kNotifyCodecCanceled = 'coca',
-};
-
-GonkVideoDecoderManager::GonkVideoDecoderManager(
-                                  mozilla::layers::ImageContainer* aImageContainer,
-		                  const mp4_demuxer::VideoDecoderConfig& aConfig)
-  : mImageContainer(aImageContainer)
-  , mConfig(aConfig)
-  , mReaderCallback(nullptr)
-  , mColorConverterBufferSize(0)
-{
-  NS_ASSERTION(!NS_IsMainThread(), "Should not be on main thread.");
-  MOZ_ASSERT(mImageContainer);
-  MOZ_COUNT_CTOR(GonkVideoDecoderManager);
-  mVideoWidth  = aConfig.display_width;
-  mVideoHeight = aConfig.display_height;
-  mDisplayWidth = aConfig.display_width;
-  mDisplayHeight = aConfig.display_width;
-  mInfo.mVideo.mHasVideo = true;
-  nsIntSize displaySize(mDisplayWidth, mDisplayHeight);
-  mInfo.mVideo.mDisplay = displaySize;
-
-  nsIntRect pictureRect(0, 0, mVideoWidth, mVideoHeight);
-  nsIntSize frameSize(mVideoWidth, mVideoHeight);
-  mPicture = pictureRect;
-  mInitialFrame = frameSize;
-  mHandler = new MessageHandler(this);
-  mVideoListener = new VideoResourceListener(this);
-
-}
-
-GonkVideoDecoderManager::~GonkVideoDecoderManager()
-{
-  MOZ_COUNT_DTOR(GonkVideoDecoderManager);
-}
-
-android::sp<MediaCodecProxy>
-GonkVideoDecoderManager::Init(MediaDataDecoderCallback* aCallback)
-{
-  nsIntSize displaySize(mDisplayWidth, mDisplayHeight);
-  nsIntRect pictureRect(0, 0, mVideoWidth, mVideoHeight);
-  // Validate the container-reported frame and pictureRect sizes. This ensures
-  // that our video frame creation code doesn't overflow.
-  nsIntSize frameSize(mVideoWidth, mVideoHeight);
-  if (!IsValidVideoRegion(frameSize, pictureRect, displaySize)) {
-    ALOG("It is not a valid region");
-    return nullptr;
-  }
-
-  mReaderCallback = aCallback;
-
-  if (mLooper.get() != nullptr) {
-    return nullptr;
-  }
-  // Create ALooper
-  mLooper = new ALooper;
-  mLooper->setName("GonkVideoDecoderManager");
-  // Register AMessage handler to ALooper.
-  mLooper->registerHandler(mHandler);
-  // Start ALooper thread.
-  if (mLooper->start() != OK) {
-    return nullptr;
-  }
-  mDecoder = MediaCodecProxy::CreateByType(mLooper, "video/avc", false, true, mVideoListener);
-  return mDecoder;
-}
-
-nsresult
-GonkVideoDecoderManager::CreateVideoData(int64_t aStreamOffset, VideoData **v)
-{
-  *v = nullptr;
-  int64_t timeUs;
-  int32_t keyFrame;
-  if (!mVideoBuffer->meta_data()->findInt64(kKeyTime, &timeUs)) {
-    ALOG("Decoder did not return frame time");
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  if (!mVideoBuffer->meta_data()->findInt32(kKeyIsSyncFrame, &keyFrame)) {
-    keyFrame = 0;
-  }
-
-  gfx::IntRect picture = ToIntRect(mPicture);
-  if (mFrameInfo.mWidth != mInitialFrame.width ||
-      mFrameInfo.mHeight != mInitialFrame.height) {
-
-    // Frame size is different from what the container reports. This is legal,
-    // and we will preserve the ratio of the crop rectangle as it
-    // was reported relative to the picture size reported by the container.
-    picture.x = (mPicture.x * mFrameInfo.mWidth) / mInitialFrame.width;
-    picture.y = (mPicture.y * mFrameInfo.mHeight) / mInitialFrame.height;
-    picture.width = (mFrameInfo.mWidth * mPicture.width) / mInitialFrame.width;
-    picture.height = (mFrameInfo.mHeight * mPicture.height) / mInitialFrame.height;
-  }
-
-  if (!(mVideoBuffer != nullptr && mVideoBuffer->size() > 0 && mVideoBuffer->data() != nullptr)) {
-    ALOG("mVideoBuffer is not valid!");
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  uint8_t *yuv420p_buffer = (uint8_t *)mVideoBuffer->data();
-  int32_t stride = mFrameInfo.mStride;
-  int32_t slice_height = mFrameInfo.mSliceHeight;
-
-  // Converts to OMX_COLOR_FormatYUV420Planar
-  if (mFrameInfo.mColorFormat != OMX_COLOR_FormatYUV420Planar) {
-    ARect crop;
-    crop.top = 0;
-    crop.bottom = mFrameInfo.mHeight;
-    crop.left = 0;
-    crop.right = mFrameInfo.mWidth;
-    yuv420p_buffer = GetColorConverterBuffer(mFrameInfo.mWidth, mFrameInfo.mHeight);
-    if (mColorConverter.convertDecoderOutputToI420(mVideoBuffer->data(),
-        mFrameInfo.mWidth, mFrameInfo.mHeight, crop, yuv420p_buffer) != OK) {
-        ReleaseVideoBuffer();
-        ALOG("Color conversion failed!");
-        return NS_ERROR_UNEXPECTED;
-    }
-      stride = mFrameInfo.mWidth;
-      slice_height = mFrameInfo.mHeight;
-  }
-
-  size_t yuv420p_y_size = stride * slice_height;
-  size_t yuv420p_u_size = ((stride + 1) / 2) * ((slice_height + 1) / 2);
-  uint8_t *yuv420p_y = yuv420p_buffer;
-  uint8_t *yuv420p_u = yuv420p_y + yuv420p_y_size;
-  uint8_t *yuv420p_v = yuv420p_u + yuv420p_u_size;
-
-  // This is the approximate byte position in the stream.
-  int64_t pos = aStreamOffset;
-
-  VideoData::YCbCrBuffer b;
-  b.mPlanes[0].mData = yuv420p_y;
-  b.mPlanes[0].mWidth = mFrameInfo.mWidth;
-  b.mPlanes[0].mHeight = mFrameInfo.mHeight;
-  b.mPlanes[0].mStride = stride;
-  b.mPlanes[0].mOffset = 0;
-  b.mPlanes[0].mSkip = 0;
-
-  b.mPlanes[1].mData = yuv420p_u;
-  b.mPlanes[1].mWidth = (mFrameInfo.mWidth + 1) / 2;
-  b.mPlanes[1].mHeight = (mFrameInfo.mHeight + 1) / 2;
-  b.mPlanes[1].mStride = (stride + 1) / 2;
-  b.mPlanes[1].mOffset = 0;
-  b.mPlanes[1].mSkip = 0;
-
-  b.mPlanes[2].mData = yuv420p_v;
-  b.mPlanes[2].mWidth =(mFrameInfo.mWidth + 1) / 2;
-  b.mPlanes[2].mHeight = (mFrameInfo.mHeight + 1) / 2;
-  b.mPlanes[2].mStride = (stride + 1) / 2;
-  b.mPlanes[2].mOffset = 0;
-  b.mPlanes[2].mSkip = 0;
-
-  *v = VideoData::Create(
-      mInfo.mVideo,
-      mImageContainer,
-      pos,
-      timeUs,
-      1, // We don't know the duration.
-      b,
-      keyFrame,
-      -1,
-      picture);
-  ReleaseVideoBuffer();
-  return NS_OK;
-}
-
-bool
-GonkVideoDecoderManager::SetVideoFormat()
-{
-  // read video metadata from MediaCodec
-  sp<AMessage> codecFormat;
-  if (mDecoder->getOutputFormat(&codecFormat) == OK) {
-    AString mime;
-    int32_t width = 0;
-    int32_t height = 0;
-    int32_t stride = 0;
-    int32_t slice_height = 0;
-    int32_t color_format = 0;
-    int32_t crop_left = 0;
-    int32_t crop_top = 0;
-    int32_t crop_right = 0;
-    int32_t crop_bottom = 0;
-    if (!codecFormat->findString("mime", &mime) ||
-        !codecFormat->findInt32("width", &width) ||
-        !codecFormat->findInt32("height", &height) ||
-        !codecFormat->findInt32("stride", &stride) ||
-        !codecFormat->findInt32("slice-height", &slice_height) ||
-        !codecFormat->findInt32("color-format", &color_format) ||
-        !codecFormat->findRect("crop", &crop_left, &crop_top, &crop_right, &crop_bottom)) {
-      ALOG("Failed to find values");
-      return false;
-    }
-    mFrameInfo.mWidth = width;
-    mFrameInfo.mHeight = height;
-    mFrameInfo.mStride = stride;
-    mFrameInfo.mSliceHeight = slice_height;
-    mFrameInfo.mColorFormat = color_format;
-
-    nsIntSize displaySize(width, height);
-    if (!IsValidVideoRegion(mInitialFrame, mPicture, displaySize)) {
-      ALOG("It is not a valid region");
-      return false;
-    }
-  }
-  return true;
-}
-
-// Blocks until decoded sample is produced by the deoder.
-nsresult
-GonkVideoDecoderManager::Output(int64_t aStreamOffset,
-                                nsAutoPtr<MediaData>& aOutData)
-{
-  aOutData = nullptr;
-  status_t err;
-  if (mDecoder == nullptr) {
-    ALOG("Decoder is not inited");
-    return NS_ERROR_UNEXPECTED;
-  }
-  err = mDecoder->Output(&mVideoBuffer, READ_OUTPUT_BUFFER_TIMEOUT_US);
-
-  switch (err) {
-    case OK:
-    {
-      VideoData* data = nullptr;
-      nsresult rv = CreateVideoData(aStreamOffset, &data);
-      // Frame should be non null only when we succeeded.
-      if (rv != NS_OK || data == nullptr){
-        ALOG("Error unexpected in CreateVideoData");
-        return NS_ERROR_UNEXPECTED;
-      }
-      aOutData = data;
-      return NS_OK;
-    }
-    case android::INFO_FORMAT_CHANGED:
-    case android::INFO_OUTPUT_BUFFERS_CHANGED:
-    {
-      // If the format changed, update our cached info.
-      ALOG("Decoder format changed");
-      if (!SetVideoFormat()) {
-        return NS_ERROR_UNEXPECTED;
-      }
-      else
-        return Output(aStreamOffset, aOutData);
-    }
-    case -EAGAIN:
-    {
-      return NS_ERROR_NOT_AVAILABLE;
-    }
-    case android::ERROR_END_OF_STREAM:
-    {
-      ALOG("End of Stream");
-      return NS_ERROR_ABORT;
-    }
-    case -ETIMEDOUT:
-    {
-      ALOG("Timeout. can try again next time");
-      return NS_ERROR_UNEXPECTED;
-    }
-    default:
-    {
-      ALOG("Decoder failed, err=%d", err);
-      return NS_ERROR_UNEXPECTED;
-    }
-  }
-
-  return NS_OK;
-}
-
-void GonkVideoDecoderManager::ReleaseVideoBuffer() {
-  if (mVideoBuffer) {
-    sp<MetaData> metaData = mVideoBuffer->meta_data();
-    int32_t index;
-    metaData->findInt32(android::MediaCodecProxy::kKeyBufferIndex, &index);
-    mVideoBuffer->release();
-    mVideoBuffer = nullptr;
-    mDecoder->releaseOutputBuffer(index);
-  }
-}
-
-nsresult
-GonkVideoDecoderManager::Input(mp4_demuxer::MP4Sample* aSample)
-{
-  // We must prepare samples in AVC Annex B.
-  mp4_demuxer::AnnexB::ConvertSample(aSample, mConfig.annex_b);
-  // Forward sample data to the decoder.
-
-  const uint8_t* data = reinterpret_cast<const uint8_t*>(aSample->data);
-  uint32_t length = aSample->size;
-  if (mDecoder == nullptr) {
-    ALOG("Decoder is not inited");
-    return NS_ERROR_UNEXPECTED;
-  }
-  status_t rv = mDecoder->Input(data, length, aSample->composition_timestamp, 0);
-  return (rv == OK) ? NS_OK : NS_ERROR_FAILURE;
-}
-
-void
-GonkVideoDecoderManager::codecReserved()
-{
-  sp<AMessage> format = new AMessage;
-  // Fixed values
-  format->setString("mime", "video/avc");
-  format->setInt32("width", mVideoWidth);
-  format->setInt32("height", mVideoHeight);
-
-  mDecoder->configure(format, nullptr, nullptr, 0);
-  mDecoder->Prepare();
-  SetVideoFormat();
-
-  if (mHandler != nullptr) {
-    // post kNotifyCodecReserved to MediaCodecReader::mLooper thread.
-    sp<AMessage> notify = new AMessage(kNotifyCodecReserved, mHandler->id());
-    notify->post();
-  }
-}
-
-void
-GonkVideoDecoderManager::codecCanceled()
-{
-  mDecoder = nullptr;
-  if (mHandler != nullptr) {
-    // post kNotifyCodecCanceled to MediaCodecReader::mLooper thread.
-    sp<AMessage> notify = new AMessage(kNotifyCodecCanceled, mHandler->id());
-    notify->post();
-  }
-
-}
-
-// Called on GonkVideoDecoderManager::mLooper thread.
-void
-GonkVideoDecoderManager::onMessageReceived(const sp<AMessage> &aMessage)
-{
-  switch (aMessage->what()) {
-    case kNotifyCodecReserved:
-    {
-      // Our decode may have acquired the hardware resource that it needs
-      // to start. Notify the state machine to resume loading metadata.
-      mReaderCallback->NotifyResourcesStatusChanged();
-      break;
-    }
-
-    case kNotifyCodecCanceled:
-    {
-      mReaderCallback->ReleaseMediaResources();
-      break;
-    }
-
-    default:
-      TRESPASS();
-      break;
-  }
-}
-
-GonkVideoDecoderManager::MessageHandler::MessageHandler(GonkVideoDecoderManager *aManager)
-  : mManager(aManager)
-{
-}
-
-GonkVideoDecoderManager::MessageHandler::~MessageHandler()
-{
-  mManager = nullptr;
-}
-
-void
-GonkVideoDecoderManager::MessageHandler::onMessageReceived(const android::sp<android::AMessage> &aMessage)
-{
-  if (mManager != nullptr) {
-    mManager->onMessageReceived(aMessage);
-  }
-}
-
-GonkVideoDecoderManager::VideoResourceListener::VideoResourceListener(GonkVideoDecoderManager *aManager)
-  : mManager(aManager)
-{
-}
-
-GonkVideoDecoderManager::VideoResourceListener::~VideoResourceListener()
-{
-  mManager = nullptr;
-}
-
-void
-GonkVideoDecoderManager::VideoResourceListener::codecReserved()
-{
-  if (mManager != nullptr) {
-    mManager->codecReserved();
-  }
-}
-
-void
-GonkVideoDecoderManager::VideoResourceListener::codecCanceled()
-{
-  if (mManager != nullptr) {
-    mManager->codecCanceled();
-  }
-}
-
-uint8_t *
-GonkVideoDecoderManager::GetColorConverterBuffer(int32_t aWidth, int32_t aHeight)
-{
-  // Allocate a temporary YUV420Planer buffer.
-  size_t yuv420p_y_size = aWidth * aHeight;
-  size_t yuv420p_u_size = ((aWidth + 1) / 2) * ((aHeight + 1) / 2);
-  size_t yuv420p_v_size = yuv420p_u_size;
-  size_t yuv420p_size = yuv420p_y_size + yuv420p_u_size + yuv420p_v_size;
-  if (mColorConverterBufferSize != yuv420p_size) {
-    mColorConverterBuffer = nullptr; // release the previous buffer first
-    mColorConverterBuffer = new uint8_t[yuv420p_size];
-    mColorConverterBufferSize = yuv420p_size;
-  }
-  return mColorConverterBuffer.get();
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/content/media/fmp4/gonk/GonkVideoDecoderManager.h
+++ /dev/null
@@ -1,125 +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(GonkVideoDecoderManager_h_)
-#define GonkVideoDecoderManager_h_
-
-#include "MP4Reader.h"
-#include "nsRect.h"
-#include "GonkMediaDataDecoder.h"
-#include "mozilla/RefPtr.h"
-#include "I420ColorConverterHelper.h"
-
-using namespace android;
-namespace mozilla {
-
-class GonkVideoDecoderManager : public GonkDecoderManager {
-typedef android::MediaCodecProxy MediaCodecProxy;
-
-public:
-  GonkVideoDecoderManager(mozilla::layers::ImageContainer* aImageContainer,
-		          const mp4_demuxer::VideoDecoderConfig& aConfig);
-
-  ~GonkVideoDecoderManager();
-
-  virtual android::sp<MediaCodecProxy> Init(MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE;
-
-  virtual nsresult Input(mp4_demuxer::MP4Sample* aSample) MOZ_OVERRIDE;
-
-  virtual nsresult Output(int64_t aStreamOffset,
-                          nsAutoPtr<MediaData>& aOutput) MOZ_OVERRIDE;
-
-private:
-  struct FrameInfo
-  {
-    int32_t mWidth = 0;
-    int32_t mHeight = 0;
-    int32_t mStride = 0;
-    int32_t mSliceHeight = 0;
-    int32_t mColorFormat = 0;
-    int32_t mCropLeft = 0;
-    int32_t mCropTop = 0;
-    int32_t mCropRight = 0;
-    int32_t mCropBottom = 0;
-  };
-  class MessageHandler : public android::AHandler
-  {
-  public:
-    MessageHandler(GonkVideoDecoderManager *aManager);
-    ~MessageHandler();
-
-    virtual void onMessageReceived(const android::sp<android::AMessage> &aMessage);
-
-  private:
-    // Forbidden
-    MessageHandler() MOZ_DELETE;
-    MessageHandler(const MessageHandler &rhs) MOZ_DELETE;
-    const MessageHandler &operator=(const MessageHandler &rhs) MOZ_DELETE;
-
-    GonkVideoDecoderManager *mManager;
-  };
-  friend class MessageHandler;
-
-  class VideoResourceListener : public android::MediaCodecProxy::CodecResourceListener
-  {
-  public:
-    VideoResourceListener(GonkVideoDecoderManager *aManager);
-    ~VideoResourceListener();
-
-    virtual void codecReserved() MOZ_OVERRIDE;
-    virtual void codecCanceled() MOZ_OVERRIDE;
-
-  private:
-    // Forbidden
-    VideoResourceListener() MOZ_DELETE;
-    VideoResourceListener(const VideoResourceListener &rhs) MOZ_DELETE;
-    const VideoResourceListener &operator=(const VideoResourceListener &rhs) MOZ_DELETE;
-
-    GonkVideoDecoderManager *mManager;
-  };
-  friend class VideoResourceListener;
-
-  bool SetVideoFormat();
-
-  nsresult CreateVideoData(int64_t aStreamOffset, VideoData** aOutData);
-  void ReleaseVideoBuffer();
-  uint8_t* GetColorConverterBuffer(int32_t aWidth, int32_t aHeight);
-
-  // For codec resource management
-  void codecReserved();
-  void codecCanceled();
-  void onMessageReceived(const sp<AMessage> &aMessage);
-
-  const mp4_demuxer::VideoDecoderConfig& mConfig;
-  uint32_t mVideoWidth;
-  uint32_t mVideoHeight;
-  uint32_t mDisplayWidth;
-  uint32_t mDisplayHeight;
-  nsIntRect mPicture;
-  nsIntSize mInitialFrame;
-
-  android::sp<MediaCodecProxy> mDecoder;
-  nsRefPtr<layers::ImageContainer> mImageContainer;
-  MediaDataDecoderCallback* mCallback;
-
-  android::MediaBuffer* mVideoBuffer;
-
-  MediaDataDecoderCallback*  mReaderCallback;
-  MediaInfo mInfo;
-  android::sp<VideoResourceListener> mVideoListener;
-  android::sp<MessageHandler> mHandler;
-  android::sp<ALooper> mLooper;
-  FrameInfo mFrameInfo;
-
-  // color converter
-  android::I420ColorConverterHelper mColorConverter;
-  nsAutoArrayPtr<uint8_t> mColorConverterBuffer;
-  size_t mColorConverterBufferSize;
-};
-
-} // namespace mozilla
-
-#endif // GonkVideoDecoderManager_h_
deleted file mode 100644
--- a/content/media/fmp4/gonk/moz.build
+++ /dev/null
@@ -1,32 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; 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 += [
-    'GonkAudioDecoderManager.h',
-    'GonkDecoderModule.h',
-    'GonkMediaDataDecoder.h',
-    'GonkVideoDecoderManager.h',
-]
-UNIFIED_SOURCES += [
-    'GonkAudioDecoderManager.cpp',
-    'GonkDecoderModule.cpp',
-    'GonkMediaDataDecoder.cpp',
-    'GonkVideoDecoderManager.cpp',
-]
-LOCAL_INCLUDES += [
-    '/content/media/omx/',
-    '/content/media/omx/mediaresourcemanager',
-]
-include('/ipc/chromium/chromium-config.mozbuild')
-
-FINAL_LIBRARY = 'xul'
-
-FAIL_ON_WARNINGS = True
-
-CXXFLAGS += [
-    '-I%s/%s' % (CONFIG['ANDROID_SOURCE'], d) for d in [
-        'frameworks/native/opengl/include',]
-]
--- a/content/media/fmp4/moz.build
+++ b/content/media/fmp4/moz.build
@@ -63,18 +63,14 @@ if CONFIG['MOZ_APPLEMEDIA']:
   ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 LOCAL_INCLUDES += [
     '../base',
 ]
   
-if CONFIG['ANDROID_VERSION'] >= '18'and CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
-    DEFINES['MOZ_GONK_MEDIACODEC'] = True
-    DIRS += ['gonk']
-
 FINAL_LIBRARY = 'xul'
 
 FAIL_ON_WARNINGS = True
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     DEFINES['NOMINMAX'] = True
--- a/content/media/omx/MediaCodecProxy.cpp
+++ b/content/media/omx/MediaCodecProxy.cpp
@@ -1,25 +1,20 @@
 /* -*- 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 "MediaCodecProxy.h"
+
 #include <string.h>
+
 #include <binder/IPCThreadState.h>
-#include <stagefright/foundation/ABuffer.h>
-#include <stagefright/foundation/ADebug.h>
-#include <stagefright/MetaData.h>
 
-#define LOG_TAG "MediaCodecProxy"
-#include <android/log.h>
-#define ALOG(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
-#define TIMEOUT_DEQUEUE_INPUTBUFFER_MS 1000000ll
 namespace android {
 
 sp<MediaCodecProxy>
 MediaCodecProxy::CreateByType(sp<ALooper> aLooper,
                               const char *aMime,
                               bool aEncoder,
                               bool aAsync,
                               wp<CodecResourceListener> aListener)
@@ -389,110 +384,9 @@ MediaCodecProxy::resourceCanceled()
 
   // Notification
   sp<CodecResourceListener> listener = mListener.promote();
   if (listener != nullptr) {
     listener->codecCanceled();
   }
 }
 
-bool MediaCodecProxy::Prepare()
-{
-
-  status_t err;
-  if (start() != OK) {
-    ALOG("Couldn't start MediaCodec");
-    return false;
-  }
-  if (getInputBuffers(&mInputBuffers) != OK) {
-    ALOG("Couldn't get input buffers from MediaCodec");
-    return false;
-  }
-  if (getOutputBuffers(&mOutputBuffers) != OK) {
-    ALOG("Couldn't get output buffers from MediaCodec");
-    return false;
-  }
-
-  return true;
-}
-
-status_t MediaCodecProxy::Input(const uint8_t* aData, uint32_t aDataSize,
-                                int64_t aTimestampUsecs, uint64_t aflags)
-{
-  if (mCodec == nullptr) {
-    ALOG("MediaCodec has not been inited from input!");
-    return NO_INIT;
-  }
-
-  size_t index;
-  status_t err = dequeueInputBuffer(&index, TIMEOUT_DEQUEUE_INPUTBUFFER_MS);
-  if (err != OK) {
-    ALOG("dequeueInputBuffer returned %d", err);
-    return err;
-  }
-  const sp<ABuffer> &dstBuffer = mInputBuffers.itemAt(index);
-
-  CHECK_LE(aDataSize, dstBuffer->capacity());
-  dstBuffer->setRange(0, aDataSize);
-
-  memcpy(dstBuffer->data(), aData, aDataSize);
-  err = queueInputBuffer(index, 0, dstBuffer->size(), aTimestampUsecs, aflags);
-  if (err != OK) {
-    ALOG("queueInputBuffer returned %d", err);
-    return err;
-  }
-  return err;
-}
-
-status_t MediaCodecProxy::Output(MediaBuffer** aBuffer, int64_t aTimeoutUs)
-{
-
-  if (mCodec == nullptr) {
-    ALOG("MediaCodec has not been inited from output!");
-    return NO_INIT;
-  }
-
-  size_t index = 0;
-  size_t offset = 0;
-  size_t size = 0;
-  int64_t timeUs = 0;
-  uint32_t flags = 0;
-
-  *aBuffer = nullptr;
-
-  status_t err = dequeueOutputBuffer(&index, &offset, &size,
-                                      &timeUs, &flags, aTimeoutUs);
-  if (err != OK) {
-    ALOG("Output returned %d", err);
-    return err;
-  }
-
-  MediaBuffer *buffer;
-
-  buffer = new MediaBuffer(mOutputBuffers.itemAt(index));
-  sp<MetaData> metaData = buffer->meta_data();
-  metaData->setInt32(kKeyBufferIndex, index);
-  metaData->setInt64(kKeyTime, timeUs);
-  buffer->set_range(buffer->range_offset(), size);
-  *aBuffer = buffer;
-  return err;
-}
-
-bool MediaCodecProxy::IsWaitingResources()
-{
-  return mCodec == nullptr;
-}
-
-bool MediaCodecProxy::IsDormantNeeded()
-{
-  return mCodecLooper.get() ? true : false;
-}
-
-void MediaCodecProxy::ReleaseMediaResources()
-{
-  if (mCodec.get()) {
-    mCodec->stop();
-    mCodec->release();
-    mCodec.clear();
-  }
-}
-
 } // namespace android
--- a/content/media/omx/MediaCodecProxy.h
+++ b/content/media/omx/MediaCodecProxy.h
@@ -5,28 +5,22 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MEDIA_CODEC_PROXY_H
 #define MEDIA_CODEC_PROXY_H
 
 #include <nsString.h>
 
 #include <stagefright/MediaCodec.h>
-#include <stagefright/MediaBuffer.h>
 #include <utils/threads.h>
 
 #include "MediaResourceHandler.h"
 
 namespace android {
-// This class is intended to be a proxy for MediaCodec with codec resource
-// management. Basically user can use it like MediaCodec, but need to handle
-// the listener when Codec is reserved for Async case. A good example is
-// MediaCodecReader.cpp. Another useage is to use configure(), Prepare(),
-// Input(), and Output(). It is used in GonkVideoDecoderManager.cpp which
-// doesn't need to handle the buffers for codec.
+
 class MediaCodecProxy : public MediaResourceHandler::ResourceListener
 {
 public:
   /* Codec resource notification listener.
    * All functions are called on the Binder thread.
    */
   struct CodecResourceListener : public virtual RefBase {
     /* The codec resource is reserved and can be granted.
@@ -35,19 +29,16 @@ public:
     virtual void codecReserved() = 0;
     /* The codec resource is not reserved any more.
      * The client should release the resource as soon as possible if the
      * resource is still being held.
      */
     virtual void codecCanceled() = 0;
   };
 
-  enum {
-    kKeyBufferIndex = 'bfin',
-  };
   // Check whether MediaCodec has been allocated.
   bool allocated() const;
 
   // Static MediaCodec methods
   // Only support MediaCodec::CreateByType()
   static sp<MediaCodecProxy> CreateByType(sp<ALooper> aLooper,
                                           const char *aMime,
                                           bool aEncoder,
@@ -108,23 +99,16 @@ public:
 
   status_t getOutputBuffers(Vector<sp<ABuffer>> *aBuffers) const;
 
   // Notification will be posted once there "is something to do", i.e.
   // an input/output buffer has become available, a format change is
   // pending, an error is pending.
   void requestActivityNotification(const sp<AMessage> &aNotify);
 
-  status_t Input(const uint8_t* aData, uint32_t aDataSize,
-                 int64_t aTimestampUsecs, uint64_t flags);
-  status_t Output(MediaBuffer** aBuffer, int64_t aTimeoutUs);
-  bool Prepare();
-  bool IsWaitingResources();
-  bool IsDormantNeeded();
-  void ReleaseMediaResources();
 protected:
   virtual ~MediaCodecProxy();
 
   // MediaResourceHandler::EventListener::resourceReserved()
   virtual void resourceReserved();
   // MediaResourceHandler::EventListener::resourceCanceled()
   virtual void resourceCanceled();
 
@@ -160,17 +144,13 @@ private:
   wp<CodecResourceListener> mListener;
 
   // Media Resource Management
   sp<MediaResourceHandler> mResourceHandler;
 
   // MediaCodec instance
   mutable RWLock mCodecLock;
   sp<MediaCodec> mCodec;
-  //MediaCodec buffers to hold input/output data.
-  Vector<sp<ABuffer> > mInputBuffers;
-  Vector<sp<ABuffer> > mOutputBuffers;
-
 };
 
 } // namespace android
 
 #endif // MEDIA_CODEC_PROXY_H
--- a/media/libstagefright/binding/include/mp4_demuxer/DecoderData.h
+++ b/media/libstagefright/binding/include/mp4_demuxer/DecoderData.h
@@ -92,27 +92,27 @@ public:
   {
   }
 
   int64_t duration;
   uint32_t channel_count;
   uint32_t bits_per_sample;
   uint32_t samples_per_second;
   int8_t frequency_index;
-  int8_t aac_profile;
   mozilla::Vector<uint8_t> extra_data;
   mozilla::Vector<uint8_t> audio_specific_config;
   CryptoTrack crypto;
 
   void Update(stagefright::sp<stagefright::MetaData>& aMetaData,
               const char* aMimeType);
   bool IsValid();
 
 private:
   friend class MP4Demuxer;
+  int8_t aac_profile;
 };
 
 class VideoDecoderConfig : public TrackConfig
 {
 public:
   VideoDecoderConfig() : display_width(0), display_height(0) {}
 
   int32_t display_width;