Commit 35d4cbf9 by hoangtc Committed by Oliver Woodman

Fix a bug that makes ClippingMediaSource not stop in some occasions.

If ClippingMediaSource contains a child MediaSource with embedded metadata
stream, and the embedded stream is being used, it can lead to
ClippingMediaSource not be able to stop after the clipping end point. The
reason being the metadata stream cannot read anymore sample, but it's also not
end of source at that point. This CL fix this by changing the condition to
check if the child stream cannot read anymore sample and it has read past the
clipping end point.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179918038
parent 6f4110f3
...@@ -299,9 +299,10 @@ public final class ClippingMediaPeriod implements MediaPeriod, MediaPeriod.Callb ...@@ -299,9 +299,10 @@ public final class ClippingMediaPeriod implements MediaPeriod, MediaPeriod.Callb
formatHolder.format = format.copyWithGaplessInfo(encoderDelay, encoderPadding); formatHolder.format = format.copyWithGaplessInfo(encoderDelay, encoderPadding);
return C.RESULT_FORMAT_READ; return C.RESULT_FORMAT_READ;
} }
if (endUs != C.TIME_END_OF_SOURCE && ((result == C.RESULT_BUFFER_READ if (endUs != C.TIME_END_OF_SOURCE
&& buffer.timeUs >= endUs) || (result == C.RESULT_NOTHING_READ && ((result == C.RESULT_BUFFER_READ && buffer.timeUs >= endUs)
&& mediaPeriod.getBufferedPositionUs() == C.TIME_END_OF_SOURCE))) { || (result == C.RESULT_NOTHING_READ
&& getBufferedPositionUs() == C.TIME_END_OF_SOURCE))) {
buffer.clear(); buffer.clear();
buffer.setFlags(C.BUFFER_FLAG_END_OF_STREAM); buffer.setFlags(C.BUFFER_FLAG_END_OF_STREAM);
sentEos = true; sentEos = true;
......
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