mirror of
https://github.com/samsonjs/media.git
synced 2026-03-30 10:15:48 +00:00
Handle non-empty EoS buffers, for audio
This fixes gapless playback of streams with encoder padding on devices where the decoder could set the end of stream flag on a non-empty final buffer. Issue: #3449 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=192407924
This commit is contained in:
parent
ee8fc74d65
commit
3c78dc22f6
2 changed files with 9 additions and 2 deletions
|
|
@ -41,6 +41,8 @@
|
|||
* Fix an issue where playback of TrueHD streams would get stuck after seeking
|
||||
due to not finding a syncframe
|
||||
((#3845)[https://github.com/google/ExoPlayer/issues/3845]).
|
||||
* Handle non-empty end-of-stream buffers, to fix gapless playback of streams
|
||||
with encoder padding when the decoder returns a non-empty final buffer.
|
||||
* Caching:
|
||||
* Add release method to Cache interface.
|
||||
* Prevent multiple instances of SimpleCache in the same folder.
|
||||
|
|
|
|||
|
|
@ -1027,7 +1027,8 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||
shouldSkipAdaptationWorkaroundOutputBuffer = false;
|
||||
codec.releaseOutputBuffer(outputIndex, false);
|
||||
return true;
|
||||
} else if ((outputBufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
|
||||
} else if (outputBufferInfo.size == 0
|
||||
&& (outputBufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
|
||||
// The dequeued buffer indicates the end of the stream. Process it immediately.
|
||||
processEndOfStream();
|
||||
return false;
|
||||
|
|
@ -1094,8 +1095,12 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||
|
||||
if (processedOutputBuffer) {
|
||||
onProcessedOutputBuffer(outputBufferInfo.presentationTimeUs);
|
||||
boolean isEndOfStream = (outputBufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0;
|
||||
resetOutputBuffer();
|
||||
return true;
|
||||
if (!isEndOfStream) {
|
||||
return true;
|
||||
}
|
||||
processEndOfStream();
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue