1297 Commits

Author SHA1 Message Date
aquilescanta
b866c5e424 Fix the FFmpeg extension build
Since gradle 4.0, CMake imported libraries are bundled in the APK, so
manually bundling them causes a duplication which breaks the build.

Issue: #7906
PiperOrigin-RevId: 332012375
2020-09-16 16:36:59 +01:00
olly
b999977c9d Dev guide: Copy editing
Also changed the links that describe configuring the
player for ad insertion to link to the ads page.

PiperOrigin-RevId: 331349846
2020-09-13 00:02:32 +01:00
olly
5a009ab476 Remove references to cross-protocol redirects for Cronet
There's no option to enable them. This is probably a copy/paste error
from DefaultHttpDataSourceFactory.

PiperOrigin-RevId: 331334263
2020-09-12 21:05:18 +01:00
olly
bff7ac0dbe Clean up some lint warnings
PiperOrigin-RevId: 331162350
2020-09-11 17:31:03 +01:00
bachinger
99cdf2ca4d MediaItemify the IMA extension README and the ads page in dev guide
PiperOrigin-RevId: 331155539
2020-09-11 17:30:54 +01:00
andrewlewis
156166f57c Fix handling of empty ad groups at non-integer cue points
Issue: #7889
PiperOrigin-RevId: 331149688
2020-09-11 17:30:43 +01:00
olly
cdcb30ed21 Exclude Guava transitive annotation dependencies
PiperOrigin-RevId: 331148067
2020-09-11 16:01:15 +01:00
andrewlewis
033232784a Improve DEBUG VideoProgressUpdate logging
PiperOrigin-RevId: 330918689
2020-09-11 13:24:22 +01:00
andrewlewis
06de13ecae Add a setter for ad error listeners
This is useful because ImaAdsLoader.getAdsLoader() can now return null
(before ads have been requested), and it avoids the app needing to get
an AdsManager to attach its listener.

PiperOrigin-RevId: 330907051
2020-09-11 13:23:54 +01:00
olly
b2b08ade99 Make User-Agent optional
PiperOrigin-RevId: 330593247
2020-09-09 09:41:51 +01:00
olly
3110587fbe Fix extension renderer test names + add FfmpegVideo case
PiperOrigin-RevId: 330409635
2020-09-09 09:41:32 +01:00
olly
04f67e4adc Simplify DefaultMediaSourceFactory ad configuration
- Use a setter, which is consistent with how other optional
  components are passed.
- Remove nesting where a provider provides another provider.
  Since AdSupportProvider then only provides one thing, it
  can be renamed to AdsLoaderProvider, which more clearly
  expresses what it provides.

PiperOrigin-RevId: 330396334
2020-09-07 20:43:41 +01:00
olly
8e5336c59e Dev guide: Start updating the download page
PiperOrigin-RevId: 329719402
2020-09-07 20:41:55 +01:00
olly
b79e2e069f SessionPlayerConnector: Use setter for ControlDispatcher
This brings SessionPlayerConnector in line with other
components that use a ControlDispatcher in the ExoPlayer
library, all of which have a setter.

PiperOrigin-RevId: 329665767
2020-09-07 20:41:00 +01:00
andrewlewis
47561f200f Fix handling of incompatible VPAID ads
Issue: #7832
PiperOrigin-RevId: 329497598
2020-09-07 20:40:13 +01:00
gyumin
d155416c54 Add Util.postOrRun
To avoid repetition, it adds Util.postOrRun and replaces existing
instances with the util method.

PiperOrigin-RevId: 329472769
2020-09-07 20:40:04 +01:00
andrewlewis
74c493f51e Add back support for setting audio pitch
To play slow motion streams where the audio has been recorded at
slower speeds, it is necessary to be able to resample (rather than
time-stretch) the audio. This change undeprecates back the previously
deprecated PlaybackParameters class to allow apps to set pitch.

PiperOrigin-RevId: 328703116
2020-08-27 12:06:41 +01:00
jaewan
25c26cdbb4 Return state masked Player values from SessionPlayerConnector
Before this CL, SessionPlayerConnector getters had returned
UNKNOWN_TIME in idle state. It was because
SessionPlayerConnector had followed AndroidX media2
MediaPlayer's behavior, which was the baseline code of the
SessionPlayerConnector.

With this CL, SessionPlayerConnector getters directly return
underlying Player's value, rather than considering calls
in IDLE state as an exception and fallbacks to the default
UNKNOWN_TIME.

PiperOrigin-RevId: 327420940
2020-08-21 12:50:56 +01:00
jaewan
e965ed92f8 Rename DefaultMediaItemProvider to MediaIdMediaItemProvider
PiperOrigin-RevId: 327307736
2020-08-21 12:50:29 +01:00
olly
8c5af10ab0 Don't pass INDEX_UNSET to ExoPlayer seek methods
It's not valid, and will cause IllegalSeekPositionException to be thrown

PiperOrigin-RevId: 327301325
2020-08-21 12:50:20 +01:00
olly
ee743870d8 Media2 extension: Make DefaultMediaItemConverter more useful
- Remove throwing of IllegalStateException
- Make it non-final so additional metadata can be more easily filled in

