mirror of
https://github.com/samsonjs/media.git
synced 2026-03-27 09:45:47 +00:00
Support clip end greater than the child's duration
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=164577001
This commit is contained in:
parent
e45345e21b
commit
24bf2aa0e2
1 changed files with 9 additions and 3 deletions
|
|
@ -47,7 +47,9 @@ public final class ClippingMediaSource implements MediaSource, MediaSource.Liste
|
|||
* start providing samples, in microseconds.
|
||||
* @param endPositionUs The end position within {@code mediaSource}'s timeline at which to stop
|
||||
* providing samples, in microseconds. Specify {@link C#TIME_END_OF_SOURCE} to provide samples
|
||||
* from the specified start point up to the end of the source.
|
||||
* from the specified start point up to the end of the source. Specifying a position that
|
||||
* exceeds the {@code mediaSource}'s duration will also result in the end of the source not
|
||||
* being clipped.
|
||||
*/
|
||||
public ClippingMediaSource(MediaSource mediaSource, long startPositionUs, long endPositionUs) {
|
||||
this(mediaSource, startPositionUs, endPositionUs, true);
|
||||
|
|
@ -65,7 +67,9 @@ public final class ClippingMediaSource implements MediaSource, MediaSource.Liste
|
|||
* start providing samples, in microseconds.
|
||||
* @param endPositionUs The end position within {@code mediaSource}'s timeline at which to stop
|
||||
* providing samples, in microseconds. Specify {@link C#TIME_END_OF_SOURCE} to provide samples
|
||||
* from the specified start point up to the end of the source.
|
||||
* from the specified start point up to the end of the source. Specifying a position that
|
||||
* exceeds the {@code mediaSource}'s duration will also result in the end of the source not
|
||||
* being clipped.
|
||||
* @param enableInitialDiscontinuity Whether the initial discontinuity should be enabled.
|
||||
*/
|
||||
public ClippingMediaSource(MediaSource mediaSource, long startPositionUs, long endPositionUs,
|
||||
|
|
@ -148,8 +152,10 @@ public final class ClippingMediaSource implements MediaSource, MediaSource.Liste
|
|||
Assertions.checkArgument(!window.isDynamic);
|
||||
long resolvedEndUs = endUs == C.TIME_END_OF_SOURCE ? window.durationUs : endUs;
|
||||
if (window.durationUs != C.TIME_UNSET) {
|
||||
if (resolvedEndUs > window.durationUs) {
|
||||
resolvedEndUs = window.durationUs;
|
||||
}
|
||||
Assertions.checkArgument(startUs == 0 || window.isSeekable);
|
||||
Assertions.checkArgument(resolvedEndUs <= window.durationUs);
|
||||
Assertions.checkArgument(startUs <= resolvedEndUs);
|
||||
}
|
||||
Period period = timeline.getPeriod(0, new Period());
|
||||
|
|
|
|||
Loading…
Reference in a new issue