14466 Commits

Author SHA1 Message Date
Ian Baker
2c7201024e
Merge pull request #88 from androidx/main-r1.0.0-beta01
r1.0.0 beta01
1.0.0-beta01
2022-06-17 11:42:16 +01:00
Ian Baker
5f741bbe5a Add lint baseline for spurious API-level warnings
The API 32 SDK has incorrect versioning metadata for Spatializer. It
reports the whole class has only been present since API 33 (which is
surely impossible given it's present in the API 32 SDK):
https://issuetracker.google.com/234009300

The metadata seems to be correct in the API 33 SDK, so this baseline
will no longer be needed when we bump to `compileSdkVersion = 33`.
2022-06-17 10:08:37 +01:00
ibaker
68e5612c0d Publish api.txt to media3 GitHub
#minor-release

PiperOrigin-RevId: 455372568
(cherry picked from commit c7f1b465d4dfcfb1657425e4557e47e627d127cf)
2022-06-16 17:54:49 +00:00
bachinger
e2dff6e6fe Fix release notes
#minor-release

PiperOrigin-RevId: 455372269
(cherry picked from commit 4b4e7cb919ca4b2d9c889c5b82994c9d08991381)
2022-06-16 17:54:48 +00:00
bachinger
e53a649a41 Add lint base xml file for string.xml files
Fixing lint errors in the string.xml files makes no sense because these are
overridden with the next automated string import. Adding a lint-baseline.xml
instead for the ui module.

See https://issuetracker.google.com/208178382

#minor-release

PiperOrigin-RevId: 455354304
(cherry picked from commit 61ab75b8b88050a12492c412e8c79ebf75fc1d9c)
2022-06-16 13:05:17 +00:00
bachinger
36b976f70f Version bump to exoplayer:2.18.0 and media3:1.0.0-beta01
PiperOrigin-RevId: 455350486
(cherry picked from commit 1c0b4b32a400ab9f7fb316ed7729ea2b8a32957f)
2022-06-16 11:46:35 +00:00
Marc Baechinger
9c02cdb1fb Merge pull request #63 from ittiam-systems:rtp-h263
PiperOrigin-RevId: 455347182
(cherry picked from commit dc0e5c447b926c0d1117182c4e4abf0abc0e9dcb)
2022-06-16 11:41:49 +00:00
bachinger
14aced6304 Avoid out of bounds when setting less media items than in playlist
Issue: androidx/media#86
#minor-release
PiperOrigin-RevId: 455182232
(cherry picked from commit 8f844b32fdf4d41d6a5690e57e55d0c383ee7e3e)
2022-06-15 19:05:26 +00:00
tonihei
039e102552 Update initial bitrate estimates
#minor-release

PiperOrigin-RevId: 455140203
(cherry picked from commit 646bf565c35c43ff59d4a7d51ee60036368339b6)
2022-06-15 17:00:36 +00:00
bachinger
5ebc07ce76 Updating translations
#minor-release

PiperOrigin-RevId: 455128997
(cherry picked from commit 958105c91c931fa942ce7de4e8311589eca76564)
2022-06-15 17:00:36 +00:00
tonihei
6791532778 Remove setMediaUri/onSetMediaUri
This code path is now completely redundant as the same effect can be
achieved by using player.setMediaItem.

PiperOrigin-RevId: 455115567
(cherry picked from commit 21d4e8581701e12743626f49823a667d9f05ed68)
2022-06-15 17:00:27 +00:00
tonihei
6ed3e40681 Support setMediaItem(s) in MediaControllerImplLegacy
These calls were not implemented so far as they require a mix of
initial prepareFrom/playFrom calls and addQueueItem. We can also
support clients without queue handling to set single MediaItems.

To make the calls consistent and predictable in the session,
we need to ensure that none of the play/pause/addQueueItem/
removeQueueItem/prepare/playFromXYZ/prepareFromXYZ are called
before the controller is prepared and has media.

#minor-release

PiperOrigin-RevId: 455110246
(cherry picked from commit b475f1f2daba8e0ed2497cbf17f4b834e58c59a4)
2022-06-15 16:52:51 +00:00
Marc Baechinger
080b1862c2 Merge pull request #9915 from dburckh:avi
PiperOrigin-RevId: 455094147
(cherry picked from commit ad3348cc69d240ed3a1248496938fda57e20368e)
2022-06-15 16:52:51 +00:00
bachinger
d867ebd1df Add lint base to make gradle lint run without errors
PiperOrigin-RevId: 454951844
(cherry picked from commit 29bf4c8aabd9003e907d31563b9eead4658c1fce)
2022-06-15 16:52:51 +00:00
bachinger
fde58ed91d Add many quantity for fr an fr-CA
See https://issuetracker.google.com/208178382

PiperOrigin-RevId: 454949204
(cherry picked from commit 1f380c1dd36b4554286d0f4e93bc0479579eb991)
2022-06-15 16:52:51 +00:00
bachinger
676f766e39 Make HttpDataSourceTestEnv require API 19
PiperOrigin-RevId: 454945333
(cherry picked from commit 7f89531c5b0c894946c2ca4bf54cfc66e3d4507b)
2022-06-15 16:52:51 +00:00
bachinger
e3e92b2448 Suppress lint errors RestrictedApis in lib-session
PiperOrigin-RevId: 454943102
(cherry picked from commit 252ae4c7a34889b8622cc2750c238dc40be0277b)
2022-06-15 16:52:50 +00:00
christosts
0d84cf9210 Spatializer: Assume linear channel count for E-AC3 JOC streams
#minor-release

PiperOrigin-RevId: 454884692
(cherry picked from commit 118d689a08b1097a346f543111ea65deead56459)
2022-06-14 17:42:29 +00:00
Marc Baechinger
6377f9130d Merge pull request #10322 from DolbyLaboratories:dev-v2-multichannel
PiperOrigin-RevId: 454641746
(cherry picked from commit 970eb4444c54f7bf899e429d845cf978b97dced7)
2022-06-14 17:42:29 +00:00
tonihei
b8c8a41342 Use correct placeholder PlayerID value in test
The default constructor is only allowed to be called on
API < 32 and the test should use the defined UNSET constant
to be API independent.

#minor-release

PiperOrigin-RevId: 454568893
(cherry picked from commit e8bcdf437ee3f8df9622615960f6b754536220bc)
2022-06-13 11:54:09 +00:00
ibaker
f6b987d8ec Ensure DRAIN_ACTION_FLUSH_AND_UPDATE_DRM_SESSION is always executed
`codecDrainAction` is set to `DRAIN_ACTION_NONE` in 3 places in
`MediaCodecRenderer`:
* The constructor (so there's no prior state to worry about)
* `updateDrmSessionV23()`: Where `mediaCrypto` is reconfigured based
  on `sourceDrmSession` and `codecDrmSession` is also updated to
  `sourceDrmSession`.
* `resetCodecStateForFlush()`: Where (before this change) the action
  is unconditionally set back to `DRAIN_ACTION_NONE` and so any
  required updated implied by
  `DRAIN_ACTION_FLUSH_AND_UPDATE_DRM_SESSION` is not done.

This change ensures that `flushOrReleaseCodec()` handles
`DRAIN_ACTION_FLUSH_AND_UPDATE_DRM_SESSION` before calling .

This probably also resolves Issue: google/ExoPlayer#10274

#minor-release

PiperOrigin-RevId: 454114428
(cherry picked from commit 222faa96d063ba4a7f7e9fe8089228394bf1f97b)
2022-06-13 11:54:09 +00:00
christosts
0fd24c2fa3 DefaultTrackSelector: Constrain audio channel count
The track selector will select multi-channel formats when those can be
spatialized, otherwise the selector will prefer stereo/mono audio
tracks. When the device supports audio spatialization (Android 12L+),
the DefaultTrackSelector will monitor for changes in the platform
Spatializer and trigger a new track selection upon a
Spatializer change event.

Devices with a `television` UI mode are excluded from audio channel
count constraints.

#minor-release

PiperOrigin-RevId: 453957269
(cherry picked from commit e2f0fd76730fd4042e8b2226300e5173b0179dc1)
2022-06-09 18:36:35 +00:00
christosts
74fbf0171f Fix bug: playback is frozen with HLS chunkless preparation
This change fixes a bug where the player is frozen with HLS chunkless
preparation because the audio stream wrappers are not marked as master
timestamp sources before preparation.

#minor-release

PiperOrigin-RevId: 453941815
(cherry picked from commit 9221eeb2d87f049c668a056f7fd7901b91dd51e3)
2022-06-09 18:36:35 +00:00
bachinger
7c0b787bdb Add session URI to Intent used with the notification
The service handles three different types of `Intents`. Custom command and media
command Intents created by the library and media button event Intents from other
sources.

Media commands from the library as well as from external sources have the action
set to `android.intent.action.MEDIA_BUTTON`. If the data URI is set and can be
used to identify a session then it is a library Intent. If the Intent is coming
from an external KeyEvent, the service implementation is asked which session to use
by calling `onGetSession(controllerInfo)` with the controller info being an
anonymous legacy controller info.

Intents representing a custom command are always coming from the library and hence
always have a data URI.

Issue: androidx/media#82
PiperOrigin-RevId: 453932972
(cherry picked from commit 8b592fc77aeead345adac999eda27da55df0ae01)
2022-06-09 18:36:35 +00:00
Marc Baechinger
9a73ae90a0 Merge pull request #69 from ittiam-systems:rtp_amr_test
PiperOrigin-RevId: 453905355
(cherry picked from commit 58f7ac25a79d20af3faed321e9d3d3458b4394e5)
2022-06-09 18:36:35 +00:00
tonihei
35691bce98 Add COMMAND_SET_MEDIA_ITEM to Player.Commands
Some Player implementations have no playlist capability but can still
set a MediaItem for playback. Examples are a MediaController connected
to a legacy MediaSession, ExoPlayer up to 2.12 or MediaPlayer.

To indicate this capability, we need an allowed command in addition
to COMMAND_CHANGE_MEDIA_ITEMS that just allows to set a single item
that replaces everything that is currently played.

#minor-release

PiperOrigin-RevId: 453879626
(cherry picked from commit 5333c67d08ec22a1b5153af152b456d36099f401)
2022-06-09 18:36:35 +00:00
christosts
35c9585f5f Avoid using ConcurrentHashMap
Use Collections.synchronizedSet() instead of creating a set from a
ConcurrentHashMap because ConcurrentHashMap has a bug in APIs 21/22
that can result in lost updates.

PiperOrigin-RevId: 453696565
(cherry picked from commit d506c709c9a793d751908aac879f2f85b74f7b58)
2022-06-09 18:36:35 +00:00
christosts
31c7ccbc49 Audio passthrough: handle unset audio format channel count
With HLS chunkless preparation, audio formats may have no value
for channel count. In this case, the DefaultAudioSink will either query
the platform for a supported channel count (API 29+) or assume a max
channel count based on the encoding spec in order to decide whether the
audio format can be played with audio passthrough.

Issue: google/ExoPlayer#10204

#minor-release

PiperOrigin-RevId: 453644548
(cherry picked from commit 86973382335156abaa76770c6897d28460fdde36)
2022-06-09 18:36:35 +00:00
tonihei
f5dc99f596 Forward legacy controller onPlay/PrepareFromXY calls to onAddMediaItems
These legacy callbacks are currently forwarded to onSetMediaUri which
will be removed in the future.

Also make sure to only call player.prepare/play after the items have
been set.

The calls to onAddQueueItem are also forwarded to onAddMediaItems to
actually allow a session to resolve these items to playable media, which
wasn't possible so far.

PiperOrigin-RevId: 453625204
(cherry picked from commit bd126ec5c5497615572bcdf259278a899b4574f8)
2022-06-09 18:36:35 +00:00
ibaker
926327ef4f Clarify that ShuffleOrder must be consistent in both directions
#minor-release

PiperOrigin-RevId: 453622964
(cherry picked from commit 4a6f431f01bd4cdb6754d5a897cad307eebe4d34)
2022-06-09 18:36:35 +00:00
Marc Baechinger
fd1eb4b466 Merge pull request #53 from ittiam-systems:rtp_opus
PiperOrigin-RevId: 453490088
(cherry picked from commit a2a450432904c3d8ecc25e00c7148e73f1923d6e)
2022-06-09 18:36:35 +00:00
christosts
2ed7efb1c3 Minor fix: remove final from methods of final class
#minor-release

PiperOrigin-RevId: 453408087
(cherry picked from commit 62497f23fd8f92de304e7a87ffa839e221bd78c6)
2022-06-07 17:54:55 +00:00
ibaker
240379cc02 Use a shared keyForField implementation in track selection parameters
The current setup with distinct, private `keyForField` implementations,
leaves open the (theoretical) possibility of a clash in the `Bundle`
keys used by the superclass and subclass. This change brings
consistency with our only other extensible `Bundleable` type
(`PlaybackException`).

#minor-release

PiperOrigin-RevId: 453385875
(cherry picked from commit 814e43dbb9432e3adf6c4c278df50433260a461b)
2022-06-07 17:54:55 +00:00
ibaker
c22cd44900 Fix release notes formatting
#minor-release

PiperOrigin-RevId: 453384451
(cherry picked from commit 14ea2e4c5146ed57d51fe4a69f6b29a9f3954115)
2022-06-07 17:54:55 +00:00
ibaker
f3574f2354 Rename DefaultTrackSelector.ParametersBuilder to Parameters.Builder
We generally nest the `Builder` for `Foo` inside `Foo`. In this case,
there's already a `DefaultTrackSelector.Parameters.Builder` type visible
to a developer, it just happens to be the 'common'
`TrackSelectorParameters.Builder`, so using it is a bit weird. For
example this code snippet doesn't compile because
`DefaultTrackSelector.Parameters.Builder#build()` returns
`TrackSelectionParameters`. This CL fixes that problem and the code
snippet now compiles.

```java
DefaultTrackSelector.Parameters params =
   new DefaultTrackSelector.Parameters.Builder(context).build()
```

#minor-release

PiperOrigin-RevId: 453215702
(cherry picked from commit 247c2d845dbe0887f556fd3d44cdbc4d97f7451a)
2022-06-07 17:54:55 +00:00
bachinger
216d971518 Filter bogus AndroidX Media jar file when creating javadoc
#minor-release

PiperOrigin-RevId: 452282128
(cherry picked from commit bd9bc0f6b7349cf2c1477a6d7e3146555c3ead86)
2022-06-07 17:54:55 +00:00
ibaker
501ea8c563 Fix HiddenTypedefConstant Metalava error on PlaybackException
This is done by removing the `@FieldNumber` IntDef completely. It's not
really adding much value anyway, because it's `open` so there's no real
enforcement to prevent passing 'incorrect' values.

#minor-release

PiperOrigin-RevId: 452108972
(cherry picked from commit 39674bec78d45baa550df6807e4d49faf42dc25a)
2022-06-07 17:54:55 +00:00
bachinger
706e60346d Ignore decoding test cases when library not available
#minor-release

PiperOrigin-RevId: 452043577
(cherry picked from commit 55a194c575ba40dc0e156815f07ec854dc85bd3d)
2022-05-31 15:33:33 +00:00
andrewlewis
9cd84696c7 Create withMediaPipe variant only if AAR is present
This should fix running `./gradlew clean test` if MediaPipe hasn't been built, for example.

PiperOrigin-RevId: 452033698
(cherry picked from commit 208a9114a9f516f7034b75b4f21f9ded34de8501)
2022-05-31 14:07:20 +00:00
ibaker
f6f4bf5e6b Permit duplicate Opus headers
This reinstates the permissive behaviour removed by
fe7e5b8181

Test file created by opening bear.opus in a hex editor and naively
duplicating the two header packets, starting at (and including) the
first `OggS` in the file and ending just before the third `OggS`.

#minor-release

Issue: google/ExoPlayer#10038
PiperOrigin-RevId: 452015662
(cherry picked from commit 1282175808210f0496a4b18ae4e02312dbdf4553)
2022-05-31 14:07:20 +00:00
bachinger
7671e50d71 Remove deprecated calls
#minor-release

PiperOrigin-RevId: 452006137
(cherry picked from commit acb48a249564c5793cfadbee262e2eed29dea528)
2022-05-31 13:51:49 +00:00
bachinger
ad5788ef37 Use resource ID from drawable.xml as the notification icon
Issue: androidx/media#66
Issue: androidx/media#65

#minor-release

PiperOrigin-RevId: 452004492
(cherry picked from commit 839d4f43906f99002e3be71cdb7f90efb231754a)
2022-05-31 13:51:49 +00:00
ibaker
af91fdbf54 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
(cherry picked from commit b8ca5b8951325ed89063b2e30e1c7fd3b78f5e97)
2022-05-31 13:51:49 +00:00
bachinger
00ae09f459 Add explicit cast to ByteBuffer for Java 8 compatibility
PiperOrigin-RevId: 451994696
(cherry picked from commit 5cdac6575e662bf575b4890f17b600e7b17bffac)
2022-05-31 13:51:49 +00:00
ibaker
711409ab51 Update the Gradle Wrapper and Android Gradle Plugin
The current verion of AGP warns it doesn't support Android API 32 [1].

The wrapper was upgraded with ([instructions](https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:upgrading_wrapper)):
```shell
$ ./gradlew wrapper --gradle-version 7.4.2 --distribution-type all
```

[1]
```
WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 32

This Android Gradle plugin (7.0.3) was tested up to compileSdk = 31

This warning can be suppressed by adding
    android.suppressUnsupportedCompileSdk=32
    to this project's gradle.properties

    The build will continue, but you are strongly encouraged to update your project to
    use a newer Android Gradle Plugin that has been tested with compileSdk = 32
```

#minor-release

PiperOrigin-RevId: 451893214
(cherry picked from commit 3ba9d7e125482aae236f2e9e60de7f8535d9f162)
2022-05-30 20:53:20 +00:00
Marc Baechinger
a626bcdb7c Remove FfmpegVideoRenderer from 2.18.0 release 2022-05-30 17:58:14 +00:00
aquilescanta
9d460023a2 Use fluent assertions
Gives a bit more information upon failures

PiperOrigin-RevId: 451882968
2022-05-30 16:55:07 +00:00
bachinger
40f5fb55cc Add constants for custom actions UI customization
PiperOrigin-RevId: 451875964
2022-05-30 16:54:22 +00:00
ibaker
a40d3e4c9a Fix release notes typo from PlaceHolder to Placeholder
The classes were renamed to `PlaceholderXXX` in
33373d0d0a

#minor-release

PiperOrigin-RevId: 451872006
2022-05-30 16:53:28 +00:00
bachinger
85a936ecb1 Implement session extras for Media3 and legacy controllers
This provides an (unstable) API for apps to broadcast session extras
Bundle to all connected controllers and set the extras in the legacy
session.

Similar to the custom layout, the extras Bundle is not part of the
Media3 session state. This means that when a Media3 controller
connects to the session after the broadcast, the extras needs to be
sent to that controller in  `MediaSession.Callback.onPostConnect(MediaSession session, ControllerInfo controller)`.

PiperOrigin-RevId: 451871731
2022-05-30 16:52:43 +00:00