Commit 73220be1 by olly Committed by Oliver Woodman

drainOutputBuffer return false on EOS

I can't see how this would ever make a difference, but there's no
point in returning true. Either we've really reached EOS (in which
case outputStreamEnded will be true and the next drainOutputBuffer
will be turned into a no-op) or we've re-initialized the codec (in
which case there wont be anything to drain since we wont have fed
anything to the codec yet).

This change should also prevent the hypothetical NPE described in
issue #2096, although we're unsure how that NPE would occur unless
MediaCodecRenderer has been extended in an unusual way.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140338581
parent f7132a7a
......@@ -479,7 +479,9 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
if (codec != null) {
TraceUtil.beginSection("drainAndFeed");
while (drainOutputBuffer(positionUs, elapsedRealtimeUs)) {}
while (feedInputBuffer()) {}
if (codec != null) {
while (feedInputBuffer()) {}
}
TraceUtil.endSection();
} else if (format != null) {
skipToKeyframeBefore(positionUs);
......@@ -864,7 +866,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
// The dequeued buffer indicates the end of the stream. Process it immediately.
processEndOfStream();
outputIndex = C.INDEX_UNSET;
return true;
return false;
} else {
// The dequeued buffer is a media buffer. Do some initial setup. The buffer will be
// processed by calling processOutputBuffer (possibly multiple times) below.
......@@ -885,7 +887,6 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
if (codecNeedsEosPropagationWorkaround && (inputStreamEnded
|| codecReinitializationState == REINITIALIZATION_STATE_WAIT_END_OF_STREAM)) {
processEndOfStream();
return true;
}
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment