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
e6b9bde1
authored
Apr 03, 2023
by
bachinger
Committed by
Marc Baechinger
Apr 05, 2023
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Use SKIPPED ad status when a playing ad period has been removed
PiperOrigin-RevId: 521476767
parent
7babcf28
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
15 deletions
libraries/exoplayer_ima/src/main/java/androidx/media3/exoplayer/ima/ImaServerSideAdInsertionMediaSource.java
libraries/exoplayer_ima/src/main/java/androidx/media3/exoplayer/ima/ImaUtil.java
libraries/exoplayer_ima/src/test/java/androidx/media3/exoplayer/ima/ImaUtilTest.java
libraries/exoplayer_ima/src/main/java/androidx/media3/exoplayer/ima/ImaServerSideAdInsertionMediaSource.java
View file @
e6b9bde1
...
...
@@ -1435,7 +1435,7 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou
Timeline
timeline
=
player
.
getCurrentTimeline
();
Timeline
.
Window
window
=
new
Timeline
.
Window
();
Timeline
.
Period
adPeriod
=
new
Timeline
.
Period
();
// In case all periods are in the live window, we need t
he correct
ad group duration when
// In case all periods are in the live window, we need t
o correct the
ad group duration when
// inserting the first ad. Try calculate ad group duration from media structure.
long
totalAdDurationUs
=
getAdGroupDurationUsForLiveAdPeriodIndex
(
...
...
libraries/exoplayer_ima/src/main/java/androidx/media3/exoplayer/ima/ImaUtil.java
View file @
e6b9bde1
...
...
@@ -737,7 +737,7 @@ import java.util.Set;
return
adPlaybackState
;
}
if
(
state
==
AD_STATE_AVAILABLE
||
state
==
AD_STATE_UNAVAILABLE
)
{
adPlaybackState
=
adPlaybackState
.
with
Play
edAd
(
adGroupIndex
,
/* adIndexInAdGroup= */
i
);
adPlaybackState
=
adPlaybackState
.
with
Skipp
edAd
(
adGroupIndex
,
/* adIndexInAdGroup= */
i
);
}
adGroupDurationUs
+=
adGroup
.
durationsUs
[
i
];
}
...
...
@@ -751,7 +751,11 @@ import java.util.Set;
long
[]
newDurationsUs
=
new
long
[
adGroup
.
durationsUs
.
length
];
for
(
int
adIndex
=
0
;
adIndex
<
newDurationsUs
.
length
;
adIndex
++)
{
newDurationsUs
[
adIndex
]
=
preserveDurations
?
adGroup
.
durationsUs
[
adIndex
]
:
0
;
adPlaybackState
=
adPlaybackState
.
withPlayedAd
(
adGroupIndex
,
/* adIndexInAdGroup= */
adIndex
);
if
(
adGroup
.
states
[
adIndex
]
==
AD_STATE_AVAILABLE
||
adGroup
.
states
[
adIndex
]
==
AD_STATE_UNAVAILABLE
)
{
adPlaybackState
=
adPlaybackState
.
withSkippedAd
(
adGroupIndex
,
/* adIndexInAdGroup= */
adIndex
);
}
}
return
adPlaybackState
.
withAdDurationsUs
(
adGroupIndex
,
newDurationsUs
)
...
...
libraries/exoplayer_ima/src/test/java/androidx/media3/exoplayer/ima/ImaUtilTest.java
View file @
e6b9bde1
...
...
@@ -1663,7 +1663,6 @@ public class ImaUtilTest {
/* totalAdDurationUs= */
3
*
AD_PERIOD_DURATION_US
,
/* totalAdsInAdPod= */
3
,
adPlaybackState
);
AdPlaybackState
finalAdPlaybackState
=
adPlaybackState
;
assertThat
(
getAdGroupAndIndexInLiveMultiPeriodTimeline
(
...
...
@@ -2040,7 +2039,7 @@ public class ImaUtilTest {
.
asList
()
.
containsExactly
(
AD_STATE_PLAYED
,
AD_STATE_
PLAY
ED
,
AD_STATE_
SKIPP
ED
,
AD_STATE_UNAVAILABLE
,
AD_STATE_UNAVAILABLE
,
AD_STATE_UNAVAILABLE
,
...
...
@@ -2059,11 +2058,11 @@ public class ImaUtilTest {
.
asList
()
.
containsExactly
(
AD_STATE_PLAYED
,
AD_STATE_
PLAY
ED
,
AD_STATE_
PLAY
ED
,
AD_STATE_
PLAY
ED
,
AD_STATE_
PLAY
ED
,
AD_STATE_
PLAY
ED
)
AD_STATE_
SKIPP
ED
,
AD_STATE_
SKIPP
ED
,
AD_STATE_
SKIPP
ED
,
AD_STATE_
SKIPP
ED
,
AD_STATE_
SKIPP
ED
)
.
inOrder
();
assertThat
(
adPlaybackState5
.
getAdGroup
(
/* adGroupIndex= */
0
).
durationsUs
)
.
asList
()
...
...
@@ -2085,11 +2084,11 @@ public class ImaUtilTest {
.
asList
()
.
containsExactly
(
AD_STATE_PLAYED
,
AD_STATE_
PLAY
ED
,
AD_STATE_
PLAY
ED
,
AD_STATE_
PLAY
ED
,
AD_STATE_
PLAY
ED
,
AD_STATE_
PLAY
ED
)
AD_STATE_
SKIPP
ED
,
AD_STATE_
SKIPP
ED
,
AD_STATE_
SKIPP
ED
,
AD_STATE_
SKIPP
ED
,
AD_STATE_
SKIPP
ED
)
.
inOrder
();
assertThat
(
adPlaybackState6
.
getAdGroup
(
/* adGroupIndex= */
0
).
durationsUs
)
.
asList
()
...
...
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