Commit 2091aa5c by sr1990 Committed by sanil

Support signalling of last segment number via supplemental descriptor in mpd

parent 835d1f3a
......@@ -42,6 +42,7 @@ import com.google.android.exoplayer2.source.chunk.SingleSampleMediaChunk;
import com.google.android.exoplayer2.source.dash.PlayerEmsgHandler.PlayerTrackEmsgHandler;
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.Descriptor;
import com.google.android.exoplayer2.source.dash.manifest.RangedUri;
import com.google.android.exoplayer2.source.dash.manifest.Representation;
import com.google.android.exoplayer2.trackselection.TrackSelection;
......@@ -325,10 +326,34 @@ public class DefaultDashChunkSource implements DashChunkSource {
return;
}
List<Descriptor> listDescriptors;
Integer lastSegmentNumberSchemeIdUri = Integer.MAX_VALUE;
String sampleMimeType = trackSelection.getFormat(periodIndex).sampleMimeType;
if (sampleMimeType.contains("video") || sampleMimeType.contains("audio")) {
int track_type = sampleMimeType.contains("video")? C.TRACK_TYPE_VIDEO : C.TRACK_TYPE_AUDIO;
if (!manifest.getPeriod(periodIndex).adaptationSets.get(manifest.getPeriod(periodIndex)
.getAdaptationSetIndex(track_type)).supplementalProperties.isEmpty()) {
listDescriptors = manifest.getPeriod(periodIndex).adaptationSets
.get(manifest.getPeriod(periodIndex).getAdaptationSetIndex(track_type))
.supplementalProperties;
for ( Descriptor descriptor: listDescriptors ) {
if (descriptor.schemeIdUri.equalsIgnoreCase
("http://dashif.org/guidelines/last-segment-number")) {
lastSegmentNumberSchemeIdUri = Integer.valueOf(descriptor.value);
}
}
}
}
long firstAvailableSegmentNum =
representationHolder.getFirstAvailableSegmentNum(manifest, periodIndex, nowUnixTimeUs);
long lastAvailableSegmentNum =
representationHolder.getLastAvailableSegmentNum(manifest, periodIndex, nowUnixTimeUs);
Math.min(representationHolder.
getLastAvailableSegmentNum(manifest, periodIndex, nowUnixTimeUs),
lastSegmentNumberSchemeIdUri);
updateLiveEdgeTimeUs(representationHolder, lastAvailableSegmentNum);
......
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