1164 Commits

Author SHA1 Message Date
ibaker
da4d55635c Create a DumpFileAsserts from the dumpfile logic in FakeExtractorOutput
Also use it to replace the same logic in CapturingAudioSink

PiperOrigin-RevId: 325969455
2020-08-17 16:08:24 +01:00
tonihei
ad346fbdbe Fix FfmpegVideoRenderer tag
PiperOrigin-RevId: 325857202
2020-08-17 16:08:06 +01:00
andrewlewis
acc8453628 Add support for audio-only ad display containers
Issue: #7689
PiperOrigin-RevId: 325752377
2020-08-17 16:05:56 +01:00
jaewan
f2866a4942 Notify current media item to legacy controllers
This is the workaround for b/159147455.

The issue will be fixed in media2-session 1.1.0-stable, but we'd
better to have workaround until it's ready.

PiperOrigin-RevId: 325434543
2020-08-07 19:04:56 +01:00
olly
5de56cd618 Opus: Add utility for handling header and initialization data
PiperOrigin-RevId: 325202386
2020-08-07 19:02:14 +01:00
gyumin
6e11d32092 Use static import for TimeUnit
PiperOrigin-RevId: 324941042
2020-08-07 19:01:07 +01:00
olly
4d03d30890 Audio extension decoders: Pass decoder to getOutputFormat
It seems generally useful to have access to the decoder in
getOutputFormat. We're currently working around lack of access
by using member variables in the concrete audio extension
renderers. In the case of the Ffmpeg extension, holding a
reference to the decoder is preventing it from being garbage
collected when the decoder is released by the base class.

PiperOrigin-RevId: 324799670
2020-08-07 19:00:18 +01:00
claincly
ea01489c8b Added float output mode for Opus extension
The working of libOpus is different from ffmpeg. With ffmpeg, the decoder can
be configured to output floating point PCM. While in libOpus, floating samples
are acquired by calling a different function. This is the reason the new JNI
functions and the logic in OpusDecoder/LibopusAudioRenderer is added to
support float output.

PiperOrigin-RevId: 324661603
2020-08-07 18:59:50 +01:00
andrewlewis
9392dff225 Call VideoAdPlayerCallback.onLoaded
This callback was not notified before, which could theoretically lead to ad
loading timing out. In practice it doesn't currently happen because the timeout
appears to start when the ad cue point is reached, not when loadAd is called.

We notify onLoaded when the ad media period is prepared (for HTML5 the
recommendation is to notify on the HTMLMediaElement 'canplay' event, which this
roughly corresponds to).

PiperOrigin-RevId: 324568407
2020-08-07 18:58:31 +01:00
krocard
7b300ca411 Build cmake AV1 outside of CITC
PiperOrigin-RevId: 323988640
2020-08-01 12:56:12 +01:00
aquilescanta
867d45ca62 Simplify the av1 extension build system
Also add cpu_features to .hgignore.

PiperOrigin-RevId: 323804458
2020-08-01 12:55:36 +01:00
aquilescanta
684994fe61 Remove Renderer references to Format.drmInitData
PiperOrigin-RevId: 323392470
2020-07-28 00:00:27 +01:00
ibaker
fda3b3d8ec Use static imports for methods that make sense without their class name
PiperOrigin-RevId: 323349585
2020-07-27 23:59:52 +01:00
ibaker
ce2e6e2fd6 Hide ParsableByteArray#data behind a getter
This allows us to enforce the limit because the array can only be
reassigned through reset(byte[]) or reset(byte[], int) (which update
the limit)

PiperOrigin-RevId: 323339960
2020-07-27 23:59:34 +01:00
ibaker
478f59fd08 Replace ExoPlayer's functional types with Guava alternatives
This removes Supplier, Function and Predicate. Consumer is kept because
Guava doesn't have an equivalent (Java 8 does, but we can't use that
yet).

#exofixit

