261 Commits

Author SHA1 Message Date
ibaker
8f3b4f590f Fix typos flagged by lint
PiperOrigin-RevId: 451135097
2022-05-30 16:30:11 +00:00
ibaker
26a1817ebf Rollback of e01bb47263
*** Original commit ***

Rollback of 07302a23bd

*** Original commit ***

Remove `@Nullable` from `MediaSource.Factory` setters

The null-behaviour of these methods creates a minimization footgun,
because **any** call to these setters will prevent R8 from removing
the default implementation (even if it's never used by the app) - this
is because R8 can't tell the default imple...

***

PiperOrigin-RevId: 450453325
2022-05-23 17:12:22 +01:00
bachinger
a8a4faa28c Do not setOffloadEndOfStream if AudioTrack is not playing
AudioTrack.setOffloadEndOfStream should be called after a track
has been buffered. Additionally, the AudioTrack must be playing.

It has been observed that for very short media (<1s), the AudioTrack
might not have started immediately after the read that buffered
the audio.

In such a situation, calling AudioTrack.setOffloadEndOfStream throws
and playback fails.

Avoid this failure by checking that the AudioTrack is playing before
calling setOffloadEndOfStream.

This means that very short gapless media will not be gapless, this was
deemed acceptable given that such very short media should be very rare
in offload.

PiperOrigin-RevId: 450431146
2022-05-23 15:13:43 +01:00
ibaker
89194dee59 Add DefaultMediaSourceFactory.setDataSourceFactory
Also add this to the stable API instead of the constructor that takes
`DataSource.Factory`.

PiperOrigin-RevId: 450414119
2022-05-23 13:26:05 +01:00
ibaker
1d139174fd Rollback of 07302a23bd5894d57514c68b2db499ac46726e77
*** Original commit ***

Remove `@Nullable` from `MediaSource.Factory` setters

The null-behaviour of these methods creates a minimization footgun,
because **any** call to these setters will prevent R8 from removing
the default implementation (even if it's never used by the app) - this
is because R8 can't tell the default implementation is only used if the
parameter is `null`.

PiperOrigin-RevId: 450410833
2022-05-23 13:01:22 +01:00
ibaker
07302a23bd Remove @Nullable from MediaSource.Factory setters
The null-behaviour of these methods creates a minimization footgun,
because **any** call to these setters will prevent R8 from removing
the default implementation (even if it's never used by the app) - this
is because R8 can't tell the default implementation is only used if the
parameter is `null`.

PiperOrigin-RevId: 450386627
2022-05-24 11:07:07 +01:00
tonihei
38b1338844 Remove 5G-NSA detection on API 29/30.
This detection relies on an unsupported workaround and may trigger
permission warnings in tools analyzing permission usage although
no permission is needed or requested by app code.

Given the majority of 5G-NSA playbacks are on API 31+ by now,
we can remove this path to avoid the permission confusion and the
unsupported detection workaround.

PiperOrigin-RevId: 450382586
2022-05-24 11:06:09 +01:00
ibaker
994c33f56f Fix comment in MediaCodecRenderer
This constant name was updated in 1bcf1cf9f7

PiperOrigin-RevId: 449969093
2022-05-24 11:04:05 +01:00
rohks
001090cc43 Migrate leaf listeners of Player to new onCues override
PiperOrigin-RevId: 449587030
2022-05-24 11:02:03 +01:00
ibaker
7c235d2b84 Remove all null-tolerant methods from BundleableUtil.
In most cases it's clearer to in-line these null-checks with ternary
operators.

PiperOrigin-RevId: 449474621
2022-05-24 10:56:01 +01:00
tonihei
1a171a004a Add missing equals to MergingMediaPeriod.ForwardingTrackSelection
This causes a bug where the forwarded selections are no longer
assumed equal and the child MediaPeriods will think they need
to reset streams even though the selection stayed the same.

Issue: Issue: google/ExoPlayer#10248
PiperOrigin-RevId: 449454038
2022-05-24 10:53:39 +01:00
rohks
c728647290 Create new class to store cues and timestamp.
We need to pass timestamp for the list of cues so we are defining a new class CueGroup which will store both cues and timestamp.

PiperOrigin-RevId: 449212054
2022-05-24 10:49:48 +01:00
ibaker
25279ad477 Add DefaultMediaSourceFactory.{set,clear}LocalAdInsertionConfig
Deprecate the setAdsLoaderProvider and setAdViewProvider methods these
replace.

PiperOrigin-RevId: 448251423
2022-05-24 10:41:26 +01:00
tonihei
fe9e6da8a5 Remove network type test restrictions for API 29/30
Network type detection on these API levels couldn't be tested
yet because of a missing Robolectric feature. This was fixed by
the recent Robolectric upgrade and the restrictions can be removed.

This also requires to replicate the platform hack we rely on on
these API levels.

PiperOrigin-RevId: 448240431
2022-05-24 10:39:39 +01:00
hmzh
2725b4c479 Adds key functionality for basic MIDI synthesization
- Add a MidiRenderer skeleton with basic playback
- Add MidiDecoder with placeholder synthesizer (JSyn) impl
- Make MidiExtractor feed placeholder data
- Add Renderer extension loaders for MIDI

PiperOrigin-RevId: 448212797
2022-05-24 10:34:45 +01:00
ibaker
4f616d6003 Remove ExoPlayer's RawCcExtractor
RawCC is a Google-internal subtitle format, and is no longer used with
ExoPlayer.

PiperOrigin-RevId: 446950691
2022-05-09 11:02:25 +01:00
huangdarwin
337b7f769d GL: Update exoplayer to use bindTexture.
Refactoring change only.

PiperOrigin-RevId: 446475708
2022-05-09 10:57:54 +01:00
christosts
c8c7ec61f0 Add TrackSelector.release()
The TrackSelector is released when the player is released. The
TrackSelector can be reused if TrackSelector.init() is called again.

PiperOrigin-RevId: 446439717
2022-05-09 10:57:08 +01:00
christosts
90600e985e Use Android 12L APIs directly
Some APIs from Android 12L were used either via reflection or
constants values were hard-coded. We can now use these APIs directly
since we upgraded the compile SDK version to 32.

PiperOrigin-RevId: 446167543
2022-05-09 10:48:43 +01:00
ibaker
9a67b30750 Migrate usages from C.TYPE_* to C.CONTENT_TYPE_*
PiperOrigin-RevId: 446156308
2022-05-09 10:46:04 +01:00
olly
90ce9a6787 Add AV1 support to the getCodecMaxInputSize function.
PiperOrigin-RevId: 445973162
2022-05-09 10:43:33 +01:00
ibaker
5784068838 Allow stable API users to use DebugTextViewHelper
This is used from the main demo app.

PiperOrigin-RevId: 445420580
2022-05-09 10:41:03 +01:00
ibaker
3dff9fbe36 Allow users of the stable API to register an EventLogger
Overriding any methods of AnalyticsListener requires using the unstable
API. In future we can incrementally add AnalyticsListener methods to the
stable API.

PiperOrigin-RevId: 445420361
2022-05-09 10:40:21 +01:00
ibaker
abbd7652b1 Add more UI symbols (and some others) to the stable API
These are used by the main demo app and would be reasonably used by
other relatively simple media playback apps.

PiperOrigin-RevId: 445371266
2022-05-09 10:37:42 +01:00
ibaker
1b2e9da0af Rename CONTENT_TYPE_ @AudioContentType values to AUDIO_CONTENT_TYPE_*
This is consistent with the IntDef name, and frees up the CONTENT_TYPE_
prefix for the @ContentType values (which are currently just TYPE_*,
and therefore ambiguous with lots of other 'type' values in C).

PiperOrigin-RevId: 445356476
2022-05-09 10:34:27 +01:00
ibaker
c09647988f Remove unneeded warning suppression from FrameworkMediaDrm
PiperOrigin-RevId: 445162900
2022-05-09 10:29:31 +01:00
samrobinson
d194ba93ac Revert of a29206d891193fc7efa312edd551e8e4ee5729b0
PiperOrigin-RevId: 444347415
2022-04-25 20:59:35 +01:00
samrobinson
f0b34b8f4c Rollback of 8a4168271d
*** Original commit ***

Keep AudioTrack on flush as default

***

PiperOrigin-RevId: 444327724
2022-04-25 19:38:07 +01:00
samrobinson
b816a3fe21 Keep AudioTrack on flush as default
PiperOrigin-RevId: 444264961
2022-04-25 15:38:36 +01:00
ibaker
b7a41519e6 Fix warning about potential integer overflow in DefaultAudioSink
PiperOrigin-RevId: 444221415
2022-04-26 15:05:24 +01:00
samrobinson
a29206d891 Align MediaCodec and Decoder AudioRenderer onDisabled logic.
PiperOrigin-RevId: 443156130
2022-04-26 14:54:29 +01:00
christosts
63052e1a7c DownloadHelper: propagate errors to callback
When downlading an adaptive asset, if an ExoPlaybackException happens
during track selection, the player raises an
UnsupportedOperationException which is not handled gracefully and can
crash the app main thread.

This change catches the error and forwards it to
DownloadHelper.Callback.onPrepareError() as an IOException.

PiperOrigin-RevId: 443015332
2022-04-26 14:49:38 +01:00
ibaker
5186798db9 Rename Player.COMMAND_GET_TRACK_INFOS to COMMAND_GET_TRACKS
`Player.getCurrentTracksInfo` was renamed to `Player.getCurrentTracks` in
83daa052cb.

PiperOrigin-RevId: 441825078
2022-04-26 14:41:41 +01:00
olly
d9f0c2c071 Tracks.Group/TrackGroup variable naming disambiguation
PiperOrigin-RevId: 441712166
2022-04-26 14:37:35 +01:00
olly
83daa052cb Rename TracksInfo and TrackGroupInfo
1. TracksInfo is renamed to Tracks
2. TracksInfo.TrackGroupInfo is renamed to Tracks.Group

PiperOrigin-RevId: 441232373
2022-04-26 14:30:14 +01:00
olly
c007068ddb Expect PresentationTime Discontinuity During Stream Transitions
PiperOrigin-RevId: 440378974
2022-04-26 14:21:36 +01:00
huangdarwin
9a7b71b7c2 Media Solutions: Fix misspelling for "roboletric"
roboletric -> robolectric

PiperOrigin-RevId: 440101421
2022-04-26 14:16:37 +01:00
olly
eb038265f3 Make MediaCodecVideoRenderer.getCodecMaxInputSize public.
PiperOrigin-RevId: 439866306
2022-04-26 14:12:25 +01:00
Ian Baker
ea61511a24 Merge pull request #10047 from LuGO0:9432/added-filtering-for-forced-text-tracks
PiperOrigin-RevId: 439262085
2022-04-06 11:50:35 +01:00
olly
f8f8b75500 Exclude TrackGroup fields/methods from the stable API
App code should get all of this information from TrackGroupInfo,
and should only need TrackGroup as a key to use for overrides.

PiperOrigin-RevId: 438840925
2022-04-06 11:46:49 +01:00
hschlueter
81ab6c730d Fix non-inclusive language in class names.
https://source.android.com/setup/contribute/respectful-code#term-examples

PiperOrigin-RevId: 438335305
2022-04-06 11:28:30 +01:00
ibaker
9d48cff9ff Remove IntDef warning suppression from DefaultTrackSelector
The problem is not the IntDef array, it's the fact the lint tool
is unable to correctly infer the annotations on the lambda parameters
without them being explicitly annotated. It seems explicitly annotating
is better than suppressing all IntDef warnings in the whole method.

PiperOrigin-RevId: 437969271
2022-04-06 11:17:06 +01:00
andrewlewis
c87d16ca63 Handle non-standard MIME type on LG AC3 decoder
PiperOrigin-RevId: 437057336
2022-03-25 14:06:06 +00:00
ibaker
fe8996e634 Allow stable API users to customise the DataSource used
Also stabilise the 3 HTTP-based DataSource implementations:
* DefaultHttpDataSource
* OkHttpDataSource
* CronetDataSource

PiperOrigin-RevId: 436690643
2022-03-23 10:05:27 +00:00
ibaker
534bc5ad9d Deprecate DefaultDrmSessionManager#setDrmUserAgent
PiperOrigin-RevId: 436521418
2022-03-22 18:13:26 +00:00
ibaker
54d3e45473 Switch DRM and download components from HttpDataSource to DataSource
All the (Http)DataSource interactions can be done with the DataSource
interface and don't need HttpDataSource.

PiperOrigin-RevId: 436520898
2022-03-22 18:11:31 +00:00
olly
5d8ac644a6 Move TrackGroupArray back to ExoPlayer
PiperOrigin-RevId: 435325454
2022-03-17 13:08:56 +00:00
aquilescanta
1a6e176873 Rework if condition to avoid NewApi lint error
Some infra thinks the if does not protect against API incompatibilities
(example: Android's soong build system). AndroidStudio 2021.3.1 also
signals a warning.

#minor-release

PiperOrigin-RevId: 435027073
2022-03-16 13:01:35 +00:00
olly
298e61398e Improve EventLogger metadata logging
1. Fix indentation
2. Fix intention to only log one Metadata block

PiperOrigin-RevId: 434818209
2022-03-15 19:02:41 +00:00
olly
2ea902c1b2 Move TrackSelection back to ExoPlayer module
PiperOrigin-RevId: 433729648
2022-03-24 17:21:11 +00:00