diff --git a/library/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java b/library/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java index ca06a006190..440451c1831 100644 --- a/library/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java +++ b/library/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java @@ -479,7 +479,9 @@ public void render(long positionUs, long elapsedRealtimeUs) throws ExoPlaybackEx 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 @@ private boolean drainOutputBuffer(long positionUs, long elapsedRealtimeUs) // 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 @@ private boolean drainOutputBuffer(long positionUs, long elapsedRealtimeUs) if (codecNeedsEosPropagationWorkaround && (inputStreamEnded || codecReinitializationState == REINITIALIZATION_STATE_WAIT_END_OF_STREAM)) { processEndOfStream(); - return true; } return false; }