mirror of
https://github.com/samsonjs/media.git
synced 2026-04-19 13:35:47 +00:00
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
This commit is contained in:
parent
f7132a7a73
commit
73220be19b
1 changed files with 4 additions and 3 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue