mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Exclude text streams from duration calculations
Issue: #4029 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=202912333
This commit is contained in:
parent
1ee36101f6
commit
c23910ad3a
2 changed files with 21 additions and 1 deletions
|
|
@ -32,6 +32,8 @@
|
||||||
* Error handling:
|
* Error handling:
|
||||||
* Allow configuration of the Loader retry delay
|
* Allow configuration of the Loader retry delay
|
||||||
([#3370](https://github.com/google/ExoPlayer/issues/3370)).
|
([#3370](https://github.com/google/ExoPlayer/issues/3370)).
|
||||||
|
* DASH: Exclude text streams from duration calculations
|
||||||
|
([#4029](https://github.com/google/ExoPlayer/issues/4029)).
|
||||||
* HLS:
|
* HLS:
|
||||||
* Pass HTTP response headers to `HlsExtractorFactory.createExtractor`.
|
* Pass HTTP response headers to `HlsExtractorFactory.createExtractor`.
|
||||||
* Add support for EXT-X-INDEPENDENT-SEGMENTS in the master playlist.
|
* Add support for EXT-X-INDEPENDENT-SEGMENTS in the master playlist.
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ import com.google.android.exoplayer2.source.MediaSourceEventListener.EventDispat
|
||||||
import com.google.android.exoplayer2.source.SequenceableLoader;
|
import com.google.android.exoplayer2.source.SequenceableLoader;
|
||||||
import com.google.android.exoplayer2.source.ads.AdsMediaSource;
|
import com.google.android.exoplayer2.source.ads.AdsMediaSource;
|
||||||
import com.google.android.exoplayer2.source.dash.PlayerEmsgHandler.PlayerEmsgCallback;
|
import com.google.android.exoplayer2.source.dash.PlayerEmsgHandler.PlayerEmsgCallback;
|
||||||
|
import com.google.android.exoplayer2.source.dash.manifest.AdaptationSet;
|
||||||
import com.google.android.exoplayer2.source.dash.manifest.DashManifest;
|
import com.google.android.exoplayer2.source.dash.manifest.DashManifest;
|
||||||
import com.google.android.exoplayer2.source.dash.manifest.DashManifestParser;
|
import com.google.android.exoplayer2.source.dash.manifest.DashManifestParser;
|
||||||
import com.google.android.exoplayer2.source.dash.manifest.UtcTimingElement;
|
import com.google.android.exoplayer2.source.dash.manifest.UtcTimingElement;
|
||||||
|
|
@ -985,8 +986,25 @@ public final class DashMediaSource extends BaseMediaSource {
|
||||||
long availableEndTimeUs = Long.MAX_VALUE;
|
long availableEndTimeUs = Long.MAX_VALUE;
|
||||||
boolean isIndexExplicit = false;
|
boolean isIndexExplicit = false;
|
||||||
boolean seenEmptyIndex = false;
|
boolean seenEmptyIndex = false;
|
||||||
|
|
||||||
|
boolean haveAudioVideoAdaptationSets = false;
|
||||||
for (int i = 0; i < adaptationSetCount; i++) {
|
for (int i = 0; i < adaptationSetCount; i++) {
|
||||||
DashSegmentIndex index = period.adaptationSets.get(i).representations.get(0).getIndex();
|
int type = period.adaptationSets.get(i).type;
|
||||||
|
if (type == C.TRACK_TYPE_AUDIO || type == C.TRACK_TYPE_VIDEO) {
|
||||||
|
haveAudioVideoAdaptationSets = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < adaptationSetCount; i++) {
|
||||||
|
AdaptationSet adaptationSet = period.adaptationSets.get(i);
|
||||||
|
// Exclude text adaptation sets from duration calculations, if we have at least one audio
|
||||||
|
// or video adaptation set. See: https://github.com/google/ExoPlayer/issues/4029
|
||||||
|
if (haveAudioVideoAdaptationSets && adaptationSet.type == C.TRACK_TYPE_TEXT) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
DashSegmentIndex index = adaptationSet.representations.get(0).getIndex();
|
||||||
if (index == null) {
|
if (index == null) {
|
||||||
return new PeriodSeekInfo(true, 0, durationUs);
|
return new PeriodSeekInfo(true, 0, durationUs);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue