15047 Commits

Author SHA1 Message Date
tonihei
59fbb45506 Clear pending doSomeWork messages when sleeping for offload
The offload sleeping stops as soon as a new DO_SOME_WORK message
is handled (because this indicates an expected change in rendering
and we want to stop sleeping until we know it's safe to do so).

Every exit path from doSomeWork needs to clear other pending
DO_SOME_WORK messages as these requests have already been handled by
the current method invocation. This currently doesn't happen from the
offload sleeping return path and a previously queued DO_SOME_WORK
message can immediately wake up the rendering loop again.

Fix this by moving the message removal to the beginning of the
doSomeWork method (as it prevents forgetting it in one of the
exit paths later).

PiperOrigin-RevId: 456259715
(cherry picked from commit a7649b639cef242f70cf832f5dbf56514b7e8c4b)
2022-06-21 15:58:04 +01:00
olly
4e51ef5a2c Fix parsing H265 short term reference picture sets
Issue: google/ExoPlayer#10316
PiperOrigin-RevId: 456084302
(cherry picked from commit 6dc85dc241dca8f0783d3ffbb3448840b0e75b60)
2022-06-20 16:46:15 +01:00
huangdarwin
4773fc6873 FrameProcessor: Use factories instead of a builder for Presentation.
PiperOrigin-RevId: 456064021
(cherry picked from commit f5d8800d51def6304db9c1f5a8f5ea3f6e3c69a6)
2022-06-20 14:26:12 +01:00
hschlueter
fab04c45f1 Add option to disable debug preview.
This is useful for testing Transformer in the same way as it is used
in tests and to see only the real transformation time.

PiperOrigin-RevId: 456058466
(cherry picked from commit 931562c24380ff8bd1f8fad6b2c0bb3581dc65e5)
2022-06-20 13:50:16 +01:00
hschlueter
73b57d3c77 Implement chaining GlTextureProcessor.Listener.
In follow-ups the FrameProcessorChain will set an instance of this
listener for each GlTextureProcessor to chain it with its previous
and next GlTextureProcesssor.

PiperOrigin-RevId: 455628942
(cherry picked from commit 981baae7095ef34c548df600bfbea1f7765dbb9e)
2022-06-17 16:57:46 +01:00
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
christosts
265b865b26 Misc improvement in Util
#minor-release

PiperOrigin-RevId: 455380010
(cherry picked from commit 7563bd2792d85c61223c12dd0c4c5a77d1b75b13)
2022-06-16 14:39:46 +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
hschlueter
c16e5ac47c Wrap processor chain executor service for better exception handling.
The wrapper
* catches exceptions for each task and notifies the
  listener (this will be used more in follow-ups when processFrame
  is split into lots of listeners and callbacks),
* removes finished tasks from the queue and signals any exceptions
  that occurred to the listener each time a new task is executed.

PiperOrigin-RevId: 455345184
(cherry picked from commit ee847d92c50c8d2929da287e1103110149d78170)
2022-06-16 10:41:23 +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
christosts
56cfa66d3b Misc javadoc fix.
PiperOrigin-RevId: 455157744
(cherry picked from commit 12e756273091f64152b0f053bee401684f9edbf6)
2022-06-15 17:05:54 +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
olly
8c748485d2 Don't export broadcast receivers that don't require it
Issue: google/ExoPlayer#10287
PiperOrigin-RevId: 455131138
(cherry picked from commit 691b392b246522fb664cdb1ce196e16c3449926c)
2022-06-15 15:00:47 +00:00
olly
c4479c719f Cleanup: Remove unnecessary self-refs in Util
PiperOrigin-RevId: 455121899
(cherry picked from commit 99cdc515ae13b2fecba620102a854fc6b312c3c9)
2022-06-15 14:08:00 +00:00
hschlueter
8c465a7860 Replace FrameProcessorChain#isEnded with listener method.
PiperOrigin-RevId: 455114693
(cherry picked from commit fdfca880195da2ca5e5d0ef002feb8144009384c)
2022-06-15 13:27:35 +00:00
hschlueter
b7118486dc 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
(cherry picked from commit ea7f1ca1e32f19131cec690c6934d82c81a2d6d0)
2022-06-15 13:14:56 +00:00
hmzh
f5f95a8f40 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
(cherry picked from commit 84c43f855fd60f96b5f415dc316c1333cfdec704)
2022-06-15 12:42:05 +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
olly
84e772ada8 Suppress an ExtendsObjects violation
to support enabling this as a compile-time error.

More information: go/lsc-extends-object

PiperOrigin-RevId: 454582570
(cherry picked from commit ab56f865ea076ac3cc9eb1ad5aff6000136caf80)
2022-06-13 12:34:43 +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
olly
2d5238d82b Update compileSdkVersion to 33
PiperOrigin-RevId: 454573995
(cherry picked from commit 33caabbc4422a81efbc8e04bc9994ee870ea2d13)
2022-06-13 11:37:38 +00:00
ibaker
2396887234 Remove ExoPlayerTest.PlayerStateGrabber
It's no longer needed

PiperOrigin-RevId: 454161070
(cherry picked from commit 8c63ba6fdbfcf632538acbfb6737f227923e54bf)
2022-06-10 14:32:54 +00:00
olly
54bc6658af Fix permissions request for media provider content URIs
We need to request the external storage permission to access these

PiperOrigin-RevId: 454160546
(cherry picked from commit b5f53e771095f2c3c521008cb2c6555f5905b163)
2022-06-10 14:29:55 +00:00
hschlueter
0a42c702ca 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
(cherry picked from commit d6a6b44715c15be8348b4a30664254e57d79036a)
2022-06-10 11:03:38 +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
hschlueter
56f234ea75 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
(cherry picked from commit a105d033a7d44b8c3afb0e8134ad65f624caf256)
2022-06-09 18:22:39 +00:00