Commit 775983c3 by hschlueter Committed by tonihei

Flip input buffer even if the end of stream is reached.

Sometimes the empty end of stream buffer has a non-zero
data limit. Calling flip first, resets the limit to the
position which is zero in these cases.

PiperOrigin-RevId: 413156455
parent 5694a07a
...@@ -197,13 +197,13 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -197,13 +197,13 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
int result = readSource(getFormatHolder(), samplePipelineInputBuffer, /* readFlags= */ 0); int result = readSource(getFormatHolder(), samplePipelineInputBuffer, /* readFlags= */ 0);
switch (result) { switch (result) {
case C.RESULT_BUFFER_READ: case C.RESULT_BUFFER_READ:
samplePipelineInputBuffer.flip();
if (samplePipelineInputBuffer.isEndOfStream()) { if (samplePipelineInputBuffer.isEndOfStream()) {
samplePipeline.queueInputBuffer(); samplePipeline.queueInputBuffer();
return false; return false;
} }
mediaClock.updateTimeForTrackType(getTrackType(), samplePipelineInputBuffer.timeUs); mediaClock.updateTimeForTrackType(getTrackType(), samplePipelineInputBuffer.timeUs);
samplePipelineInputBuffer.timeUs -= streamOffsetUs; samplePipelineInputBuffer.timeUs -= streamOffsetUs;
samplePipelineInputBuffer.flip();
checkStateNotNull(samplePipelineInputBuffer.data); checkStateNotNull(samplePipelineInputBuffer.data);
maybeQueueSampleToPipeline(samplePipelineInputBuffer); maybeQueueSampleToPipeline(samplePipelineInputBuffer);
return true; return true;
......
...@@ -299,12 +299,6 @@ sample: ...@@ -299,12 +299,6 @@ sample:
isKeyFrame = false isKeyFrame = false
presentationTimeUs = 734083 presentationTimeUs = 734083
sample: sample:
trackIndex = 0
dataHashCode = 820561200
size = 1252
isKeyFrame = true
presentationTimeUs = 201521
sample:
trackIndex = 1 trackIndex = 1
dataHashCode = -1554795381 dataHashCode = -1554795381
size = 205 size = 205
......
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