Merge pull request #487 from vishnuchilakala:allow_unsigned_int_for_adaptation_set_id
PiperOrigin-RevId: 544601945
This commit is contained in:
commit
9513f2c551
@ -20,7 +20,6 @@ import static java.lang.annotation.ElementType.TYPE_USE;
|
||||
|
||||
import android.util.Pair;
|
||||
import android.util.SparseArray;
|
||||
import android.util.SparseIntArray;
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.media3.common.C;
|
||||
@ -58,6 +57,7 @@ import androidx.media3.exoplayer.upstream.Allocator;
|
||||
import androidx.media3.exoplayer.upstream.CmcdConfiguration;
|
||||
import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy;
|
||||
import androidx.media3.exoplayer.upstream.LoaderErrorThrower;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.primitives.Ints;
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Documented;
|
||||
@ -66,6 +66,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
@ -550,7 +551,8 @@ import java.util.regex.Pattern;
|
||||
*/
|
||||
private static int[][] getGroupedAdaptationSetIndices(List<AdaptationSet> adaptationSets) {
|
||||
int adaptationSetCount = adaptationSets.size();
|
||||
SparseIntArray adaptationSetIdToIndex = new SparseIntArray(adaptationSetCount);
|
||||
HashMap<Long, Integer> adaptationSetIdToIndex =
|
||||
Maps.newHashMapWithExpectedSize(adaptationSetCount);
|
||||
List<List<Integer>> adaptationSetGroupedIndices = new ArrayList<>(adaptationSetCount);
|
||||
SparseArray<List<Integer>> adaptationSetIndexToGroupedIndices =
|
||||
new SparseArray<>(adaptationSetCount);
|
||||
@ -578,10 +580,9 @@ import java.util.regex.Pattern;
|
||||
trickPlayProperty = findTrickPlayProperty(adaptationSet.supplementalProperties);
|
||||
}
|
||||
if (trickPlayProperty != null) {
|
||||
int mainAdaptationSetId = Integer.parseInt(trickPlayProperty.value);
|
||||
int mainAdaptationSetIndex =
|
||||
adaptationSetIdToIndex.get(mainAdaptationSetId, /* valueIfKeyNotFound= */ -1);
|
||||
if (mainAdaptationSetIndex != -1) {
|
||||
long mainAdaptationSetId = Long.parseLong(trickPlayProperty.value);
|
||||
@Nullable Integer mainAdaptationSetIndex = adaptationSetIdToIndex.get(mainAdaptationSetId);
|
||||
if (mainAdaptationSetIndex != null) {
|
||||
mergedGroupIndex = mainAdaptationSetIndex;
|
||||
}
|
||||
}
|
||||
@ -595,11 +596,11 @@ import java.util.regex.Pattern;
|
||||
if (adaptationSetSwitchingProperty != null) {
|
||||
String[] otherAdaptationSetIds = Util.split(adaptationSetSwitchingProperty.value, ",");
|
||||
for (String adaptationSetId : otherAdaptationSetIds) {
|
||||
int otherAdaptationSetId =
|
||||
adaptationSetIdToIndex.get(
|
||||
Integer.parseInt(adaptationSetId), /* valueIfKeyNotFound= */ -1);
|
||||
if (otherAdaptationSetId != -1) {
|
||||
mergedGroupIndex = min(mergedGroupIndex, otherAdaptationSetId);
|
||||
@Nullable
|
||||
Integer otherAdaptationSetIndex =
|
||||
adaptationSetIdToIndex.get(Long.parseLong(adaptationSetId));
|
||||
if (otherAdaptationSetIndex != null) {
|
||||
mergedGroupIndex = min(mergedGroupIndex, otherAdaptationSetIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -683,7 +684,7 @@ import java.util.regex.Pattern;
|
||||
AdaptationSet firstAdaptationSet = adaptationSets.get(adaptationSetIndices[0]);
|
||||
String trackGroupId =
|
||||
firstAdaptationSet.id != AdaptationSet.ID_UNSET
|
||||
? Integer.toString(firstAdaptationSet.id)
|
||||
? Long.toString(firstAdaptationSet.id)
|
||||
: ("unset:" + i);
|
||||
int primaryTrackGroupIndex = trackGroupCount++;
|
||||
int eventMessageTrackGroupIndex =
|
||||
|
@ -25,13 +25,13 @@ import java.util.List;
|
||||
public class AdaptationSet {
|
||||
|
||||
/** Value of {@link #id} indicating no value is set.= */
|
||||
public static final int ID_UNSET = -1;
|
||||
public static final long ID_UNSET = -1;
|
||||
|
||||
/**
|
||||
* A non-negative identifier for the adaptation set that's unique in the scope of its containing
|
||||
* period, or {@link #ID_UNSET} if not specified.
|
||||
*/
|
||||
public final int id;
|
||||
public final long id;
|
||||
|
||||
/** The {@link C.TrackType track type} of the adaptation set. */
|
||||
public final @C.TrackType int type;
|
||||
@ -58,7 +58,7 @@ public class AdaptationSet {
|
||||
* @param supplementalProperties Supplemental properties in the adaptation set.
|
||||
*/
|
||||
public AdaptationSet(
|
||||
int id,
|
||||
long id,
|
||||
@C.TrackType int type,
|
||||
List<Representation> representations,
|
||||
List<Descriptor> accessibilityDescriptors,
|
||||
|
@ -393,7 +393,7 @@ public class DashManifestParser extends DefaultHandler
|
||||
long timeShiftBufferDepthMs,
|
||||
boolean dvbProfileDeclared)
|
||||
throws XmlPullParserException, IOException {
|
||||
int id = parseInt(xpp, "id", AdaptationSet.ID_UNSET);
|
||||
long id = parseLong(xpp, "id", AdaptationSet.ID_UNSET);
|
||||
@C.TrackType int contentType = parseContentType(xpp);
|
||||
|
||||
String mimeType = xpp.getAttributeValue(null, "mimeType");
|
||||
@ -532,7 +532,7 @@ public class DashManifestParser extends DefaultHandler
|
||||
}
|
||||
|
||||
protected AdaptationSet buildAdaptationSet(
|
||||
int id,
|
||||
long id,
|
||||
@C.TrackType int contentType,
|
||||
List<Representation> representations,
|
||||
List<Descriptor> accessibilityDescriptors,
|
||||
|
@ -80,13 +80,14 @@ public final class DashMediaPeriodTest {
|
||||
TrackGroupArray expectedTrackGroups =
|
||||
new TrackGroupArray(
|
||||
new TrackGroup(
|
||||
/* id= */ "0",
|
||||
/* id= */ "3000000000",
|
||||
adaptationSets.get(0).representations.get(0).format,
|
||||
adaptationSets.get(0).representations.get(1).format,
|
||||
adaptationSets.get(2).representations.get(0).format,
|
||||
adaptationSets.get(2).representations.get(1).format,
|
||||
adaptationSets.get(3).representations.get(0).format),
|
||||
new TrackGroup(/* id= */ "3", adaptationSets.get(1).representations.get(0).format));
|
||||
new TrackGroup(
|
||||
/* id= */ "3000000003", adaptationSets.get(1).representations.get(0).format));
|
||||
|
||||
MediaPeriodAsserts.assertTrackGroups(dashMediaPeriod, expectedTrackGroups);
|
||||
}
|
||||
@ -102,12 +103,12 @@ public final class DashMediaPeriodTest {
|
||||
TrackGroupArray expectedTrackGroups =
|
||||
new TrackGroupArray(
|
||||
new TrackGroup(
|
||||
/* id= */ "0",
|
||||
/* id= */ "3000000000",
|
||||
adaptationSets.get(0).representations.get(0).format,
|
||||
adaptationSets.get(0).representations.get(1).format,
|
||||
adaptationSets.get(1).representations.get(0).format),
|
||||
new TrackGroup(
|
||||
/* id= */ "2",
|
||||
/* id= */ "3000000002",
|
||||
adaptationSets.get(2).representations.get(0).format,
|
||||
adaptationSets.get(2).representations.get(1).format,
|
||||
adaptationSets.get(3).representations.get(0).format));
|
||||
@ -127,7 +128,7 @@ public final class DashMediaPeriodTest {
|
||||
TrackGroupArray expectedTrackGroups =
|
||||
new TrackGroupArray(
|
||||
new TrackGroup(
|
||||
/* id= */ "0",
|
||||
/* id= */ "3000000000",
|
||||
adaptationSets.get(0).representations.get(0).format,
|
||||
adaptationSets.get(0).representations.get(1).format,
|
||||
adaptationSets.get(1).representations.get(0).format,
|
||||
|
@ -1,30 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<MPD availabilityStartTime="2014-06-19T23:07:42" type="dynamic">
|
||||
<Period start="PT7462826.784S" id="0">
|
||||
<AdaptationSet id="0" mimeType="video/mp4">
|
||||
<AdaptationSet id="3000000000" mimeType="video/mp4">
|
||||
<SupplementalProperty
|
||||
schemeIdUri="http://dashif.org/guidelines/trickmode"
|
||||
value="1"/>
|
||||
value="3000000001"/>
|
||||
<Representation id="0" bandwidth="0" codecs="avc1.42c01f"/>
|
||||
<Representation id="1" bandwidth="1" codecs="avc1.42c01f"/>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet id="1" mimeType="video/mp4">
|
||||
<AdaptationSet id="3000000001" mimeType="video/mp4">
|
||||
<SupplementalProperty
|
||||
schemeIdUri="urn:mpeg:dash:adaptation-set-switching:2016"
|
||||
value="2"/>
|
||||
value="3000000002"/>
|
||||
<Representation id="11" bandwidth="100" codecs="avc1.42c01f"/>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet id="2" mimeType="video/mp4">
|
||||
<AdaptationSet id="3000000002" mimeType="video/mp4">
|
||||
<SupplementalProperty
|
||||
schemeIdUri="urn:mpeg:dash:adaptation-set-switching:2016"
|
||||
value="1"/>
|
||||
value="3000000001"/>
|
||||
<Representation id="21" bandwidth="200" codecs="avc1.42c01f"/>
|
||||
<Representation id="22" bandwidth="201" codecs="avc1.42c01f"/>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet id="3" mimeType="video/mp4">
|
||||
<AdaptationSet id="3000000003" mimeType="video/mp4">
|
||||
<SupplementalProperty
|
||||
schemeIdUri="http://dashif.org/guidelines/trickmode"
|
||||
value="2"/>
|
||||
value="3000000002"/>
|
||||
<Representation id="31" bandwidth="300" codecs="avc1.42c01f"/>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
|
@ -1,27 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<MPD availabilityStartTime="2014-06-19T23:07:42" type="dynamic">
|
||||
<Period start="PT7462826.784S" id="0">
|
||||
<AdaptationSet id="0" mimeType="video/mp4">
|
||||
<AdaptationSet id="3000000000" mimeType="video/mp4">
|
||||
<SupplementalProperty
|
||||
schemeIdUri="urn:mpeg:dash:adaptation-set-switching:2016"
|
||||
value="1,2"/>
|
||||
value="3000000001,3000000002"/>
|
||||
<Representation id="1" bandwidth="0" codecs="avc1.42c01f"/>
|
||||
<Representation id="2" bandwidth="1" codecs="avc1.42c01f"/>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet id="3" mimeType="video/mp4">
|
||||
<AdaptationSet id="3000000003" mimeType="video/mp4">
|
||||
<Representation id="31" bandwidth="300" codecs="avc1.42c01f"/>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet id="2" mimeType="video/mp4">
|
||||
<AdaptationSet id="3000000002" mimeType="video/mp4">
|
||||
<SupplementalProperty
|
||||
schemeIdUri="urn:mpeg:dash:adaptation-set-switching:2016"
|
||||
value="0,1"/>
|
||||
value="3000000000,3000000001"/>
|
||||
<Representation id="21" bandwidth="200" codecs="avc1.42c01f"/>
|
||||
<Representation id="21" bandwidth="201" codecs="avc1.42c01f"/>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet id="1" mimeType="video/mp4">
|
||||
<AdaptationSet id="3000000001" mimeType="video/mp4">
|
||||
<SupplementalProperty
|
||||
schemeIdUri="urn:mpeg:dash:adaptation-set-switching:2016"
|
||||
value="0,2"/>
|
||||
value="3000000000,3000000002"/>
|
||||
<Representation id="11" bandwidth="100" codecs="avc1.42c01f"/>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
|
@ -1,24 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<MPD availabilityStartTime="2014-06-19T23:07:42" type="dynamic">
|
||||
<Period start="PT7462826.784S" id="0">
|
||||
<AdaptationSet id="0" mimeType="video/mp4">
|
||||
<AdaptationSet id="3000000000" mimeType="video/mp4">
|
||||
<SupplementalProperty
|
||||
schemeIdUri="http://dashif.org/guidelines/trickmode"
|
||||
value="1"/>
|
||||
value="3000000001"/>
|
||||
<Representation id="0" bandwidth="0" codecs="avc1.42c01f"/>
|
||||
<Representation id="1" bandwidth="1" codecs="avc1.42c01f"/>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet id="1" mimeType="video/mp4">
|
||||
<AdaptationSet id="3000000001" mimeType="video/mp4">
|
||||
<Representation id="11" bandwidth="100" codecs="avc1.42c01f"/>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet id="2" mimeType="video/mp4">
|
||||
<AdaptationSet id="3000000002" mimeType="video/mp4">
|
||||
<Representation id="21" bandwidth="200" codecs="avc1.42c01f"/>
|
||||
<Representation id="22" bandwidth="201" codecs="avc1.42c01f"/>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet id="3" mimeType="video/mp4">
|
||||
<AdaptationSet id="3000000003" mimeType="video/mp4">
|
||||
<SupplementalProperty
|
||||
schemeIdUri="http://dashif.org/guidelines/trickmode"
|
||||
value="2"/>
|
||||
value="3000000002"/>
|
||||
<Representation id="31" bandwidth="300" codecs="avc1.42c01f"/>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
|
@ -7,7 +7,7 @@
|
||||
type="static"
|
||||
mediaPresentationDuration="PT904S">
|
||||
<Period id="1" duration="PT904S" start="PT0S">
|
||||
<AdaptationSet id="0" mimeType="video/mp4" contentType="video" segmentAlignment="true" startWithSAP="1">
|
||||
<AdaptationSet id="3000000000" mimeType="video/mp4" contentType="video" segmentAlignment="true" startWithSAP="1">
|
||||
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"/>
|
||||
<SegmentTemplate presentationTimeOffset="0" media="video_$Time$_$Bandwidth$.m4s" timescale="1000" >
|
||||
<SegmentTimeline>
|
||||
@ -20,7 +20,7 @@
|
||||
<Representation id="3" codecs="avc1.42c00c" width="400" height="224" frameRate="25/2" bandwidth="250000"/>
|
||||
<Representation id="4" codecs="avc1.42c00b" width="400" height="224" frameRate="5" bandwidth="50000"/>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet id="1" lang="fr" mimeType="audio/mp4" contentType="audio" codecs="mp4a.40.2" segmentAlignment="true" startWithSAP="1">
|
||||
<AdaptationSet id="3000000001" lang="fr" mimeType="audio/mp4" contentType="audio" codecs="mp4a.40.2" segmentAlignment="true" startWithSAP="1">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:mpegB:cicp:ChannelConfiguration" value="2"/>
|
||||
<SegmentTemplate presentationTimeOffset="0" media="audio_$Time$_$Bandwidth$.m4s" timescale="1000" >
|
||||
<SegmentTimeline>
|
||||
|
Loading…
x
Reference in New Issue
Block a user