1144 Commits

Author SHA1 Message Date
andrewlewis
e111f850d0 Allow skipping the ad before the start position
PiperOrigin-RevId: 315867160
2020-06-12 00:25:06 +01:00
andrewlewis
9ef9b56bcd 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-11 10:10:09 +01:00
andrewlewis
a56a02d2c5 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-09 16:05:00 +01:00
andrewlewis
f16803de69 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-08 17:40:00 +01:00
bachinger
60f907be6d Make FakeTimeline and FakeMediaSource provide a media item
FakeMediaSource and FakeTimeline should put a media item to the window just as other media sources and timelines do. This change provides a fake media item for both of them.

Further the MaskingMediaSource needs to provide a media item for when the real timeline of the masked media source is not available. This can be easily done by using mediaSource.getMediaItem() once available. For now a dummy is used to make ExoPlayerTest run green. This can be easily change to use mediaSource.getMediaSource as soon as this method is defined by the MediaSource interface.

PiperOrigin-RevId: 314897474
2020-06-05 13:05:48 +01:00
olly
c77e300249 Clean up debug logging
PiperOrigin-RevId: 314707946
2020-06-04 14:16:22 +01:00
Ian Baker
8b89a5ed6d Merge pull request #6861 from chrisfillmore:feature/responseBodyForInvalidResponseCodeException_6853
PiperOrigin-RevId: 314105612
2020-06-01 15:00:08 +01:00
Oliver Woodman
496a315d91 Merge pull request #7395 from jdegroot-dss:add-storage-not-low-requirement
PiperOrigin-RevId: 313804207
2020-05-29 18:34:58 +01:00
krocard
151ea531b1 Make constants more readable with _ separator
Add an `_` in long constants.
Eg: 10000 => 10_000.

I'm proposing this change because I have had multiple
missread due to confusing the number of 0 in a long number.

More specifically, added an underscore to all number matching:
`final.*\ [0-9]{2,}000;`

PiperOrigin-RevId: 313186920
2020-05-27 19:00:36 +01:00
andrewlewis
eddc2b0b33 Enable multidex for demos
This is necessary now we have Guava in debug (no-minified) apps.

Also switch to AndroidX multidex to remove the support library dependency.
Temporarily we need to add an Application class, as internal jetification
doesn't seem to handle declaring MultiDexApplication in AndroidManifest.xml.

issue:#7421
PiperOrigin-RevId: 313145023
2020-05-27 18:59:43 +01:00
ibaker
1f125425a8 Add Guava dep to exo-workmanager module
This fixes the "cannot access ListenableFuture" build error, even though
it seems on the surface like we shouldn't need a Guava dependency here.

There's more info about what's going on here:
https://blog.gradle.org/guava

PiperOrigin-RevId: 312712991
2020-05-27 18:59:31 +01:00
Joris de Groot
86b31e2954 Added storage not low as download requirement
Added monitoring storage levels in RequirementsWatcher
Added dependency on extension-workmanager to the demo app to be able to test with WorkManagerScheduler
Added getSupportedRequirements method to Scheduler interface
Implemented getSupportedRequirements for schedulers
2020-05-19 15:22:43 +02:00
andrewlewis
ef615754db 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-18 16:14:19 +01:00
andrewlewis
793f12da6d 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-18 16:13:15 +01:00
Oliver Woodman
932a8fcf3d Merge pull request #7367 from inv3rse:keep-paused-state-during-buffering
PiperOrigin-RevId: 311623784
2020-05-15 10:58:46 +01:00
andrewlewis
c4cd559315 Upgrade IMA SDK to 3.19.0
PiperOrigin-RevId: 311106612
2020-05-14 22:21:49 +01:00
andrewlewis
8ed82e7621 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-14 22:21:39 +01:00
andrewlewis
3478ef3108 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-14 22:21:30 +01:00
olly
0d22d02df5 FFmpeg extension: Correctly pad input buffers
FFmpeg requires input buffers to be sized larger than the size
of the data they contain. This is to allow optimized decoder
implementations that read data in fixed size chunks, without
the risk of such decoders reading beyond the end of the buffer.