PiperOrigin-RevId: 323324392
2020-07-27 23:59:25 +01:00
jaewan
9743e47f1f Remove unncessary TODOs
PiperOrigin-RevId: 323286632
2020-07-27 23:59:07 +01:00
andrewlewis
f24ba73b80 Add setter for companion ad slots
PiperOrigin-RevId: 322965540
2020-07-27 23:58:30 +01:00
aquilescanta
19602ca4ca Use CMake to build the ffmpeg audio extension
PiperOrigin-RevId: 322793308
2020-07-24 10:48:16 +01:00
olly
6d92eebe51 Revert Format back to only containing audio encoding for PCM
PiperOrigin-RevId: 322683545
2020-07-24 10:46:37 +01:00
ibaker
84e13e3bd0 Replace media2 SettableFuture with Guava version
PiperOrigin-RevId: 322530026
2020-07-24 10:44:11 +01:00
olly
d77ce9eda0 Remove deprecated calls to external APIs
PiperOrigin-RevId: 322346067
2020-07-24 10:43:44 +01:00
olly
576ef82191 Remove explicit use of Robolectric PAUSED looper mode
It's now the default everywhere, so there's no need to specify it
explicitly.

PiperOrigin-RevId: 322153319
2020-07-24 10:41:00 +01:00
olly
df1536ab24 Migrate WorkManagerScheduler to non-deprecated WorkManager.getInstance
PiperOrigin-RevId: 322143769
2020-07-24 10:40:33 +01:00
olly
0cd15d9158 Proactively check listener arguments are non-null
PiperOrigin-RevId: 322143359
2020-07-24 10:40:24 +01:00
ibaker
c669756f7d Add a missing deprecation suppression in CastPlayer
PiperOrigin-RevId: 322115322
2020-07-24 10:39:21 +01:00
andrewlewis
7fce04a67f Depend on the IMA extension in noExtensions variant
Also use the cronet extension in the demo app.

PiperOrigin-RevId: 322108530
2020-07-24 10:39:03 +01:00
ibaker
3074365348 Suppress deprecation warning in CastPlayer
PiperOrigin-RevId: 321774583
2020-07-24 10:38:26 +01:00
ibaker
b755df1338 Update PlayerWrapper methods to return void where possible
Suggested during the review of 437d1b6e9a

This keeps the Runnable -> Callable<Boolean> conversion encapsulated
inside SessionPlayerConnector which makes it clearer why it's needed.

PiperOrigin-RevId: 321553744
2020-07-24 10:37:32 +01:00
olly
363a2a3b45 DefaultRenderersFactory: Add setting to enable float output
This also renders https://github.com/google/ExoPlayer/pull/7625 redundant.

PiperOrigin-RevId: 321544195
2020-07-24 10:37:05 +01:00
ibaker
e682f53b3c Migrate overrides of deprecated onPlaybackParametersChanged
This method has been replaced by onPlaybackSpeedChanged

PiperOrigin-RevId: 321369921
2020-07-24 10:36:02 +01:00
ibaker
437d1b6e9a Migrate usages of deprecated Player#set/getPlaybackParameters()
PiperOrigin-RevId: 321166822
2020-07-24 10:33:36 +01:00
ibaker
93c9e93a09 Migrate usages of renderer constants in C.java to the Renderer ones
PiperOrigin-RevId: 321157794
2020-07-24 10:33:00 +01:00
ibaker
f83d478cc3 Migrate uses of prepare(MediaSource) to setMediaSource() & prepare()
PiperOrigin-RevId: 321147910
2020-07-24 10:31:57 +01:00
ibaker
b48a762f20 Migrate overrides of deprecated AdsViewProvider.getAdOverlayViews
PiperOrigin-RevId: 321121735
2020-07-24 10:31:31 +01:00
ibaker
e9a8335381 Migrate callers to pass MediaItem to createMediaSource()
createMediaSource(Uri) is deprecated.

PiperOrigin-RevId: 321121383
2020-07-24 10:31:22 +01:00
ibaker
23d680a4b4 Suppress deprecation warnings in deprecated places
PiperOrigin-RevId: 320970814
2020-07-24 10:30:53 +01:00
olly
f205539616 Use lambdas where possible
PiperOrigin-RevId: 320960833
2020-07-13 17:00:44 +01:00
olly
5c9c0e2073 Improve handling of floating point audio
- DefaultAudioSink always supports floating point input. Make it
  advertise this fact.
- Remove the ability to enable/disable floating point output in
  FfmpegAudioRenderer, since this ability is now also provided on
  DefaultAudioSink.
- Let FfmpegAudioRenderer query the sink to determine whether it
  will output floating point PCM directly or resample it to 16-bit
  PCM.

PiperOrigin-RevId: 320945360
2020-07-13 17:00:10 +01:00
olly
21e56f571d Misc analysis fixes
PiperOrigin-RevId: 320921457
2020-07-13 14:04:29 +01:00
kimvde
702568c3b6 Remove some occurrences of dummy in core library
Remove occurrences in comments and private fields.

ISSUE: #7565
PiperOrigin-RevId: 320606558
2020-07-13 14:03:54 +01:00
andrewlewis
3214851fbb Migrate off deprecated IMA SDK APIs
AdDisplayContainer now takes the video ad player at construction time,
and obstructions are registered/unregistered via a new method. Also
'content complete' is now notified via ad callbacks rather than the
AdsLoader.

PiperOrigin-RevId: 320567666
2020-07-13 14:02:52 +01:00
andrewlewis
a8f1cdcfd7 Upgrade IMA SDK to 3.19.4
This brings in a fix for the IMA SDK ignoring the media load timeout.

Issue: #7170
PiperOrigin-RevId: 320557386
2020-07-10 09:09:48 +01:00
olly
e8596428c0 Pass correct formats to AudioSink
The renderers are currently constructing formats that consist of their
input format with added PCM encoding. Such formats are not self-consistent,
and this only works because DefaultAudioSink ignores the rest of the
format if the format has a PCM encoding. It would not work if the sink
implementation checked the MIME type, for example, which wouldn't be a
strange or incorrect thing for it to do.

The more correct approach is to construct a new format that properly
represents the PCM that will be provided to the sink.

This change also renames supportsOutput to supportsFormat, because
AudioSink itself has both an input and an output side, and this method
is actually evaluating support on the input side of the sink.

PiperOrigin-RevId: 320396089
2020-07-10 09:09:02 +01:00
jaewan
02f8cdf1d9 Release media2 extension
PiperOrigin-RevId: 320351394
2020-07-09 08:28:14 +00:00
andrewlewis
4c75339ee8 Tidy ImaAdsLoader method ordering
Also move implementations of some VideoAdPlayer callback methods into
their own methods. This is a no-op change except for expanding the
scope of some defensive try blocks associated with those callbacks.

Also add static imports for Math.max and Assertions helpers methods.

PiperOrigin-RevId: 319958087
2020-07-08 13:55:29 +01:00
andrewlewis
040ff47e82 Upgrade IMA to 3.19.2
PiperOrigin-RevId: 319764381
2020-07-06 16:46:58 +01:00
tonihei
e4e743a35f Fix remaining common module nullness issues.
PiperOrigin-RevId: 319183621
2020-07-03 09:01:20 +01:00
krocard
78825a41dc Store encodings in Format instead of just pcm encodings
Previously only pcm encoding were stored in Format,
this was an issue as for audio passthrough and offload
lots of code needs to pass complex format informations
(encoding, sample rate, channel count, gapless metadata)
but could not use Format and each function was taking
each as different parameter.

By allowing Format to contain any encoding, and not only
pcmEncoding, it allows to pass a Format everywhere in ExoPlayer
code that needs a Format.

This patch does not have any functional change. It is only an internal refactor.

PiperOrigin-RevId: 318789444
2020-06-29 13:33:09 +01:00
andrewlewis
eb9de7a120 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 13:46:53 +01:00
krocard
1c018e71d4 Propagate format in supportsOutput
*** Reason for rollforward ***

Fixed dependent cl was rolled forward

*** Original change description ***

Rollback of 2aac0717d7

*** Original commit ***

Propagate format in supportsOutput

It is needed to know if gapless is needed,
as gapless offload might not be supported.

***

***

PiperOrigin-RevId: 318429321
2020-06-26 11:23:19 +01:00