4698 Commits

Author SHA1 Message Date
ibaker
d711dee003 Add @deprecated javadoc to all @Deprecated @Override methods
This ensures the 'use X instead' message is easily visible in the
generated HTML for the overriding method. Currently it's not, e.g.:
https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/BasePlayer.html#getCurrentWindowIndex()

#minor-release

PiperOrigin-RevId: 452002224
2022-05-31 11:06:26 +00:00
ibaker
6dd065a128 Wrap framework AudioAttributes in new AudioAttributesV21 class
PiperOrigin-RevId: 451831531
2022-05-30 17:43:36 +00:00
bachinger
74c68b3763 Unconditionally sleep for offload
Unconditionally sleep for offload, if the audio buffer is full.
Previously ExoPlayer would not sleep if the expected wake-up was
in 2s. This was to prevent underrun if the wake-up was delayed.

Experiments have shown that the wakup audio buffer is far more
than 2s (around 1min). Additionally,
the metric was incorrect because it measured both,
AudioTrack + DSP.

Finally, this metric was erroneous after a gapless transition,
when the head position would reset to 0 and thus the computed
delay until next wakeup was too large.

PiperOrigin-RevId: 451383701
2022-05-30 17:25:45 +00:00
ibaker
53b44524cd Fix typos flagged by lint
PiperOrigin-RevId: 451135097
2022-05-26 13:11:16 +00:00
ibaker
ecea2b9e90 Rollback of e705999cf3
*** Original commit ***

Rollback of 57182ac7bd

*** 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
3c9b0b9b61 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
e39a324b19 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
274f3a13a2 Rollback of 57182ac7bd32db54d11fd41e21338a2bbfaf043c
*** 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
57182ac7bd 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 12:16:55 +01:00
tonihei
48a0301bf5 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 12:13:33 +01:00
ibaker
685761b05b Fix comment in MediaCodecRenderer
This constant name was updated in 1bcf1cf9f7

PiperOrigin-RevId: 449969093
2022-05-24 12:03:03 +01:00
rohks
75dc0e26c5 Migrate leaf listeners of Player to new onCues override
PiperOrigin-RevId: 449587030
2022-05-24 11:55:09 +01:00
ibaker
aef2f154a7 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 11:44:55 +01:00
tonihei
e9d5381b54 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 11:41:34 +01:00
rohks
a27b5398a8 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 11:27:01 +01:00
ibaker
938728ce00 Add DefaultMediaSourceFactory.{set,clear}LocalAdInsertionConfig
Deprecate the setAdsLoaderProvider and setAdViewProvider methods these
replace.

PiperOrigin-RevId: 448251423
2022-05-24 10:59:01 +01:00
tonihei
3eb6f0e806 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:51:54 +01:00
hmzh
0948fd1cd8 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:41:20 +01:00
ibaker
a0ac261873 Remove ExoPlayer's RawCcExtractor
RawCC is a Google-internal subtitle format, and is no longer used with
ExoPlayer.

PiperOrigin-RevId: 446950691
2022-05-06 12:05:37 +01:00
huangdarwin
3730c1e4d4 GL: Update exoplayer to use bindTexture.
Refactoring change only.

PiperOrigin-RevId: 446475708
2022-05-04 17:20:41 +01:00
christosts
e62338e871 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-04 14:33:50 +01:00
christosts
3830d02590 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-03 13:10:04 +01:00
ibaker
1809a0b9f9 Migrate usages from C.TYPE_* to C.CONTENT_TYPE_*
PiperOrigin-RevId: 446156308
2022-05-09 12:00:38 +01:00
olly
2283b9425e Add AV1 support to the getCodecMaxInputSize function.
PiperOrigin-RevId: 445973162
2022-05-09 11:50:42 +01:00
ibaker
b9a8da4e3e Allow stable API users to use DebugTextViewHelper
This is used from the main demo app.

PiperOrigin-RevId: 445420580
2022-05-09 11:41:07 +01:00
ibaker
07d08ba85b 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 11:14:41 +01:00
ibaker
d71140527b Remove unneeded warning suppression from FrameworkMediaDrm
PiperOrigin-RevId: 445162900
2022-05-09 10:57:47 +01:00
samrobinson
059c359fd7 Revert of 8c07f1e1a07e4e94731144e5a918f6b84aded592
PiperOrigin-RevId: 444347415
2022-04-25 20:59:35 +01:00
samrobinson
d536fe35c6 Rollback of 8da6c35bbb
*** Original commit ***

Keep AudioTrack on flush as default

***

PiperOrigin-RevId: 444327724
2022-04-26 17:02:35 +01:00
samrobinson
8da6c35bbb Keep AudioTrack on flush as default
PiperOrigin-RevId: 444264961
2022-04-26 16:59:06 +01:00
ibaker
40c27c43c8 Fix warning about potential integer overflow in DefaultAudioSink
PiperOrigin-RevId: 444221415
2022-04-26 16:52:12 +01:00
samrobinson
8c07f1e1a0 Align MediaCodec and Decoder AudioRenderer onDisabled logic.
PiperOrigin-RevId: 443156130
2022-04-26 16:13:10 +01:00
christosts
c19936895b 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 15:59:19 +01:00
ibaker
6c80a82bae Rename Player.COMMAND_GET_TRACK_INFOS to COMMAND_GET_TRACKS
`Player.getCurrentTracksInfo` was renamed to `Player.getCurrentTracks` in
0ad508b14f.

PiperOrigin-RevId: 441825078
2022-04-26 15:34:35 +01:00
olly
fbd8273430 Tracks.Group/TrackGroup variable naming disambiguation
PiperOrigin-RevId: 441712166
2022-04-26 15:20:53 +01:00
olly
0ad508b14f 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:59:00 +01:00
olly
e4b0c2073d Expect PresentationTime Discontinuity During Stream Transitions
PiperOrigin-RevId: 440378974
2022-04-26 14:25:46 +01:00
huangdarwin
4b46acef9c Media Solutions: Fix misspelling for "roboletric"
roboletric -> robolectric

PiperOrigin-RevId: 440101421
2022-04-26 14:07:29 +01:00
olly
9fd75ac129 Make MediaCodecVideoRenderer.getCodecMaxInputSize public.
PiperOrigin-RevId: 439866306
2022-04-07 17:45:35 +01:00
Ian Baker
9f7abd4f42 Merge pull request #10047 from LuGO0:9432/added-filtering-for-forced-text-tracks
PiperOrigin-RevId: 439262085
2022-04-07 16:50:35 +01:00
olly
2611b49558 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-07 16:40:24 +01:00
hschlueter
33373d0d0a Fix non-inclusive language in class names.
https://source.android.com/setup/contribute/respectful-code#term-examples

PiperOrigin-RevId: 438335305
2022-04-07 15:40:24 +01:00
ibaker
479e8ea36e 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-07 15:06:16 +01:00
andrewlewis
edfa03d969 Handle non-standard MIME type on LG AC3 decoder
PiperOrigin-RevId: 437057336
2022-03-25 14:21:17 +00:00
ibaker
5964312b29 Deprecate DefaultDrmSessionManager#setDrmUserAgent
PiperOrigin-RevId: 436521418
2022-03-22 18:13:26 +00:00
ibaker
8ea00b3a47 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
7eb01e2125 Move TrackGroupArray back to ExoPlayer
PiperOrigin-RevId: 435325454
2022-03-17 13:08:56 +00:00
aquilescanta
4ab6a84b48 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
cabd852c51 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
22159673bd Move TrackSelection back to ExoPlayer module
PiperOrigin-RevId: 433729648
2022-03-15 00:29:14 +00:00