7968 Commits

Author SHA1 Message Date
olly
8fcbbb09af Bump release to 2.11.7
PiperOrigin-RevId: 318790917
2020-06-29 13:45:56 +01:00
andrewlewis
ce8bb26802 Fix postroll content complete notifications
On reaching the end of the content we would notify content complete
and skip unplayed ads, causing a timeline change. That timeline change
was handled in a way that caused a further timeline change in the
2.11.6 release, where we don't yet deduplicate no-op Timeline changes,
causing repeated timeline changes indefinitely.

At tip-of-tree, the timeline wouldn't refresh repeatedly. However the
code for sending content complete at the point of transitioning to
play a preloaded postroll ad was not correct in that it didn't mark
previous ads as skipped. Instead they happened to be marked as
skipped later on due to the timeline change handling content
completion code triggering again.

Fix this by only marking ads as skipped when content completes once,
to avoid the duplicate timeline change, and moving the skipped ad
marking so it happens in the same place as notifying content complete.

PiperOrigin-RevId: 318454908
2020-06-26 14:21:57 +01:00
Oliver Woodman
1a5b304b1f
Merge pull request #7517 from google/dev-v2-r2.11.6
r2.11.6
2020-06-24 00:39:54 +01:00
andrewlewis
67c99e1d11 Fix resuming postrolls
Postrolls would be skipped because the period duration wasn't know at
the moment of resuming playback after backgrounding, so the position
wouldn't be resolved to resume the postroll ad.

We have the period duration stored in the AdPlaybackState, so we can
use that directly.

Issue: #7518
PiperOrigin-RevId: 317830418
2020-06-23 15:58:48 +01:00
andrewlewis
df10fdf773 Fix handling of postrolls preloading
The IMA SDK now preloads postrolls which is great as we no longer need
to rely on detecting buffering at the end of the stream to trigger
playing postrolls.

Add in the required logic to detect the period transition to playing
the postroll.

Issue: #7518
PiperOrigin-RevId: 317610682
2020-06-23 15:58:42 +01:00
andrewlewis
0ffe747076 Fix incorrect rounding of ad cue points
We currently get float ad cue points from IMA, but store these as
longs in microseconds. The cast from double to long would take the
floor of the value, which could lead to stored ad cue points being
off-by-one. Use Math.round to avoid this.

ImaAdsLoader also has code to map a double AdPodInfo position (which
should match a cue point) onto the corresponding ad group index by
searching the long ad cue points. Match the calculation used where we
map float cue points, including narrowing the position to a float
first to avoid regressions if IMA SDK behavior changes to represent
positions in more than float precision later, and also remove the
requirement that the ad positions match exactly as a defensive
measure.

PiperOrigin-RevId: 317607017
2020-06-23 15:58:36 +01:00
olly
f39a65cb66 Bump version to 2.11.6
PiperOrigin-RevId: 316949571
2020-06-23 15:58:19 +01:00
Oliver Woodman
99c0305278 Fix release notes 2020-06-17 20:51:59 +01:00
andrewlewis
49951d4f87 Workaround unexpected discard of preloaded ad
After an ad pod coming up has preloaded, if the user seeks before it
plays we get pauseAd/stopAd called for that ad pod. Also, the ad will
not load again. Work around this unexpected behavior by handling
pauseAd/stopAd and discarding the ad.

In future, it's likely that the IMA SDK will stop calling those
methods, and will loadAd again for the preloaded ad that was
unexpectedly discarded. This change should be compatible with that,
because the ad won't be discarded any more due to not calling stopAd.

Issue: #7492
PiperOrigin-RevId: 316873699
2020-06-17 20:36:02 +01:00
andrewlewis
fc76dbfad4 Remove some ad playback state change requirements
Ads can appear due to asynchronous ad tag requests completing after
earlier ads in a pod have loaded, so remove the requirement that the
ad count can't change. The MediaPeriodQueue should handling discarding
buffered content if an ad appears before already buffered content, so
I think this case is actually handled correctly by the core player
already.

Also remove the requirement that an ad URI can't change. This is a
defensive measure for now, but it's likely that a later fix in the IMA
SDK for an issue where loadAd is not called after preloading then
seeking before a preloaded ad plays will result in loadAd being called
more than once, and I think it's possible that the second call to
loadAd may have a different URI. Because the ad URI should only change
after an intermediate seek to another MediaPeriod, there shouldn't be
any problems with buffered data not getting discarded.

Issue: #7477
PiperOrigin-RevId: 316871371
2020-06-17 20:35:31 +01:00
andrewlewis
5fd287b340 Move IMA SDK callbacks into inner class
The release() method was added in the recent IMA API changes for
preloading and now 'collides' with the ExoPlayer AdsLoader release
method. This led to all ads completing being treated as a call to
completely release the ads loader, which meant that the ad playback
state was not updated on resuming after all ads had completed, which
in turn led to playback getting stuck buffering on returning from the
background after all ads played.

Move the IMA callbacks into an inner class to avoid this.

