mirror of
https://github.com/androidx/media.git
synced 2025-05-15 11:39:56 +08:00
Offset SIDX timestamps by presentationTimeOffset
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=199856613
This commit is contained in:
parent
fcb9ca7b81
commit
d6878f152c
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
* IMA: Don't advertise support for video/mpeg ad media, as we don't have an
|
* IMA: Don't advertise support for video/mpeg ad media, as we don't have an
|
||||||
extractor for this ([#4297](https://github.com/google/ExoPlayer/issues/4297)).
|
extractor for this ([#4297](https://github.com/google/ExoPlayer/issues/4297)).
|
||||||
|
* DASH: Fix playback getting stuck when playing representations that have both
|
||||||
|
sidx atoms and non-zero presentationTimeOffset values.
|
||||||
* Mitigate memory leaks when `MediaSource` loads are slow to cancel
|
* Mitigate memory leaks when `MediaSource` loads are slow to cancel
|
||||||
([#4249](https://github.com/google/ExoPlayer/issues/4249)).
|
([#4249](https://github.com/google/ExoPlayer/issues/4249)).
|
||||||
* Fix inconsistent `Player.EventListener` invocations for recursive player state
|
* Fix inconsistent `Player.EventListener` invocations for recursive player state
|
||||||
|
@ -25,12 +25,15 @@ import com.google.android.exoplayer2.source.dash.manifest.RangedUri;
|
|||||||
public final class DashWrappingSegmentIndex implements DashSegmentIndex {
|
public final class DashWrappingSegmentIndex implements DashSegmentIndex {
|
||||||
|
|
||||||
private final ChunkIndex chunkIndex;
|
private final ChunkIndex chunkIndex;
|
||||||
|
private final long timeOffsetUs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param chunkIndex The {@link ChunkIndex} to wrap.
|
* @param chunkIndex The {@link ChunkIndex} to wrap.
|
||||||
|
* @param timeOffsetUs An offset to subtract from the times in the wrapped index, in microseconds.
|
||||||
*/
|
*/
|
||||||
public DashWrappingSegmentIndex(ChunkIndex chunkIndex) {
|
public DashWrappingSegmentIndex(ChunkIndex chunkIndex, long timeOffsetUs) {
|
||||||
this.chunkIndex = chunkIndex;
|
this.chunkIndex = chunkIndex;
|
||||||
|
this.timeOffsetUs = timeOffsetUs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -45,7 +48,7 @@ public final class DashWrappingSegmentIndex implements DashSegmentIndex {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getTimeUs(long segmentNum) {
|
public long getTimeUs(long segmentNum) {
|
||||||
return chunkIndex.timesUs[(int) segmentNum];
|
return chunkIndex.timesUs[(int) segmentNum] - timeOffsetUs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -61,7 +64,7 @@ public final class DashWrappingSegmentIndex implements DashSegmentIndex {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getSegmentNum(long timeUs, long periodDurationUs) {
|
public long getSegmentNum(long timeUs, long periodDurationUs) {
|
||||||
return chunkIndex.getChunkIndex(timeUs);
|
return chunkIndex.getChunkIndex(timeUs + timeOffsetUs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -354,7 +354,10 @@ public class DefaultDashChunkSource implements DashChunkSource {
|
|||||||
if (representationHolder.segmentIndex == null) {
|
if (representationHolder.segmentIndex == null) {
|
||||||
SeekMap seekMap = representationHolder.extractorWrapper.getSeekMap();
|
SeekMap seekMap = representationHolder.extractorWrapper.getSeekMap();
|
||||||
if (seekMap != null) {
|
if (seekMap != null) {
|
||||||
representationHolder.segmentIndex = new DashWrappingSegmentIndex((ChunkIndex) seekMap);
|
representationHolder.segmentIndex =
|
||||||
|
new DashWrappingSegmentIndex(
|
||||||
|
(ChunkIndex) seekMap,
|
||||||
|
representationHolder.representation.presentationTimeOffsetUs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,9 @@ public final class DashDownloader extends SegmentDownloader<DashManifest> {
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
ChunkIndex seekMap = DashUtil.loadChunkIndex(dataSource, trackType, representation);
|
ChunkIndex seekMap = DashUtil.loadChunkIndex(dataSource, trackType, representation);
|
||||||
return seekMap == null ? null : new DashWrappingSegmentIndex(seekMap);
|
return seekMap == null
|
||||||
|
? null
|
||||||
|
: new DashWrappingSegmentIndex(seekMap, representation.presentationTimeOffsetUs);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user