14947 Commits

Author SHA1 Message Date
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
bachinger
8f844b32fd Avoid out of bounds when setting less media items than in playlist
Issue: androidx/media#86
#minor-release
PiperOrigin-RevId: 455182232
2022-06-15 18:55:54 +00:00
christosts
12e7562730 Misc javadoc fix.
PiperOrigin-RevId: 455157744
2022-06-15 18:54:44 +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
tonihei
646bf565c3 Update initial bitrate estimates
#minor-release

PiperOrigin-RevId: 455140203
2022-06-15 16:41:10 +00:00
olly
691b392b24 Don't export broadcast receivers that don't require it
Issue: google/ExoPlayer#10287
PiperOrigin-RevId: 455131138
2022-06-15 15:34:53 +00:00
bachinger
958105c91c Updating translations
#minor-release

PiperOrigin-RevId: 455128997
2022-06-15 15:34:08 +00:00
olly
99cdc515ae Cleanup: Remove unnecessary self-refs in Util
PiperOrigin-RevId: 455121899
2022-06-15 15:33:10 +00:00
tonihei
21d4e85817 Remove setMediaUri/onSetMediaUri
This code path is now completely redundant as the same effect can be
achieved by using player.setMediaItem.

#minor-release

PiperOrigin-RevId: 455115567
2022-06-15 15:32:14 +00:00
hschlueter
fdfca88019 Replace FrameProcessorChain#isEnded with listener method.
PiperOrigin-RevId: 455114693
2022-06-15 15:31:31 +00:00
hschlueter
ea7f1ca1e3 Use FrameProcessorChain#SurfaceProvider for encoder compat transform.
This change adds a SurfaceProvider interface which is necessary to
allow for texture processors whose output size becomes available
asynchronously in follow-ups.
VTSP's implementation of this interface wraps the encoder and provides
its input surface together with the output frame width, height, and
orientation as used for encoder configuration.
The FrameProcessorChain converts the output frames to the provided
orientation and resolution using a ScaleToFitTransformation and
Presentation replacing EncoderCompatibilityTransformation.

PiperOrigin-RevId: 455112598
2022-06-15 15:30:48 +00:00
tonihei
b475f1f2da 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
2022-06-15 15:30:05 +00:00
hmzh
84c43f855f Implement seeking to the start of a MIDI file
- Fixed MidiExtractor state issues which caused seeking to behave unexpectedly. Ensures the extractor is now always in the file loading state after returning RESULT_END_OF_INPUT.
- Fixed an infinite loop in MidiExtractor caused by the file data array having an initial size of 0. The extractor attempted to increase the capacity of the array by using this size of 0 in it's calculations.

PiperOrigin-RevId: 455107511
2022-06-15 15:29:06 +00:00
Marc Baechinger
ad3348cc69 Merge pull request #9915 from dburckh:avi
PiperOrigin-RevId: 455094147
2022-06-15 15:28:22 +00:00
bachinger
29bf4c8aab Add lint base to make gradle lint run without errors
PiperOrigin-RevId: 454951844
2022-06-15 15:27:34 +00:00
bachinger
1f380c1dd3 Add many quantity for fr an fr-CA
See https://issuetracker.google.com/208178382

PiperOrigin-RevId: 454949204
2022-06-15 15:26:36 +00:00
bachinger
7f89531c5b Make HttpDataSourceTestEnv require API 19
PiperOrigin-RevId: 454945333
2022-06-15 15:25:44 +00:00
bachinger
252ae4c7a3 Suppress lint errors RestrictedApis in lib-session
PiperOrigin-RevId: 454943102
2022-06-15 15:24:49 +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
christosts
118d689a08 Spatializer: Assume linear channel count for E-AC3 JOC streams
#minor-release

PiperOrigin-RevId: 454884692
2022-06-14 17:11:00 +00:00
Marc Baechinger
970eb4444c Merge pull request #10322 from DolbyLaboratories:dev-v2-multichannel
PiperOrigin-RevId: 454641746
2022-06-14 17:10:08 +00:00
olly
ab56f865ea Suppress an ExtendsObjects violation
to support enabling this as a compile-time error.

More information: go/lsc-extends-object

PiperOrigin-RevId: 454582570
2022-06-14 17:09:08 +00:00
olly
33caabbc44 Update compileSdkVersion to 33
PiperOrigin-RevId: 454573995
2022-06-14 17:08:17 +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
tonihei
e8bcdf437e 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
2022-06-13 11:14:17 +00:00
ibaker
8c63ba6fdb Remove ExoPlayerTest.PlayerStateGrabber
It's no longer needed

PiperOrigin-RevId: 454161070
2022-06-13 11:13:18 +00:00
olly
b5f53e7710 Fix permissions request for media provider content URIs
We need to request the external storage permission to access these

PiperOrigin-RevId: 454160546
2022-06-13 11:12:23 +00:00
hschlueter
d6a6b44715 Combine all native GL errors in a GlException instead of logging.
The native GL errors are in an arbitrary order according to
https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glGetError.xml
This means any of them could contain the most useful message
so it's better to use all for the GlException's message rather than
picking the last message and logging all others.

PiperOrigin-RevId: 454130460
2022-06-13 11:11:31 +00:00
ibaker
222faa96d0 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
2022-06-13 11:10:43 +00:00
Rakesh Kumar
fc3c57ecfd
Merge branch 'main' into rtp-h263 2022-06-10 11:38:51 +05:30
hschlueter
a105d033a7 Check targetSdkVersion for frame dropping workaround.
Based on
https://developer.android.com/reference/android/media/MediaCodec#using-an-output-surface,
frame dropping behaviour depends on the target SDK version.
After this change transformer will only use
MediaFormat#KEY_ALLOW_FRAME_DROP if both the target and system SDK
version are at least 29 and default to its pre 29 behaviour where each
decoder output frame must be processed before a new one is rendered
to prevent frame dropping otherwise.

Also remove deprecated Transformer.Builder constructor without a
context and the context setter.

PiperOrigin-RevId: 453971097
2022-06-09 18:48:45 +00:00
hschlueter
cc1f32d094 Make GlUtil.GlException checked and remove flag to disable it.
Transformer always enabled glAssertionsEnabled, so there should
be no functional change.

ExoPlayer previously disabled glAssertionsEnabled, so GlUtil logged
GlExceptions instead of throwing them. The GlExceptions are now
caught and logged by the callers so that there should also be no
functional change overall.

This change also replaces EGLSurfaceTexture#GlException with
GlUtil#GlException.

PiperOrigin-RevId: 453963741
2022-06-09 18:47:46 +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