Bug 1340480 - Backout bug 1299105 for causing various regressions. a=jcristau
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 23 Feb 2017 13:26:42 -0500
changeset 367270 b70b7650fa1dcb37d0718853a97822479bc186fb
parent 367269 6bff957177d230950b59c95bc8d126809c71ce39
child 367271 26c625adfe63bc344775dbfee4b4ad935f668b02
push id6967
push userryanvm@gmail.com
push dateThu, 23 Feb 2017 18:33:38 +0000
treeherdermozilla-beta@02a085cba71f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjcristau
bugs1340480, 1299105
milestone52.0
Bug 1340480 - Backout bug 1299105 for causing various regressions. a=jcristau
dom/media/MediaFormatReader.cpp
dom/media/MediaPrefs.h
dom/media/platforms/PlatformDecoderModule.h
dom/media/platforms/android/MediaCodecDataDecoder.cpp
dom/media/platforms/android/MediaCodecDataDecoder.h
dom/media/platforms/android/RemoteDataDecoder.cpp
dom/media/platforms/wrappers/H264Converter.cpp
dom/media/platforms/wrappers/H264Converter.h
mobile/android/app/mobile.js
mobile/android/base/aidl/org/mozilla/gecko/media/ICodec.aidl
mobile/android/base/java/org/mozilla/gecko/media/AsyncCodec.java
mobile/android/base/java/org/mozilla/gecko/media/Codec.java
mobile/android/base/java/org/mozilla/gecko/media/CodecProxy.java
mobile/android/base/java/org/mozilla/gecko/media/JellyBeanAsyncCodec.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareCodecCapabilityUtils.java
modules/libpref/init/all.js
widget/android/GeneratedJNIWrappers.cpp
widget/android/GeneratedJNIWrappers.h
widget/android/fennec/FennecJNIWrappers.cpp
widget/android/fennec/FennecJNIWrappers.h
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -259,20 +259,16 @@ public:
   const char* GetDescriptionName() const override
   {
     return mDecoder->GetDescriptionName();
   }
   void SetSeekThreshold(const media::TimeUnit& aTime) override
   {
     mDecoder->SetSeekThreshold(aTime);
   }
-  bool SupportDecoderRecycling() const override
-  {
-    return mDecoder->SupportDecoderRecycling();
-  }
   void Shutdown() override
   {
     mDecoder->Shutdown();
     mDecoder = nullptr;
     mToken = nullptr;
   }
 
 private:
@@ -1240,49 +1236,39 @@ MediaFormatReader::HandleDemuxedSamples(
     RefPtr<SharedTrackInfo> info = sample->mTrackInfo;
 
     if (info && decoder.mLastStreamSourceID != info->GetID()) {
       if (samplesPending) {
         // Let existing samples complete their decoding. We'll resume later.
         return;
       }
 
-      bool supportRecycling = MediaPrefs::MediaDecoderCheckRecycling() &&
-                              decoder.mDecoder->SupportDecoderRecycling();
       if (decoder.mNextStreamSourceID.isNothing() ||
           decoder.mNextStreamSourceID.ref() != info->GetID()) {
-        if (!supportRecycling) {
-          LOG("%s stream id has changed from:%d to:%d, draining decoder.",
+        LOG("%s stream id has changed from:%d to:%d, draining decoder.",
             TrackTypeToStr(aTrack), decoder.mLastStreamSourceID,
             info->GetID());
-          decoder.mNeedDraining = true;
-          decoder.mNextStreamSourceID = Some(info->GetID());
-          ScheduleUpdate(aTrack);
-          return;
-        }
+        decoder.mNeedDraining = true;
+        decoder.mNextStreamSourceID = Some(info->GetID());
+        ScheduleUpdate(aTrack);
+        return;
       }
 
-      LOG("%s stream id has changed from:%d to:%d.",
+      LOG("%s stream id has changed from:%d to:%d, recreating decoder.",
           TrackTypeToStr(aTrack), decoder.mLastStreamSourceID,
           info->GetID());
       decoder.mLastStreamSourceID = info->GetID();
       decoder.mNextStreamSourceID.reset();
-      if (!supportRecycling) {
-        LOG("Decoder does not support recycling, recreate decoder.");
-        // Reset will clear our array of queued samples. So make a copy now.
-        nsTArray<RefPtr<MediaRawData>> samples{decoder.mQueuedSamples};
-        Reset(aTrack);
-        decoder.ShutdownDecoder();
-        if (sample->mKeyframe) {
-          decoder.mQueuedSamples.AppendElements(Move(samples));
-        }
-      }
-
+      // Reset will clear our array of queued samples. So make a copy now.
+      nsTArray<RefPtr<MediaRawData>> samples{decoder.mQueuedSamples};
+      Reset(aTrack);
+      decoder.ShutdownDecoder();
       decoder.mInfo = info;
       if (sample->mKeyframe) {
+        decoder.mQueuedSamples.AppendElements(Move(samples));
         ScheduleUpdate(aTrack);
       } else {
         TimeInterval time =
           TimeInterval(TimeUnit::FromMicroseconds(sample->mTime),
                        TimeUnit::FromMicroseconds(sample->GetEndTime()));
         InternalSeekTarget seekTarget =
           decoder.mTimeThreshold.refOr(InternalSeekTarget(time, false));
         LOG("Stream change occurred on a non-keyframe. Seeking to:%lld",
--- a/dom/media/MediaPrefs.h
+++ b/dom/media/MediaPrefs.h
@@ -125,17 +125,16 @@ private:
   DECL_MEDIA_PREF("media.wmf.skip-blacklist",                 PDMWMFSkipBlacklist, bool, false);
   DECL_MEDIA_PREF("media.decoder-doctor.wmf-disabled-is-failure", DecoderDoctorWMFDisabledIsFailure, bool, false);
   DECL_MEDIA_PREF("media.wmf.vp9.enabled",                    PDMWMFVP9DecoderEnabled, bool, true);
   DECL_MEDIA_PREF("media.wmf.decoder.thread-count",           PDMWMFThreadCount, int32_t, -1);
 #endif
   DECL_MEDIA_PREF("media.decoder.fuzzing.enabled",            PDMFuzzingEnabled, bool, false);
   DECL_MEDIA_PREF("media.decoder.fuzzing.video-output-minimum-interval-ms", PDMFuzzingInterval, uint32_t, 0);
   DECL_MEDIA_PREF("media.decoder.fuzzing.dont-delay-inputexhausted", PDMFuzzingDelayInputExhausted, bool, true);
-  DECL_MEDIA_PREF("media.decoder.recycle.enabled",            MediaDecoderCheckRecycling, bool, false);
   DECL_MEDIA_PREF("media.gmp.decoder.enabled",                PDMGMPEnabled, bool, true);
   DECL_MEDIA_PREF("media.gmp.decoder.aac",                    GMPAACPreferred, uint32_t, 0);
   DECL_MEDIA_PREF("media.gmp.decoder.h264",                   GMPH264Preferred, uint32_t, 0);
 
   // MediaDecoderStateMachine
   DECL_MEDIA_PREF("media.suspend-bkgnd-video.enabled",        MDSMSuspendBackgroundVideoEnabled, bool, false);
   DECL_MEDIA_PREF("media.suspend-bkgnd-video.delay-ms",       MDSMSuspendBackgroundVideoDelay, AtomicUint32, SUSPEND_BACKGROUND_VIDEO_DELAY_MS);
   DECL_MEDIA_PREF("media.dormant-on-pause-timeout-ms",        DormantOnPauseTimeout, int32_t, 5000);
--- a/dom/media/platforms/PlatformDecoderModule.h
+++ b/dom/media/platforms/PlatformDecoderModule.h
@@ -297,19 +297,13 @@ public:
 
   // Set a hint of seek target time to decoder. Decoder will drop any decoded
   // data which pts is smaller than this value. This threshold needs to be clear
   // after reset decoder.
   // Decoder may not honor this value. However, it'd be better that
   // video decoder implements this API to improve seek performance.
   // Note: it should be called before Input() or after Flush().
   virtual void SetSeekThreshold(const media::TimeUnit& aTime) {}
-
-  // When playing adaptive playback, recreating an Android video decoder will
-  // cause the transition not smooth during resolution change.
-  // Reuse the decoder if the decoder support recycling.
-  // Currently, only Android video decoder will return true.
-  virtual bool SupportDecoderRecycling() const { return false; }
 };
 
 } // namespace mozilla
 
 #endif
--- a/dom/media/platforms/android/MediaCodecDataDecoder.cpp
+++ b/dom/media/platforms/android/MediaCodecDataDecoder.cpp
@@ -118,18 +118,16 @@ public:
                                  presentationTimeUs,
                                  gfx::IntRect(0, 0,
                                               mConfig.mDisplay.width,
                                               mConfig.mDisplay.height));
     INVOKE_CALLBACK(Output, v);
     return NS_OK;
   }
 
-  bool SupportDecoderRecycling() const override { return mIsCodecSupportAdaptivePlayback; }
-
 protected:
   layers::ImageContainer* mImageContainer;
   const VideoInfo& mConfig;
   RefPtr<AndroidSurfaceTexture> mSurfaceTexture;
 };
 
 class AudioDataDecoder : public MediaCodecDataDecoder
 {
@@ -270,28 +268,16 @@ MediaCodecDataDecoder::InitDecoder(Surfa
 {
   mDecoder = CreateDecoder(mMimeType);
   if (!mDecoder) {
     INVOKE_CALLBACK(Error,
                     MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__));
     return NS_ERROR_FAILURE;
   }
 
-  // Check if the video codec supports adaptive playback or not.
-  if (aSurface) {
-    mIsCodecSupportAdaptivePlayback =
-      java::HardwareCodecCapabilityUtils::CheckSupportsAdaptivePlayback(mDecoder,
-        nsCString(TranslateMimeType(mMimeType)));
-    if (mIsCodecSupportAdaptivePlayback) {
-        // TODO: may need to find a way to not use hard code to decide the max w/h.
-        mFormat->SetInteger(MediaFormat::KEY_MAX_WIDTH, 1920);
-        mFormat->SetInteger(MediaFormat::KEY_MAX_HEIGHT, 1080);
-    }
-  }
-
   nsresult rv;
   NS_ENSURE_SUCCESS(rv = mDecoder->Configure(mFormat, aSurface, nullptr, 0), rv);
   NS_ENSURE_SUCCESS(rv = mDecoder->Start(), rv);
 
   NS_ENSURE_SUCCESS(rv = ResetInputBuffers(), rv);
   NS_ENSURE_SUCCESS(rv = ResetOutputBuffers(), rv);
 
   nsCOMPtr<nsIRunnable> r = NewRunnableMethod(this, &MediaCodecDataDecoder::DecoderLoop);
--- a/dom/media/platforms/android/MediaCodecDataDecoder.h
+++ b/dom/media/platforms/android/MediaCodecDataDecoder.h
@@ -114,15 +114,13 @@ protected:
   // Only these members are protected by mMonitor.
   Monitor mMonitor;
 
   ModuleState mState;
 
   SampleQueue mQueue;
   // Durations are stored in microseconds.
   std::deque<media::TimeUnit> mDurations;
-
-  bool mIsCodecSupportAdaptivePlayback = false;
 };
 
 } // namespace mozilla
 
 #endif
--- a/dom/media/platforms/android/RemoteDataDecoder.cpp
+++ b/dom/media/platforms/android/RemoteDataDecoder.cpp
@@ -212,17 +212,17 @@ public:
     mJavaCallbacks = CodecProxy::NativeCallbacks::New();
     JavaCallbacksSupport::AttachNative(mJavaCallbacks,
                                        mozilla::MakeUnique<CallbacksSupport>(this, mCallback));
 
     mJavaDecoder = CodecProxy::Create(mFormat, mSurfaceTexture->JavaSurface(), mJavaCallbacks);
     if (mJavaDecoder == nullptr) {
       return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__);
     }
