mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
parent
a175ecbff3
commit
b88012f51f
1 changed files with 21 additions and 12 deletions
|
|
@ -835,23 +835,32 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((outputBufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
|
int decodeOnlyIndex = getDecodeOnlyIndex(outputBufferInfo.presentationTimeUs);
|
||||||
if (codecReinitializationState == REINITIALIZATION_STATE_WAIT_END_OF_STREAM) {
|
boolean isEndOfStream = (outputBufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0;
|
||||||
// We're waiting to re-initialize the codec, and have now received all final output buffers.
|
|
||||||
releaseCodec();
|
boolean processedOutputBuffer;
|
||||||
maybeInitCodec();
|
if (isEndOfStream && outputBufferInfo.size == 0) {
|
||||||
} else {
|
// Empty buffer indicating the end of the stream.
|
||||||
outputStreamEnded = true;
|
codec.releaseOutputBuffer(outputIndex, false);
|
||||||
}
|
processedOutputBuffer = true;
|
||||||
return false;
|
} else {
|
||||||
|
processedOutputBuffer = processOutputBuffer(positionUs, elapsedRealtimeUs, codec,
|
||||||
|
outputBuffers[outputIndex], outputBufferInfo, outputIndex, decodeOnlyIndex != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int decodeOnlyIndex = getDecodeOnlyIndex(outputBufferInfo.presentationTimeUs);
|
if (processedOutputBuffer) {
|
||||||
if (processOutputBuffer(positionUs, elapsedRealtimeUs, codec, outputBuffers[outputIndex],
|
|
||||||
outputBufferInfo, outputIndex, decodeOnlyIndex != -1)) {
|
|
||||||
if (decodeOnlyIndex != -1) {
|
if (decodeOnlyIndex != -1) {
|
||||||
decodeOnlyPresentationTimestamps.remove(decodeOnlyIndex);
|
decodeOnlyPresentationTimestamps.remove(decodeOnlyIndex);
|
||||||
}
|
}
|
||||||
|
if (isEndOfStream) {
|
||||||
|
if (codecReinitializationState == REINITIALIZATION_STATE_WAIT_END_OF_STREAM) {
|
||||||
|
// We're waiting to re-initialize the codec, and have now processed all final buffers.
|
||||||
|
releaseCodec();
|
||||||
|
maybeInitCodec();
|
||||||
|
} else {
|
||||||
|
outputStreamEnded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
outputIndex = -1;
|
outputIndex = -1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue