Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c2e6d202
authored
Sep 08, 2021
by
olly
Committed by
Ian Baker
Sep 08, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix poor documentation and variable name choice in StreamKey
Issue #9284 PiperOrigin-RevId: 395443015
parent
e088cb43
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
21 deletions
library/common/src/main/java/com/google/android/exoplayer2/offline/StreamKey.java
library/core/src/main/java/com/google/android/exoplayer2/offline/DefaultDownloadIndex.java
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifest.java
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/playlist/HlsMasterPlaylist.java
library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/manifest/SsManifest.java
library/common/src/main/java/com/google/android/exoplayer2/offline/StreamKey.java
View file @
c2e6d202
...
@@ -20,11 +20,18 @@ import android.os.Parcelable;
...
@@ -20,11 +20,18 @@ import android.os.Parcelable;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
/**
/**
* A key for a subset of media
which
can be separately loaded (a "stream").
* A key for a subset of media
that
can be separately loaded (a "stream").
*
*
* <p>The stream key consists of a period index, a group index within the period and a
track
index
* <p>The stream key consists of a period index, a group index within the period and a
stream
index
* within the group. The interpretation of these indices depends on the type of media for which the
* within the group. The interpretation of these indices depends on the type of media for which the
* stream key is used.
* stream key is used. Note that they are <em>not</em> the same as track group and track indices,
* because multiple tracks can be multiplexed into a single stream.
*
* <p>Application code should not generally attempt to build StreamKey instances directly. Instead,
* {@code DownloadHelper.getDownloadRequest} can be used to generate download requests with the
* correct StreamKeys for the track selections that have been configured on the helper. {@code
* MediaPeriod.getStreamKeys} provides a lower level way of generating StreamKeys corresponding to a
* particular track selection.
*/
*/
public
final
class
StreamKey
implements
Comparable
<
StreamKey
>,
Parcelable
{
public
final
class
StreamKey
implements
Comparable
<
StreamKey
>,
Parcelable
{
...
@@ -32,37 +39,48 @@ public final class StreamKey implements Comparable<StreamKey>, Parcelable {
...
@@ -32,37 +39,48 @@ public final class StreamKey implements Comparable<StreamKey>, Parcelable {
public
final
int
periodIndex
;
public
final
int
periodIndex
;
/** The group index. */
/** The group index. */
public
final
int
groupIndex
;
public
final
int
groupIndex
;
/** The track index. */
/** The stream index. */
public
final
int
trackIndex
;
public
final
int
streamIndex
;
/** @deprecated Use {@link #streamIndex}. */
@Deprecated
public
final
int
trackIndex
;
/**
/**
* Creates an instance with {@link #periodIndex} set to 0.
*
* @param groupIndex The group index.
* @param groupIndex The group index.
* @param
trackIndex The track
index.
* @param
streamIndex The stream
index.
*/
*/
public
StreamKey
(
int
groupIndex
,
int
track
Index
)
{
public
StreamKey
(
int
groupIndex
,
int
stream
Index
)
{
this
(
0
,
groupIndex
,
track
Index
);
this
(
0
,
groupIndex
,
stream
Index
);
}
}
/**
/**
* Creates an instance.
*
* @param periodIndex The period index.
* @param periodIndex The period index.
* @param groupIndex The group index.
* @param groupIndex The group index.
* @param
trackIndex The track
index.
* @param
streamIndex The stream
index.
*/
*/
public
StreamKey
(
int
periodIndex
,
int
groupIndex
,
int
trackIndex
)
{
@SuppressWarnings
(
"deprecation"
)
public
StreamKey
(
int
periodIndex
,
int
groupIndex
,
int
streamIndex
)
{
this
.
periodIndex
=
periodIndex
;
this
.
periodIndex
=
periodIndex
;
this
.
groupIndex
=
groupIndex
;
this
.
groupIndex
=
groupIndex
;
this
.
trackIndex
=
trackIndex
;
this
.
streamIndex
=
streamIndex
;
trackIndex
=
streamIndex
;
}
}
@SuppressWarnings
(
"deprecation"
)
/* package */
StreamKey
(
Parcel
in
)
{
/* package */
StreamKey
(
Parcel
in
)
{
periodIndex
=
in
.
readInt
();
periodIndex
=
in
.
readInt
();
groupIndex
=
in
.
readInt
();
groupIndex
=
in
.
readInt
();
trackIndex
=
in
.
readInt
();
streamIndex
=
in
.
readInt
();
trackIndex
=
streamIndex
;
}
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
periodIndex
+
"."
+
groupIndex
+
"."
+
track
Index
;
return
periodIndex
+
"."
+
groupIndex
+
"."
+
stream
Index
;
}
}
@Override
@Override
...
@@ -77,14 +95,14 @@ public final class StreamKey implements Comparable<StreamKey>, Parcelable {
...
@@ -77,14 +95,14 @@ public final class StreamKey implements Comparable<StreamKey>, Parcelable {
StreamKey
that
=
(
StreamKey
)
o
;
StreamKey
that
=
(
StreamKey
)
o
;
return
periodIndex
==
that
.
periodIndex
return
periodIndex
==
that
.
periodIndex
&&
groupIndex
==
that
.
groupIndex
&&
groupIndex
==
that
.
groupIndex
&&
trackIndex
==
that
.
track
Index
;
&&
streamIndex
==
that
.
stream
Index
;
}
}
@Override
@Override
public
int
hashCode
()
{
public
int
hashCode
()
{
int
result
=
periodIndex
;
int
result
=
periodIndex
;
result
=
31
*
result
+
groupIndex
;
result
=
31
*
result
+
groupIndex
;
result
=
31
*
result
+
track
Index
;
result
=
31
*
result
+
stream
Index
;
return
result
;
return
result
;
}
}
...
@@ -96,7 +114,7 @@ public final class StreamKey implements Comparable<StreamKey>, Parcelable {
...
@@ -96,7 +114,7 @@ public final class StreamKey implements Comparable<StreamKey>, Parcelable {
if
(
result
==
0
)
{
if
(
result
==
0
)
{
result
=
groupIndex
-
o
.
groupIndex
;
result
=
groupIndex
-
o
.
groupIndex
;
if
(
result
==
0
)
{
if
(
result
==
0
)
{
result
=
trackIndex
-
o
.
track
Index
;
result
=
streamIndex
-
o
.
stream
Index
;
}
}
}
}
return
result
;
return
result
;
...
@@ -113,7 +131,7 @@ public final class StreamKey implements Comparable<StreamKey>, Parcelable {
...
@@ -113,7 +131,7 @@ public final class StreamKey implements Comparable<StreamKey>, Parcelable {
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
dest
.
writeInt
(
periodIndex
);
dest
.
writeInt
(
periodIndex
);
dest
.
writeInt
(
groupIndex
);
dest
.
writeInt
(
groupIndex
);
dest
.
writeInt
(
track
Index
);
dest
.
writeInt
(
stream
Index
);
}
}
public
static
final
Parcelable
.
Creator
<
StreamKey
>
CREATOR
=
public
static
final
Parcelable
.
Creator
<
StreamKey
>
CREATOR
=
...
...
library/core/src/main/java/com/google/android/exoplayer2/offline/DefaultDownloadIndex.java
View file @
c2e6d202
...
@@ -415,7 +415,7 @@ public final class DefaultDownloadIndex implements WritableDownloadIndex {
...
@@ -415,7 +415,7 @@ public final class DefaultDownloadIndex implements WritableDownloadIndex {
.
append
(
'.'
)
.
append
(
'.'
)
.
append
(
streamKey
.
groupIndex
)
.
append
(
streamKey
.
groupIndex
)
.
append
(
'.'
)
.
append
(
'.'
)
.
append
(
streamKey
.
track
Index
)
.
append
(
streamKey
.
stream
Index
)
.
append
(
','
);
.
append
(
','
);
}
}
if
(
stringBuilder
.
length
()
>
0
)
{
if
(
stringBuilder
.
length
()
>
0
)
{
...
...
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifest.java
View file @
c2e6d202
...
@@ -189,7 +189,7 @@ public class DashManifest implements FilterableManifest<DashManifest> {
...
@@ -189,7 +189,7 @@ public class DashManifest implements FilterableManifest<DashManifest> {
List
<
Representation
>
representations
=
adaptationSet
.
representations
;
List
<
Representation
>
representations
=
adaptationSet
.
representations
;
ArrayList
<
Representation
>
copyRepresentations
=
new
ArrayList
<>();
ArrayList
<
Representation
>
copyRepresentations
=
new
ArrayList
<>();
do
{
do
{
Representation
representation
=
representations
.
get
(
key
.
track
Index
);
Representation
representation
=
representations
.
get
(
key
.
stream
Index
);
copyRepresentations
.
add
(
representation
);
copyRepresentations
.
add
(
representation
);
key
=
keys
.
poll
();
key
=
keys
.
poll
();
}
while
(
key
.
periodIndex
==
periodIndex
&&
key
.
groupIndex
==
adaptationSetIndex
);
}
while
(
key
.
periodIndex
==
periodIndex
&&
key
.
groupIndex
==
adaptationSetIndex
);
...
...
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/playlist/HlsMasterPlaylist.java
View file @
c2e6d202
...
@@ -308,7 +308,7 @@ public final class HlsMasterPlaylist extends HlsPlaylist {
...
@@ -308,7 +308,7 @@ public final class HlsMasterPlaylist extends HlsPlaylist {
T
stream
=
streams
.
get
(
i
);
T
stream
=
streams
.
get
(
i
);
for
(
int
j
=
0
;
j
<
streamKeys
.
size
();
j
++)
{
for
(
int
j
=
0
;
j
<
streamKeys
.
size
();
j
++)
{
StreamKey
streamKey
=
streamKeys
.
get
(
j
);
StreamKey
streamKey
=
streamKeys
.
get
(
j
);
if
(
streamKey
.
groupIndex
==
groupIndex
&&
streamKey
.
track
Index
==
i
)
{
if
(
streamKey
.
groupIndex
==
groupIndex
&&
streamKey
.
stream
Index
==
i
)
{
copiedStreams
.
add
(
stream
);
copiedStreams
.
add
(
stream
);
break
;
break
;
}
}
...
...
library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/manifest/SsManifest.java
View file @
c2e6d202
...
@@ -339,7 +339,7 @@ public class SsManifest implements FilterableManifest<SsManifest> {
...
@@ -339,7 +339,7 @@ public class SsManifest implements FilterableManifest<SsManifest> {
copiedFormats
.
clear
();
copiedFormats
.
clear
();
}
}
currentStreamElement
=
streamElement
;
currentStreamElement
=
streamElement
;
copiedFormats
.
add
(
streamElement
.
formats
[
key
.
track
Index
]);
copiedFormats
.
add
(
streamElement
.
formats
[
key
.
stream
Index
]);
}
}
if
(
currentStreamElement
!=
null
)
{
if
(
currentStreamElement
!=
null
)
{
// Add the last stream element.
// Add the last stream element.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment