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
8ae04bcf
authored
Jul 14, 2020
by
ibaker
Committed by
Oliver Woodman
Jul 24, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Migrate usages of deprecated Window#tag
PiperOrigin-RevId: 321169585
parent
5a2e04ec
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
3 deletions
library/core/src/main/java/com/google/android/exoplayer2/source/SilenceMediaSource.java
library/core/src/main/java/com/google/android/exoplayer2/source/SingleSampleMediaSource.java
library/core/src/test/java/com/google/android/exoplayer2/source/SinglePeriodTimelineTest.java
testutils/src/main/java/com/google/android/exoplayer2/testutil/TimelineAsserts.java
library/core/src/main/java/com/google/android/exoplayer2/source/SilenceMediaSource.java
View file @
8ae04bcf
...
@@ -55,7 +55,8 @@ public final class SilenceMediaSource extends BaseMediaSource {
...
@@ -55,7 +55,8 @@ public final class SilenceMediaSource extends BaseMediaSource {
/**
/**
* Sets a tag for the media source which will be published in the {@link
* Sets a tag for the media source which will be published in the {@link
* com.google.android.exoplayer2.Timeline} of the source as {@link
* com.google.android.exoplayer2.Timeline} of the source as {@link
* com.google.android.exoplayer2.Timeline.Window#tag}.
* com.google.android.exoplayer2.MediaItem.PlaybackProperties#tag
* Window#mediaItem.playbackProperties.tag}.
*
*
* @param tag A tag for the media source.
* @param tag A tag for the media source.
* @return This factory, for convenience.
* @return This factory, for convenience.
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/SingleSampleMediaSource.java
View file @
8ae04bcf
...
@@ -80,7 +80,8 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
...
@@ -80,7 +80,8 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
/**
/**
* Sets a tag for the media source which will be published in the {@link Timeline} of the source
* Sets a tag for the media source which will be published in the {@link Timeline} of the source
* as {@link Timeline.Window#tag}.
* as {@link com.google.android.exoplayer2.MediaItem.PlaybackProperties#tag
* Window#mediaItem.playbackProperties.tag}.
*
*
* @param tag A tag for the media source.
* @param tag A tag for the media source.
* @return This factory, for convenience.
* @return This factory, for convenience.
...
...
library/core/src/test/java/com/google/android/exoplayer2/source/SinglePeriodTimelineTest.java
View file @
8ae04bcf
...
@@ -89,6 +89,7 @@ public final class SinglePeriodTimelineTest {
...
@@ -89,6 +89,7 @@ public final class SinglePeriodTimelineTest {
}
}
@Test
@Test
@SuppressWarnings
(
"deprecation"
)
// Testing deprecated Window.tag is still populated correctly.
public
void
setNullTag_returnsNullTag_butUsesDefaultUid
()
{
public
void
setNullTag_returnsNullTag_butUsesDefaultUid
()
{
SinglePeriodTimeline
timeline
=
SinglePeriodTimeline
timeline
=
new
SinglePeriodTimeline
(
new
SinglePeriodTimeline
(
...
@@ -100,6 +101,8 @@ public final class SinglePeriodTimelineTest {
...
@@ -100,6 +101,8 @@ public final class SinglePeriodTimelineTest {
new
MediaItem
.
Builder
().
setUri
(
Uri
.
EMPTY
).
setTag
(
null
).
build
());
new
MediaItem
.
Builder
().
setUri
(
Uri
.
EMPTY
).
setTag
(
null
).
build
());
assertThat
(
timeline
.
getWindow
(
/* windowIndex= */
0
,
window
).
tag
).
isNull
();
assertThat
(
timeline
.
getWindow
(
/* windowIndex= */
0
,
window
).
tag
).
isNull
();
assertThat
(
timeline
.
getWindow
(
/* windowIndex= */
0
,
window
).
mediaItem
.
playbackProperties
.
tag
)
.
isNull
();
assertThat
(
timeline
.
getPeriod
(
/* periodIndex= */
0
,
period
,
/* setIds= */
false
).
id
).
isNull
();
assertThat
(
timeline
.
getPeriod
(
/* periodIndex= */
0
,
period
,
/* setIds= */
false
).
id
).
isNull
();
assertThat
(
timeline
.
getPeriod
(
/* periodIndex= */
0
,
period
,
/* setIds= */
true
).
id
).
isNull
();
assertThat
(
timeline
.
getPeriod
(
/* periodIndex= */
0
,
period
,
/* setIds= */
true
).
id
).
isNull
();
assertThat
(
timeline
.
getPeriod
(
/* periodIndex= */
0
,
period
,
/* setIds= */
false
).
uid
).
isNull
();
assertThat
(
timeline
.
getPeriod
(
/* periodIndex= */
0
,
period
,
/* setIds= */
false
).
uid
).
isNull
();
...
@@ -108,6 +111,7 @@ public final class SinglePeriodTimelineTest {
...
@@ -108,6 +111,7 @@ public final class SinglePeriodTimelineTest {
}
}
@Test
@Test
@SuppressWarnings
(
"deprecation"
)
// Testing deprecated Window.tag is still populated correctly.
public
void
getWindow_setsTag
()
{
public
void
getWindow_setsTag
()
{
Object
tag
=
new
Object
();
Object
tag
=
new
Object
();
SinglePeriodTimeline
timeline
=
SinglePeriodTimeline
timeline
=
...
...
testutils/src/main/java/com/google/android/exoplayer2/testutil/TimelineAsserts.java
View file @
8ae04bcf
...
@@ -18,11 +18,13 @@ package com.google.android.exoplayer2.testutil;
...
@@ -18,11 +18,13 @@ package com.google.android.exoplayer2.testutil;
import
static
com
.
google
.
common
.
truth
.
Truth
.
assertThat
;
import
static
com
.
google
.
common
.
truth
.
Truth
.
assertThat
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Timeline
;
import
com.google.android.exoplayer2.Timeline
;
import
com.google.android.exoplayer2.Timeline.Period
;
import
com.google.android.exoplayer2.Timeline.Period
;
import
com.google.android.exoplayer2.Timeline.Window
;
import
com.google.android.exoplayer2.Timeline.Window
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.Util
;
import
org.checkerframework.checker.nullness.compatqual.NullableType
;
import
org.checkerframework.checker.nullness.compatqual.NullableType
;
/** Unit test for {@link Timeline}. */
/** Unit test for {@link Timeline}. */
...
@@ -57,7 +59,9 @@ public final class TimelineAsserts {
...
@@ -57,7 +59,9 @@ public final class TimelineAsserts {
for
(
int
i
=
0
;
i
<
timeline
.
getWindowCount
();
i
++)
{
for
(
int
i
=
0
;
i
<
timeline
.
getWindowCount
();
i
++)
{
timeline
.
getWindow
(
i
,
window
);
timeline
.
getWindow
(
i
,
window
);
if
(
expectedWindowTags
[
i
]
!=
null
)
{
if
(
expectedWindowTags
[
i
]
!=
null
)
{
assertThat
(
window
.
tag
).
isEqualTo
(
expectedWindowTags
[
i
]);
MediaItem
.
PlaybackProperties
playbackProperties
=
window
.
mediaItem
.
playbackProperties
;
assertThat
(
playbackProperties
).
isNotNull
();
assertThat
(
Util
.
castNonNull
(
playbackProperties
).
tag
).
isEqualTo
(
expectedWindowTags
[
i
]);
}
}
}
}
}
}
...
...
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