-    mIsCodecSupportAdaptivePlayback = mJavaDecoder->IsAdaptivePlaybackSupported();
+
     mInputDurations.Clear();
 
     return InitPromise::CreateAndResolve(TrackInfo::kVideoTrack, __func__);
   }
 
   void Flush() override
   {
     mInputDurations.Clear();
@@ -236,18 +236,16 @@ public:
   }
 
   void Input(MediaRawData* aSample) override
   {
     RemoteDataDecoder::Input(aSample);
     mInputDurations.Put(aSample->mDuration);
   }
 
-  bool SupportDecoderRecycling() const override { return mIsCodecSupportAdaptivePlayback; }
-
 private:
   class DurationQueue {
   public:
 
     void Clear()
     {
       mValues.clear();
     }
@@ -272,17 +270,16 @@ private:
   private:
     std::deque<int64_t> mValues;
   };
 
   layers::ImageContainer* mImageContainer;
   const VideoInfo& mConfig;
   RefPtr<AndroidSurfaceTexture> mSurfaceTexture;
   DurationQueue mInputDurations;
-  bool mIsCodecSupportAdaptivePlayback = false;
 };
 
 class RemoteAudioDecoder final : public RemoteDataDecoder
 {
 public:
   RemoteAudioDecoder(const AudioInfo& aConfig,
                    MediaFormat::Param aFormat,
                    MediaDataDecoderCallback* aCallback)
--- a/dom/media/platforms/wrappers/H264Converter.cpp
+++ b/dom/media/platforms/wrappers/H264Converter.cpp
@@ -4,17 +4,16 @@
  * 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 "mozilla/TaskQueue.h"
 
 #include "H264Converter.h"
 #include "ImageContainer.h"
 #include "MediaInfo.h"
-#include "MediaPrefs.h"
 #include "mp4_demuxer/AnnexB.h"
 #include "mp4_demuxer/H264.h"
 
 namespace mozilla
 {
 
 H264Converter::H264Converter(PlatformDecoderModule* aPDM,
                              const CreateDecoderParams& aParams)
@@ -282,24 +281,16 @@ H264Converter::CheckForSPSChange(MediaRa
 {
   RefPtr<MediaByteBuffer> extra_data =
     mp4_demuxer::AnnexB::ExtractExtraData(aSample);
   if (!mp4_demuxer::AnnexB::HasSPS(extra_data) ||
       mp4_demuxer::AnnexB::CompareExtraData(extra_data,
                                             mCurrentConfig.mExtraData)) {
         return NS_OK;
       }
-
-  if (MediaPrefs::MediaDecoderCheckRecycling() &&
-      mDecoder->SupportDecoderRecycling()) {
-    // Do not recreate the decoder, reuse it.
-    UpdateConfigFromExtraData(extra_data);
-    mNeedKeyframe = true;
-    return NS_OK;
-  }
   // The SPS has changed, signal to flush the current decoder and create a
   // new one.
   mDecoder->Flush();
   Shutdown();
   return CreateDecoderAndInit(aSample);
 }
 
 void
--- a/dom/media/platforms/wrappers/H264Converter.h
+++ b/dom/media/platforms/wrappers/H264Converter.h
@@ -34,23 +34,16 @@ public:
   const char* GetDescriptionName() const override
   {
     if (mDecoder) {
       return mDecoder->GetDescriptionName();
     }
     return "H264Converter decoder (pending)";
   }
   void SetSeekThreshold(const media::TimeUnit& aTime) override;
-  bool SupportDecoderRecycling() const override
-  {
-    if (mDecoder) {
-      return mDecoder->SupportDecoderRecycling();
-    }
-    return false;
-  }
 
   nsresult GetLastError() const { return mLastError; }
 
 private:
   // Will create the required MediaDataDecoder if need AVCC and we have a SPS NAL.
   // Returns NS_ERROR_FAILURE if error is permanent and can't be recovered and
   // will set mError accordingly.
   nsresult CreateDecoder(DecoderDoctorDiagnostics* aDiagnostics);
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -611,19 +611,16 @@ pref("media.cache_readahead_limit", 30);
 // Number of video frames we buffer while decoding video.
 // On Android this is decided by a similar value which varies for
 // each OMX decoder |OMX_PARAM_PORTDEFINITIONTYPE::nBufferCountMin|. This
 // number must be less than the OMX equivalent or gecko will think it is
 // chronically starved of video frames. All decoders seen so far have a value
 // of at least 4.
 pref("media.video-queue.default-size", 3);
 
-// Allow to check if the decoder supports recycling only on Fennec nightly build.
-pref("media.decoder.recycle.enabled", true);
-
 // Enable the MediaCodec PlatformDecoderModule by default.
 pref("media.android-media-codec.enabled", true);
 pref("media.android-media-codec.preferred", true);
 // Run decoder in seperate process.
 pref("media.android-remote-codec.enabled", false);
 
 // Enable MSE
 pref("media.mediasource.enabled", true);
--- a/mobile/android/base/aidl/org/mozilla/gecko/media/ICodec.aidl
+++ b/mobile/android/base/aidl/org/mozilla/gecko/media/ICodec.aidl
@@ -9,17 +9,16 @@ import android.os.Bundle;
 import android.view.Surface;
 import org.mozilla.gecko.media.FormatParam;
 import org.mozilla.gecko.media.ICodecCallbacks;
 import org.mozilla.gecko.media.Sample;
 
 interface ICodec {
     void setCallbacks(in ICodecCallbacks callbacks);
     boolean configure(in FormatParam format, inout Surface surface, int flags);
-    boolean isAdaptivePlaybackSupported();
     oneway void start();
     oneway void stop();
     oneway void flush();
     oneway void release();
 
     Sample dequeueInput(int size);
     oneway void queueInput(in Sample sample);
 
--- a/mobile/android/base/java/org/mozilla/gecko/media/AsyncCodec.java
+++ b/mobile/android/base/java/org/mozilla/gecko/media/AsyncCodec.java
@@ -18,17 +18,16 @@ public interface AsyncCodec {
         void onInputBufferAvailable(AsyncCodec codec, int index);
         void onOutputBufferAvailable(AsyncCodec codec, int index, BufferInfo info);
         void onError(AsyncCodec codec, int error);
         void onOutputFormatChanged(AsyncCodec codec, MediaFormat format);
     }
 
     public abstract void setCallbacks(Callbacks callbacks, Handler handler);
     public abstract void configure(MediaFormat format, Surface surface, int flags);
-    public abstract boolean isAdaptivePlaybackSupported(String mimeType);
     public abstract void start();
     public abstract void stop();
     public abstract void flush();
     public abstract void release();
     public abstract ByteBuffer getInputBuffer(int index);
     public abstract ByteBuffer getOutputBuffer(int index);
     public abstract void queueInputBuffer(int index, int offset, int size, long presentationTimeUs, int flags);
     public abstract void releaseOutputBuffer(int index, boolean render);
--- a/mobile/android/base/java/org/mozilla/gecko/media/Codec.java
+++ b/mobile/android/base/java/org/mozilla/gecko/media/Codec.java
@@ -191,18 +191,16 @@ import java.util.concurrent.ConcurrentLi
    }
 
     private volatile ICodecCallbacks mCallbacks;
     private AsyncCodec mCodec;
     private InputProcessor mInputProcessor;
     private volatile boolean mFlushing = false;
     private SamplePool mSamplePool;
     private Queue<Sample> mSentOutputs = new ConcurrentLinkedQueue<>();
-    // Value will be updated after configure called.
-    private volatile boolean mIsAdaptivePlaybackSupported = false;
 
     public synchronized void setCallbacks(ICodecCallbacks callbacks) throws RemoteException {
         mCallbacks = callbacks;
         callbacks.asBinder().linkToDeath(this, 0);
     }
 
     // IBinder.DeathRecipient
     @Override
@@ -234,46 +232,29 @@ import java.util.concurrent.ConcurrentLi
         if (codecName == null) {
             Log.e(LOGTAG, "FAIL: cannot find codec");
             return false;
         }
 
         try {
             AsyncCodec codec = AsyncCodecFactory.create(codecName);
             codec.setCallbacks(new Callbacks(mCallbacks), null);
-
-            // Video decoder should config with adaptive playback capability.
-            if (surface != null) {
-                mIsAdaptivePlaybackSupported = codec.isAdaptivePlaybackSupported(
-                                                   fmt.getString(MediaFormat.KEY_MIME));
-                if (mIsAdaptivePlaybackSupported) {
-                    if (DEBUG) Log.d(LOGTAG, "codec supports adaptive playback  = " + mIsAdaptivePlaybackSupported);
-                    // TODO: may need to find a way to not use hard code to decide the max w/h.
-                    fmt.setInteger(MediaFormat.KEY_MAX_WIDTH, 1920);
-                    fmt.setInteger(MediaFormat.KEY_MAX_HEIGHT, 1080);
-                }
-            }
             codec.configure(fmt, surface, flags);
             mCodec = codec;
             mInputProcessor = new InputProcessor();
             mSamplePool = new SamplePool(codecName);
             if (DEBUG) Log.d(LOGTAG, codec.toString() + " created");
             return true;
         } catch (Exception e) {
             if (DEBUG) Log.d(LOGTAG, "FAIL: cannot create codec -- " + codecName);
             e.printStackTrace();
             return false;
         }
     }
 
-    @Override
-    public synchronized boolean isAdaptivePlaybackSupported() {
-        return mIsAdaptivePlaybackSupported;
-    }
-
     private void releaseCodec() {
         mInputProcessor.reset();
         try {
             mCodec.release();
         } catch (Exception e) {
             reportError(Error.FATAL, e);
         }
         mCodec = null;
--- a/mobile/android/base/java/org/mozilla/gecko/media/CodecProxy.java
+++ b/mobile/android/base/java/org/mozilla/gecko/media/CodecProxy.java
@@ -118,31 +118,16 @@ public final class CodecProxy {
             return true;
         } catch (RemoteException e) {
             e.printStackTrace();
             return false;
         }
     }
 
     @WrapForJNI
-    public synchronized boolean isAdaptivePlaybackSupported()
-    {
-        if (mRemote == null) {
-            Log.e(LOGTAG, "cannot check isAdaptivePlaybackSupported with an ended codec");
-            return false;
-        }
-        try {
-            return mRemote.isAdaptivePlaybackSupported();
-        } catch (RemoteException e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    @WrapForJNI
     public synchronized boolean input(ByteBuffer bytes, BufferInfo info, CryptoInfo cryptoInfo) {
         if (mRemote == null) {
             Log.e(LOGTAG, "cannot send input to an ended codec");
             return false;
         }
 
         try {
             Sample sample = (info.flags == MediaCodec.BUFFER_FLAG_END_OF_STREAM) ?
--- a/mobile/android/base/java/org/mozilla/gecko/media/JellyBeanAsyncCodec.java
+++ b/mobile/android/base/java/org/mozilla/gecko/media/JellyBeanAsyncCodec.java
@@ -1,16 +1,14 @@
 /* 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/. */
 
 package org.mozilla.gecko.media;
 
-import org.mozilla.gecko.util.HardwareCodecCapabilityUtils;
-
 import android.media.MediaCodec;
 import android.media.MediaFormat;
 import android.os.Handler;
 import android.os.HandlerThread;
 import android.os.Looper;
 import android.os.Message;
 import android.util.Log;
 import android.view.Surface;
@@ -297,21 +295,16 @@ final class JellyBeanAsyncCodec implemen
 
     @Override
     public void configure(MediaFormat format, Surface surface, int flags) {
         assertCallbacks();
 
         mCodec.configure(format, surface, null, flags);
     }
 
-    @Override
-    public boolean isAdaptivePlaybackSupported(String mimeType) {
-        return HardwareCodecCapabilityUtils.checkSupportsAdaptivePlayback(mCodec, mimeType);
-    }
-
     private void assertCallbacks() {
         if (mCallbackSender == null) {
             throw new IllegalStateException(LOGTAG + ": callback must be supplied with setCallbacks().");
         }
     }
 
     @Override
     public void start() {
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareCodecCapabilityUtils.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareCodecCapabilityUtils.java
@@ -4,17 +4,16 @@
  *    * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
 package org.mozilla.gecko.util;
 
 import org.mozilla.gecko.annotation.WrapForJNI;
 import org.mozilla.gecko.AppConstants.Versions;
 
-import android.media.MediaCodec;
 import android.media.MediaCodecInfo;
 import android.media.MediaCodecInfo.CodecCapabilities;
 import android.media.MediaCodecList;
 import android.util.Log;
 
 public final class HardwareCodecCapabilityUtils {
   private static final String LOGTAG = "GeckoHardwareCodecCapabilityUtils";
 
@@ -49,35 +48,16 @@ public final class HardwareCodecCapabili
         if (mimeType.equals(aMimeType)) {
           return true;
         }
       }
     }
     return false;
   }
 
-  @WrapForJNI
-  public static boolean checkSupportsAdaptivePlayback(MediaCodec aCodec, String aMimeType) {
-      // isFeatureSupported supported on API level >= 19.
-      if (!Versions.feature19Plus) {
-          return false;
-      }
-
-      try {
-          MediaCodecInfo info = aCodec.getCodecInfo();
-          MediaCodecInfo.CodecCapabilities capabilities = info.getCapabilitiesForType(aMimeType);
-          return capabilities != null &&
-                 capabilities.isFeatureSupported(
-                     MediaCodecInfo.CodecCapabilities.FEATURE_AdaptivePlayback);
-      } catch (IllegalArgumentException e) {
-            Log.e(LOGTAG, "Retrieve codec information failed", e);
-      }
-      return false;
-  }
-
   public static boolean getHWEncoderCapability() {
     if (Versions.feature20Plus) {
       for (int i = 0; i < MediaCodecList.getCodecCount(); ++i) {
         MediaCodecInfo info = MediaCodecList.getCodecInfoAt(i);
         if (!info.isEncoder()) {
           continue;
         }
         String name = null;
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -595,19 +595,16 @@ pref("media.video-queue.default-size", 1
 
 // The maximum number of queued frames to send to the compositor.
 // By default, send all of them.
 pref("media.video-queue.send-to-compositor-size", 9999);
 
 // Whether to disable the video stats to prevent fingerprinting
 pref("media.video_stats.enabled", true);
 
-// Whether to check the decoder supports recycling.
-pref("media.decoder.recycle.enabled", false);
-
 // Weather we allow AMD switchable graphics
 pref("layers.amd-switchable-gfx.enabled", true);
 
 // Whether to use async panning and zooming
 pref("layers.async-pan-zoom.enabled", true);
 
 // Whether to enable event region building during painting
 pref("layout.event-regions.enabled", false);
--- a/widget/android/GeneratedJNIWrappers.cpp
+++ b/widget/android/GeneratedJNIWrappers.cpp
@@ -1748,24 +1748,16 @@ const char HardwareCodecCapabilityUtils:
 constexpr char HardwareCodecCapabilityUtils::HasHWVP9_t::name[];
 constexpr char HardwareCodecCapabilityUtils::HasHWVP9_t::signature[];
 
 auto HardwareCodecCapabilityUtils::HasHWVP9() -> bool
 {
     return mozilla::jni::Method<HasHWVP9_t>::Call(HardwareCodecCapabilityUtils::Context(), nullptr);
 }
 
-constexpr char HardwareCodecCapabilityUtils::CheckSupportsAdaptivePlayback_t::name[];
-constexpr char HardwareCodecCapabilityUtils::CheckSupportsAdaptivePlayback_t::signature[];
-
-auto HardwareCodecCapabilityUtils::CheckSupportsAdaptivePlayback(mozilla::jni::Object::Param a0, mozilla::jni::String::Param a1) -> bool
-{
-    return mozilla::jni::Method<CheckSupportsAdaptivePlayback_t>::Call(HardwareCodecCapabilityUtils::Context(), nullptr, a0, a1);
-}
-
 constexpr char HardwareCodecCapabilityUtils::FindDecoderCodecInfoForMimeType_t::name[];
 constexpr char HardwareCodecCapabilityUtils::FindDecoderCodecInfoForMimeType_t::signature[];
 
 auto HardwareCodecCapabilityUtils::FindDecoderCodecInfoForMimeType(mozilla::jni::String::Param a0) -> bool
 {
     return mozilla::jni::Method<FindDecoderCodecInfoForMimeType_t>::Call(HardwareCodecCapabilityUtils::Context(), nullptr, a0);
 }
 
--- a/widget/android/GeneratedJNIWrappers.h
+++ b/widget/android/GeneratedJNIWrappers.h
@@ -4828,37 +4828,16 @@ public:
         static const mozilla::jni::CallingThread callingThread =
                 mozilla::jni::CallingThread::ANY;
         static const mozilla::jni::DispatchTarget dispatchTarget =
                 mozilla::jni::DispatchTarget::CURRENT;
     };
 
     static auto HasHWVP9() -> bool;
 
-    struct CheckSupportsAdaptivePlayback_t {
-        typedef HardwareCodecCapabilityUtils Owner;
-        typedef bool ReturnType;
-        typedef bool SetterType;
-        typedef mozilla::jni::Args<
-                mozilla::jni::Object::Param,
-                mozilla::jni::String::Param> Args;
-        static constexpr char name[] = "checkSupportsAdaptivePlayback";
-        static constexpr char signature[] =
-                "(Landroid/media/MediaCodec;Ljava/lang/String;)Z";
-        static const bool isStatic = true;
-        static const mozilla::jni::ExceptionMode exceptionMode =
-                mozilla::jni::ExceptionMode::ABORT;
-        static const mozilla::jni::CallingThread callingThread =
-                mozilla::jni::CallingThread::ANY;
-        static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::CURRENT;
-    };
-
-    static auto CheckSupportsAdaptivePlayback(mozilla::jni::Object::Param, mozilla::jni::String::Param) -> bool;
-
     struct FindDecoderCodecInfoForMimeType_t {
         typedef HardwareCodecCapabilityUtils Owner;
         typedef bool ReturnType;
         typedef bool SetterType;
         typedef mozilla::jni::Args<
                 mozilla::jni::String::Param> Args;
         static constexpr char name[] = "findDecoderCodecInfoForMimeType";
         static constexpr char signature[] =
--- a/widget/android/fennec/FennecJNIWrappers.cpp
+++ b/widget/android/fennec/FennecJNIWrappers.cpp
@@ -209,24 +209,16 @@ auto CodecProxy::Flush() const -> bool
 constexpr char CodecProxy::Input_t::name[];
 constexpr char CodecProxy::Input_t::signature[];
 
 auto CodecProxy::Input(mozilla::jni::ByteBuffer::Param a0, mozilla::jni::Object::Param a1, mozilla::jni::Object::Param a2) const -> bool
 {
     return mozilla::jni::Method<Input_t>::Call(CodecProxy::mCtx, nullptr, a0, a1, a2);
 }
 
-constexpr char CodecProxy::IsAdaptivePlaybackSupported_t::name[];
-constexpr char CodecProxy::IsAdaptivePlaybackSupported_t::signature[];
-
-auto CodecProxy::IsAdaptivePlaybackSupported() const -> bool
-{
-    return mozilla::jni::Method<IsAdaptivePlaybackSupported_t>::Call(CodecProxy::mCtx, nullptr);
-}
-
 constexpr char CodecProxy::Release_t::name[];
 constexpr char CodecProxy::Release_t::signature[];
 
 auto CodecProxy::Release() const -> bool
 {
     return mozilla::jni::Method<Release_t>::Call(CodecProxy::mCtx, nullptr);
 }
 
--- a/widget/android/fennec/FennecJNIWrappers.h
+++ b/widget/android/fennec/FennecJNIWrappers.h
@@ -773,35 +773,16 @@ public:
         static const mozilla::jni::CallingThread callingThread =
                 mozilla::jni::CallingThread::ANY;
         static const mozilla::jni::DispatchTarget dispatchTarget =
                 mozilla::jni::DispatchTarget::CURRENT;
     };
 
     auto Input(mozilla::jni::ByteBuffer::Param, mozilla::jni::Object::Param, mozilla::jni::Object::Param) const -> bool;
 
-    struct IsAdaptivePlaybackSupported_t {
-        typedef CodecProxy Owner;
-        typedef bool ReturnType;
-        typedef bool SetterType;
-        typedef mozilla::jni::Args<> Args;
-        static constexpr char name[] = "isAdaptivePlaybackSupported";
-        static constexpr char signature[] =
-                "()Z";
-        static const bool isStatic = false;
-        static const mozilla::jni::ExceptionMode exceptionMode =
-                mozilla::jni::ExceptionMode::ABORT;
-        static const mozilla::jni::CallingThread callingThread =
-                mozilla::jni::CallingThread::ANY;
-        static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::CURRENT;
-    };
-
-    auto IsAdaptivePlaybackSupported() const -> bool;
-
     struct Release_t {
         typedef CodecProxy Owner;
         typedef bool ReturnType;
         typedef bool SetterType;
         typedef mozilla::jni::Args<> Args;
         static constexpr char name[] = "release";
         static constexpr char signature[] =
                 "()Z";