Issue: #7508
PiperOrigin-RevId: 316834561
2020-06-17 20:35:04 +01:00
olly
6e1c197309 Add MIME types for which every sample is known to be a sync sample.
- Leaving the TODO, since there are still MIME types we're unsure about.
- Removing AAC because xHE-AAC does not have this property. We may re-add
  it with an additional profile check to exclude xHE-AAC in the future.

PiperOrigin-RevId: 316715147
2020-06-17 20:34:18 +01:00
ibaker
a0e90ce1ff Pull IMA cuePoints -> adGroupTimesUs logic into a helper class
We're then able to use this same helper class from tests, to avoid
running into spurious failures caused by long microseconds being
round-tripped through float seconds.

PiperOrigin-RevId: 316435084
2020-06-17 20:33:53 +01:00
andrewlewis
1ce040003a Add AdPlaybackState toString
This is useful for debugging both in tests and via logging.

PiperOrigin-RevId: 316102968
2020-06-17 20:26:42 +01:00
andrewlewis
f1197d8af3 Handle errors in all VideoAdPlayer callbacks
Some but not all VideoAdPlayer callbacks from the IMA SDK included
defensive handling of unexpected cases. Add the remaining ones.

Issue: #7492
PiperOrigin-RevId: 316082651
2020-06-17 20:26:30 +01:00
andrewlewis
8ab3fab4c1 Fix catch type in ImaAdsLoader defensive checks
PiperOrigin-RevId: 316079131
2020-06-17 20:25:21 +01:00
andrewlewis
e261b8d0ef Allow skipping the ad before the start position
PiperOrigin-RevId: 315867160
2020-06-17 20:20:33 +01:00
olly
e5ec8e6b47 Prevent shutter closing for within-window seeks to unprepared periods
Issue: #5507
PiperOrigin-RevId: 315512207
2020-06-17 20:19:11 +01:00
andrewlewis
80f4197e0f Separate ads rendering and AdsManager init
In a later change it will be necessary to be able to destroy the ads
manager if all ads are skipped while creating ads rendering settings.
This change prepares for doing that by not having the ads manager
passed into the method (so the caller can null or initialize it).

PiperOrigin-RevId: 315488830
2020-06-17 20:15:52 +01:00
andrewlewis
5d74fced1d Add tests for resuming ad playbacks
This is in preparation for refactoring the logic to support not
playing an ad before the resume position (optionally).

PiperOrigin-RevId: 315431483
2020-06-17 20:15:46 +01:00
andrewlewis
28c5fa665f Improve ImaAdsLoaderTest ad duration handling
Previously the fake ads loader listener would always pass the same ad
durations to the fake player, but actually the known ad durations can
change during playback.

Make the fake behavior more realistic by only exposing durations for
ads that have loaded.

PiperOrigin-RevId: 314956223
2020-06-17 20:15:34 +01:00
Oliver Woodman
6026b919a1 Fix test 2020-06-09 12:58:53 +01:00
Oliver Woodman
6bfdf8f8f6
Merge pull request #7437 from google/dev-v2-r2.11.5
r2.11.5
2020-06-05 16:06:36 +01:00
olly
46d29b25c9 Reintroduce isConnected check for download requirements
PiperOrigin-RevId: 314925639
2020-06-05 15:46:05 +01:00
Oliver Woodman
cdb4025758 Revert "Update Gradle plugins."
This reverts commit c20b85ac60701a34081d8d7488ae434b9792aa9b.
2020-06-05 13:14:55 +01:00
olly
7a8f878a1f Bump version to 2.11.5
PiperOrigin-RevId: 314903986
2020-06-05 13:08:38 +01:00
olly
1347a2200f Fix more cases of downloads not being resumed
Issue: #7453
PiperOrigin-RevId: 314710328
2020-06-04 15:56:54 +01:00
olly
a818049143 Fix position jank after pausing and seeking
Issue: #6901
PiperOrigin-RevId: 314418536
2020-06-03 10:18:04 +01:00
olly
fb011e66a6 AudioTrackPositionTracker: Prevent negative timestamps
Issue: #7456
PiperOrigin-RevId: 314408767
2020-06-03 10:17:53 +01:00
aquilescanta
79acadcc89 Check for section_syntax_indicator in TS tables
Issue:#7325
PiperOrigin-RevId: 314321914
2020-06-03 10:17:39 +01:00
Oliver Woodman
5e2b89b562 Add release date 2020-06-01 19:15:15 +01:00
Oliver Woodman
9f87c2eaef Finalize release notes 2020-06-01 19:12:39 +01:00
Oliver Woodman
9830c773c6
Merge pull request #7455 from google/dev-v2-r2.11.5-7193
Merge fix for #7193 into dev-v2-r2.11.5
2020-06-01 19:11:01 +01:00
tonihei
145754618d Simplify keeping track of current id in DefaultPlaybackSessionManager
We currently have a currentMediaPeriodId and an activeSessionId that are more
or less tracking the same thing unless the current media period isn't "active" yet.

Simplify this logic by using a single currentSessionId field and the respective
isActive flag of this session. Also move all session creation and activation code in
the same method to make it easier to reason about the code.

