Bug 1345599 - part 2: queue empty buffer when fail to copy input data. r?snorp
MozReview-Commit-ID: 3XkxZDOk6PQ
--- a/mobile/android/base/java/org/mozilla/gecko/media/Codec.java
+++ b/mobile/android/base/java/org/mozilla/gecko/media/Codec.java
@@ -121,21 +121,22 @@ import java.util.concurrent.ConcurrentLi
MediaCodec.CryptoInfo cryptoInfo = sample.cryptoInfo;
if (!sample.isEOS() && sample.buffer != null) {
len = sample.info.size;
ByteBuffer buf = mCodec.getInputBuffer(index);
try {
sample.writeToByteBuffer(buf);
} catch (IOException e) {
e.printStackTrace();
+ len = 0;
}
mSamplePool.recycleInput(sample);
}
- if (cryptoInfo != null) {
+ if (cryptoInfo != null && len > 0) {
mCodec.queueSecureInputBuffer(index, 0, cryptoInfo, pts, flags);
} else {
mCodec.queueInputBuffer(index, 0, len, pts, flags);
}
}
// To avoid input queue flood, request more input samples only when
// there are just a few waiting to be processed.
if (mDequeuedSamples.size() + mInputSamples.size() <= FEW_PENDING_INPUTS) {