Issue: #2159
PiperOrigin-RevId: 310946866
2020-05-14 22:20:55 +01:00
olly
8ae8bf7b21 Split fetching FFmpeg from build_ffmpeg.sh
It makes it harder to work with a different branch. Also make
the FFmpeg instructions consistent with those of the other
extensions (e.g., by removing the "jni" part of the path from
the FFMPEG_EXT_PATH variable.

PiperOrigin-RevId: 310937751
2020-05-14 22:20:36 +01:00
andrewlewis
88223882d7 Remove deprecated symbols in ImaAdsLoader
PiperOrigin-RevId: 310901647
2020-05-14 22:20:08 +01:00
andrewlewis
6aab5e2e61 Upgrade IMA SDK to 3.18.2
PiperOrigin-RevId: 310883076
2020-05-14 22:19:14 +01:00
olly
9a4ec54bdf Propagate Format through extension video decoders
We currently propagate only ColorInfo, but propagating the whole Format
is generally useful (e.g., to get the frame-rate on the output side of
the decoder).

PiperOrigin-RevId: 310359650
2020-05-14 22:18:55 +01:00
insun
85cf5768eb Let CastPlayer#getTrackSelector return null
Change CastPlayer#getTrackSelector to return null
instead of throwing exception.

PiperOrigin-RevId: 310319964
2020-05-14 22:18:00 +01:00
insun
c7f2df0fd9 Add Player#getTrackSelector()
PiperOrigin-RevId: 310242733
2020-05-14 22:17:51 +01:00
Dennis Fölster
8d2406ece3 Keep the paused state during buffering without playWhenReady.
The PlaybackStateCompat#STATE_BUFFERING expects the playback to begin
once enough data has been buffered. This is however not the case if
playWhenReady is not set on the exoplayer.
2020-05-12 14:43:47 +02:00
krocard
efff7a9d22 Propagate sample rate and format deeper
#exo-offload

PiperOrigin-RevId: 310150780
2020-05-06 20:57:44 +01:00
Oliver Woodman
b1b93069a9 Merge pull request #7324 from tpiDev:cronet/migrate-to-play-services-17-0-0
PiperOrigin-RevId: 310115628
2020-05-06 20:57:06 +01:00
olly
62e1000df4 Upgrade OkHttp to 3.12.11.
PiperOrigin-RevId: 310114401
2020-05-06 20:56:55 +01:00
olly
ee14fe7adf Align Decoder(Audio|Video)Renderer decoder re-use logic
- Fix DecoderAudioRenderer to re-init codec if the DRM session changes.
- Add canKeepCodec to DecoderVideoRenderer. Previously it was assumed
  that the decoder could be re-used, but this will not be true in all
  cases for FfmpegVideoRenderer.

Issue: #7079
PiperOrigin-RevId: 309935278
2020-05-05 18:38:50 +01:00
andrewlewis
fa7d26dd9f Migrate to new IMA preloading APIs
issue:#6429
PiperOrigin-RevId: 309906760
2020-05-05 18:38:14 +01:00
andrewlewis
965383879e Add tests for snap-back to midroll
These tests require longer content so that the ads are spaced apart far enough
to trigger preloading while content is playing (rather than immediately as soon
as a position is reported).

PiperOrigin-RevId: 309733826
2020-05-05 18:37:30 +01:00
andrewlewis
99a3cc2877 Add test ads response with two midrolls
Also clean up naming of test ads responses.

PiperOrigin-RevId: 309728625
2020-05-05 18:37:21 +01:00
olly
dcae3c2609 CronetDataSource: Use standard InterruptedIOException
PiperOrigin-RevId: 309710359
2020-05-05 18:37:03 +01:00
Tomasz Pieszko
2cae3b3905 [MOD] Use Cronet from Play Services, as default instead of using embedded one. It lets to reduce APK size ~8MB. 2020-05-04 11:18:43 +02:00
Tomasz Pieszko
e4f6666cb2 [MOD] Use Cronet from Play Services, as default instead of using embedded one. It lets to reduce APK size ~8MB. 2020-05-04 11:12:13 +02:00
andrewlewis
625c734726 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-01 19:46:22 +01:00
bachinger
b22783f895 Rename sourceUri to uri
PiperOrigin-RevId: 308918151
2020-05-01 19:46:04 +01:00
olly
4cb8cc8a16 Fix broken @link
PiperOrigin-RevId: 308835671
2020-05-01 19:45:03 +01:00
andrewlewis
5c2169776a 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-01 19:44:18 +01:00
vigneshv
de7c2c36d8 av1_extension: Add a heuristic to determine default thread count
Android scheduler has performance issues when a device has a
combiation of big/medium/little cores. Add a heuristic to set the
default number of threads used for deocding to the number of
"performance" (i.e. big) cores.

PiperOrigin-RevId: 308683989
2020-05-01 19:43:43 +01:00
andrewlewis
a7c301cb23 Pass app context to the IMA SDK
Notes: this doesn't fix the current issue where the component containing the
ad overlay view leaks, but is good practice anyway.
PiperOrigin-RevId: 308582036
2020-04-27 11:34:29 +01:00
ibaker
9dac400734 Rename ExtractorAsserts "test everything" methods
This makes the distinction more clear between the methods that test
a specific behaviour (and are meant to be used with parameterized
tests) and those that test everything in one go.

Also add a TODO to FlacExtractorTest to migrate it when we can

PiperOrigin-RevId: 308228421
2020-04-27 10:41:49 +01:00
ibaker
0e6b318138 Remove ExtractorAsserts overloads that take a Context
Also mark the two assertOutput methods private, to make the API surface
smaller.

PiperOrigin-RevId: 308228186
2020-04-27 10:41:49 +01:00
bachinger
1699ab0d18 Add missing nullable annotations
The MediaSessionConnector gets a Bundle passed to the MediaSession.Callback
from the framework which can be null. This needs to be properly annotated
with @Nullable.

Issue: #7234
PiperOrigin-RevId: 307822764
2020-04-27 10:40:01 +01:00
ibaker
ece8d22357 Remove a suppression introduced by the checker-framework 3.3.0 upgrade
Update the comment on a suppression of Field.get(null) which is safe
but blocked by the checker.

These suppressions were introduced in d1e0572448

PiperOrigin-RevId: 307036441
2020-04-20 13:28:07 +01:00
olly
d1e0572448 Suppress warnings in preparation for Checker Framework 3.3.0 upgrade.
PiperOrigin-RevId: 305810757
2020-04-15 17:36:11 +01:00
olly
2e51182f53 Update misc dependencies
PiperOrigin-RevId: 305503804
2020-04-08 21:49:03 +01:00
olly
376d02ac3f Upgrade cast dependency
Issue: #7191
PiperOrigin-RevId: 305502293
2020-04-08 21:48:45 +01:00
ibaker
8df6a4b301 Remove nullness warning suppressions from Matcher.group
These were introduced in c7164a30a0

In each case I checked that the groups are not optional,
so if they match they must be non-null.

PiperOrigin-RevId: 305213293
2020-04-07 13:39:13 +01:00