Merge "fix AmrInputStream.read() hang"

am: 5b6a02eb8b

Change-Id: I7aff9043ec95d2f41e5d3301b01707f5dff4bef2
This commit is contained in:
Wonsik Kim
2017-10-03 21:18:10 +00:00
committed by android-build-merger

View File

@@ -140,19 +140,15 @@ public final class AmrInputStream extends InputStream {
} }
} }
// now read encoded data from the encoder (blocking, since we just filled up the // now read encoded data from the encoder
// encoder's input with data it should be able to output at least one buffer) int index = mCodec.dequeueOutputBuffer(mInfo, 0);
while (true) { if (index >= 0) {
int index = mCodec.dequeueOutputBuffer(mInfo, -1); mBufIn = mInfo.size;
if (index >= 0) { ByteBuffer out = mCodec.getOutputBuffer(index);
mBufIn = mInfo.size; out.get(mBuf, 0 /* offset */, mBufIn /* length */);
ByteBuffer out = mCodec.getOutputBuffer(index); mCodec.releaseOutputBuffer(index, false /* render */);
out.get(mBuf, 0 /* offset */, mBufIn /* length */); if ((mInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
mCodec.releaseOutputBuffer(index, false /* render */); mSawOutputEOS = true;
if ((mInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
mSawOutputEOS = true;
}
break;
} }
} }
} }