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
--- 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);