PiperOrigin-RevId: 327292208
2020-08-21 12:50:11 +01:00
jaewan
bddb29c431 Ban FileMediaItem and CallbackMediaItem
PiperOrigin-RevId: 327268964
2020-08-21 12:50:01 +01:00
jaewan
2299c4e609 Update SessionPlayerConnector documentation
ExoPlayer is now the trusted source of playlist and can be
used by other components without breaking
SessionPlayerConnector's cached playlist.

PiperOrigin-RevId: 327266929
2020-08-21 12:49:52 +01:00
jaewan
4782e227eb Rename androidX MediaItem to media2 MediaItem
In AndroidX, both media1 and media2 have MediaItem classes,
so change the naming to remove ambiguity.

PiperOrigin-RevId: 327261260
2020-08-21 12:49:43 +01:00
jaewan
e6d36e8b92 Add SessionPlayerConnector ctor that use DefaultMediaItemConverter
PiperOrigin-RevId: 327258863
2020-08-21 12:49:34 +01:00
jaewan
b39721f4b5 Make ExoPlayer as the trusted source of playlist
Playlist can now be obtained directly from Timeline windows
in any state. So make ExoPlayer as the trusted source of
playlist, instead of SessionPlayerConnector.

PlayerWrapper still need to keep the list of media items.
It's used to detect whether the Timeline change is caused by
changes in media items or not, and only notify
SessionPlayer.PlayerCallback#onPlaylistChanged() only when
the playlist is really changed.

PiperOrigin-RevId: 327231820
2020-08-21 12:49:25 +01:00
jaewan
be98509e03 Workaround test failure with stable release of media2.session
MediaSession requires prepared Looper in 1.0.3-stable release,
which is the latest stable release for now.

The requirement would be removed in 1.1.0-stable, but workaround
is needed meanwhile.

PiperOrigin-RevId: 327220042
2020-08-21 12:48:57 +01:00
ibaker
f0ae8afd80 Separate the dump files from the test assets
This allows us to more easily create different dumps derived from the
same assets.

This moves media/source files from `assets/` to `assets/media/` and
dump files from `assets/` to `assets/extractordumps/` and
`assets/audiosinkdumps/` as appropriate. I intend to add
`assets/playbackdumps/` in a future CL.

PiperOrigin-RevId: 326986283
2020-08-17 16:13:53 +01:00
olly
49bf83a169 Media2: Remove MediaSourceFactory + DataSourceCallback
- Applications should generally use DefaultMediaSourceFactory,
  or their own custom implementation if they need one. Having the
  media2 extension implement its own version directly doesn't seem
  that useful.
- Remove support for CallbackMediaItem. This type of MediaItem
  doesn't go cross-process, and it seems like there would never
  be a use case where an app would need to generate one locally.
  If an app needs to provide data from a custom source, it should
  hook into ExoPlayer's way of doing this (i.e., use a UriMediaItem
  with a custom scheme, and inject a custom DataSource that can
  handle this scheme).

PiperOrigin-RevId: 326914465
2020-08-17 16:13:34 +01:00
olly
42cf213aea Media2 tests: Simplify code
- Use ExoPlayer DataSource instrumentation to intercept reads
- Use ExoPlayer Resource URIs
- Use ExoPlayer DefaultMediaSourceFactory

PiperOrigin-RevId: 326912324
2020-08-17 16:13:25 +01:00
jaewan
c2ac33af1b Clean up PlayerWrapper exception log
PlayerWrapper throws Exception if getters is called in the
STATE_IDLE. In that case, log may print 50+ lines of stack
traces. It's verbose and can be considered as serious issue.

This CL include folloing changes
  - Change to use ExoPlayer's log class
  - Adjust log level, because it would be consumed by caller
  - Leave log when the debug flag is turned on.

Another CL will remove exceptions between PlayerWrapper and
and SessionPlayerConnector, not to use Exception for ordinary
control flow as the Effective Java suggests.

PiperOrigin-RevId: 326614559
2020-08-17 16:12:48 +01:00
olly
cdf07f1745 Media2 tests: Clean up assets
Even after this change, it's unclear to me why we need so many
assets for these tests. Just doing a minimal pass for now though!

PiperOrigin-RevId: 326613941
2020-08-17 16:12:39 +01:00
jaewan
e6bf7bd0ff Migrate to use Player's top level playlist API
Being specific, this includes following changes
  - Remove PlaylistManager and TimelinePlaylistManager
    and use Player's playlist API directly.
  - Replace ConcatenatingMediaSource uses with
    ExoPlayer MediaItem.
  - Replace PlaybackPreparer uses with Player#prepare()
  - Add MediaItemConverter for developers to customize
    converting AndroidX MediaItems to ExoPlayer MediaItems
    and vice-versa.
  - Add DefaultMediaItemConverter for providing default
    implementation of both MediaItemConverter
    and MediaSourceFactory.

Note that removing PlaylistManager loses the ability
to suppress individual playlist API. But decided to remove
for simpler API set. The feature can be added back later
via explicit request.

PiperOrigin-RevId: 326463492
2020-08-17 16:12:21 +01:00
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