Bug 1383479 - allow null output buffers when codec is configured with output surface. r=esawin
authorJohn Lin <jolin@mozilla.com>
Thu, 27 Jul 2017 14:37:29 +0800
changeset 420355 59507e1a1b966b45233998db7b9fa5dda2388f77
parent 420354 5f2d7cd7d7acd23049b031a8c06762a06ccce63f
child 420356 381e2273e47eae84f5413bf882ee20e29d3b3d94
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersesawin
bugs1383479
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1383479 - allow null output buffers when codec is configured with output surface. r=esawin It appears that on some devices (e.g., Huawei P10) the video decoder returns null output buffers rather than the common 8 bytes graphic buffer handles. MozReview-Commit-ID: 2Wp7gDuN2pV
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/Codec.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/Codec.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/Codec.java
@@ -259,17 +259,17 @@ import org.mozilla.gecko.gfx.GeckoSurfac
             boolean eos = (info.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0;
             if (DEBUG && eos) {
                 Log.d(LOGTAG, "output EOS");
             }
         }
 
         private boolean isValidBuffer(final int index) {
             try {
-                return mCodec.getOutputBuffer(index) != null;
+                return (mCodec.getOutputBuffer(index) != null) || mRenderToSurface;
             } catch (IllegalStateException e) {
                 if (DEBUG) { Log.e(LOGTAG, "invalid buffer#" + index, e); }
                 return false;
             }
         }
 
         private Sample obtainOutputSample(int index, MediaCodec.BufferInfo info) {
             Sample sample = mSamplePool.obtainOutput(info);