This change also fixes a subtle bug where events after a seek to a new window
are not ignored as they should.

PiperOrigin-RevId: 289432181
2020-06-01 18:04:26 +01:00
tonihei
f4cc1d6250 Make sure finishAllSessions() can be called without removing listener
Currently, this method is only supposed to be called before removing
the listener from the player or when releasing the player.

If called at other times, it will throw an exception later when
a playback session is ended automatically.

issue:#7193
PiperOrigin-RevId: 308254993
2020-06-01 18:01:46 +01:00
tonihei
18eccf9a81 Make sure not to create new playback sessions while still IDLE.
The first session should only be created once we have the media items
and/or called prepare. Otherwise the first session is created with
an EventTime having an empty timeline making it less useful.

issue:#7193
PiperOrigin-RevId: 308100555
2020-06-01 17:52:48 +01:00
Oliver Woodman
1062edf52e Revert "Update TrackSelectionDialogBuilder to use androidx compat Dialog."
This reverts commit b05e9944ea95c2b1a341610568e5cfbe8df6f333.
2020-06-01 09:50:40 +01:00
andrewlewis
b5e5b55ef8 Fix typo
PiperOrigin-RevId: 312083761
2020-05-29 22:32:43 +01:00
andrewlewis
35a705e92a Add release notes for issues fixed by preloading migration
PiperOrigin-RevId: 312080838
2020-05-29 22:32:12 +01:00
andrewlewis
51a3f214ed Fix handling of fetch errors for post-rolls
The ad break time in seconds from IMA was "-1" for postrolls, but this didn't
match C.TIME_END_OF_SOURCE in the ad group times array.

Handle an ad break time of -1 directly by mapping it onto the last ad group,
instead of trying to look it up in the array.

PiperOrigin-RevId: 312064886
2020-05-29 22:29:29 +01:00
andrewlewis
51b2a0f7a9 Add support for timing out ad preloading
Detect stuck buffering cases in ImaAdsLoader, and discard the ad group after
a timeout. This is intended to make the IMA extension more robust in the case
where an ad group unexpectedly doesn't load.

The timing out behavior is enabled by default but apps can choose to retain
the old behavior by setting an unset timeout on ImaAdsLoader.Builder.

PiperOrigin-RevId: 311729798
2020-05-29 22:29:14 +01:00
andrewlewis
e8c7405545 Upgrade IMA SDK to 3.19.0
PiperOrigin-RevId: 311106612
2020-05-29 22:20:00 +01:00
andrewlewis
e482aa2be8 Fix method ordering in ImaAdsLoader
Put static methods at the end.

Also add a couple of missing parameter name comments.

PiperOrigin-RevId: 311077684
2020-05-29 22:18:15 +01:00
andrewlewis
929b60e209 Improve DEBUG logging in ImaAdsLoader
Log content progress events, as these are helpful to debug triggering of events
based on the content progress.

Don't log AD_PROGRESS events as they occur several times per second while ads
are playing, and the verbosity makes logs difficult to read.

PiperOrigin-RevId: 311077302
2020-05-29 22:17:51 +01:00
andrewlewis
5529c124fe Remove deprecated symbols in ImaAdsLoader
PiperOrigin-RevId: 310901647
2020-05-29 22:17:24 +01:00
andrewlewis
8c108fb5fd Upgrade IMA SDK to 3.18.2
PiperOrigin-RevId: 310883076
2020-05-29 22:17:00 +01:00
andrewlewis
3b99a84dae Migrate to new IMA preloading APIs
issue:#6429
PiperOrigin-RevId: 309906760
2020-05-29 22:15:30 +01:00
andrewlewis
de03e389c0 Enable nullness checking for the IMA extension
adPlaybackState is now non-null, and the uninitialized case is covered by a new
boolean hasAdPlaybackState. Position progress updates are now non-null and
initialized with IMA's VIDEO_TIME_NOT_READY constant.

Also fix some misc code issues:
- Remove empty branch for SmoothStreaming (Android Studio warns about this).
- Tidy onTimelineChanged and onPositionDiscontinuity and the methods they call
  to improve naming.
- Remove logging for IMA events after release, as these methods are expected to
  be called in the current IMA SDK behavior.

PiperOrigin-RevId: 308977116
2020-05-29 21:58:59 +01:00
andrewlewis
6e66dc02fb Replace IMA ad tag fakes with mocks
The mocking setup is quite messy/unclear compared to the fakes, but it seems
worth switching over because IMA API changes have already required changes
to fakes in the past, and there are more API changes in the version we are
about to upgrade to. This change should generally remove the need to keep
the fakes up-to-date.

PiperOrigin-RevId: 308819176
2020-05-29 21:58:46 +01:00
tonihei
67d1b728d3 Clarify/fix position reference points for AdPlaybackState.
The positions were interchangeably used with window and period
positions. This change more clearly ensures that all positions in the
AdPlaybackState are based on periods and that we use the right adjustments
for all usages.

PiperOrigin-RevId: 297811633
2020-05-29 21:50:07 +01:00