14508 Commits

Author SHA1 Message Date
christosts
36a99cb1d3 Listen to playWhenReady changes in LeanbackPlayerAdapter
#minor-release

Issue: google/ExoPlayer#10420
PiperOrigin-RevId: 460223064
(cherry picked from commit c43d9f5b5794e5019758ee7df68f79ed9f9bc4a7)
2022-07-11 15:49:33 +00:00
rohks
43eb3d0fc8 Add tests for extracting MP4 with large bitrates
Also added the test to `MP4PlaybackTest`.

PiperOrigin-RevId: 459492188
(cherry picked from commit a1665841fc90e979af427f9da0b8398d56cc6632)
2022-07-07 13:04:29 +00:00
christosts
f9f6cb3458 Add missing Nullable annotation
PiperOrigin-RevId: 459485334
(cherry picked from commit 752e82df2e0b54a1935e329b5d7da6c23309a388)
2022-07-07 12:17:36 +00:00
tonihei
d39075a216 Don't block AudioTrack when waiting for previous release
We wait until a previous AudioTrack has been released before
creating a new one. This is currently done with a thread
block operation, which may cause ANRs in the extreme case
when someone attempts to release the player while this is
still blocked.

The problem can be avoided by just returning false from
DefaultAudioSink.handleBuffer to try again until the previous
AudioTrack is released.

Reproduction steps to force the issue:
1. Add Thread.sleep(10000); to the AudioTrack release thread.
2. Add this to the demo app:
    private int positionMs = 0;

    Handler handler = new Handler();
    handler.post(new Runnable() {
      @Override
      public void run() {
        player.seekTo(positionMs++);
        if (positionMs == 10) {
          player.release();
        } else {
          handler.postDelayed(this, 1000);
        }
      }
3. Observe Player release timeout exception.

These steps can't be easily captured in a unit test as we can't
artifically delay the AudioTrack release from the test.

Issue: google/ExoPlayer#10057
PiperOrigin-RevId: 459468912
(cherry picked from commit a80dd60449a029ad5246a98717bbe3bf0fc38be7)
2022-07-07 10:22:56 +00:00
Rohit Singh
ef96641558 Merge pull request #10260 from sr1990:clearkey_parse_licenseurl
PiperOrigin-RevId: 459215225
(cherry picked from commit 9521807681840f530ed4af17c4ab5c68dedaa13e)
2022-07-07 18:12:15 +00:00
tonihei
036a48dcf9 Exclude HEVC 10bit profile on Pixel 1.
This profile is declared as supported although it isn't.

Issue: google/ExoPlayer#10345
Issue: google/ExoPlayer#3537

#minor-release

PiperOrigin-RevId: 459205512
(cherry picked from commit bf88f28539de7740dd542345ff8b70626f58ed45)
2022-07-06 09:46:27 +00:00
bachinger
c2ddf27715 Use mediaId as contentId if available
This is to be consistent with what cast `QueueMediaItem` is doing. If a contentId is
not available the contentUrl is used as the ID.

#minor-release

PiperOrigin-RevId: 459133323
(cherry picked from commit 84c801a723f56c9c0fcdf10ab8bbab35bfd9f333)
2022-07-05 23:21:59 +00:00
Rohit Singh
8051fe53f9 Merge pull request #96 from fengdai:release
PiperOrigin-RevId: 458883441
(cherry picked from commit 486c35045ddcf7a87b9df4d3674d6ee2de79aab7)
2022-07-07 17:51:10 +00:00
tonihei
84280c8530 Only consider enabled tracks in ProgressiveMediaPeriod.bufferedPosition
ProgressiveMediaPeriod loads all available tracks into SampleStreams
(because it needs to read the data anyway and it allows easy activation
of tracks without reloading). However, the SampleStreams for disabled
tracks are not read and no one if waiting for them.

The buffered position is used for user-visible state (e.g. in the UI)
and to check how much data is already buffered to decide when to stop
buffering (using LoadControl). Both values benefit from only
using the actually enabled tracks to better reflect what is available
for playback at the moment.

Issue:Issue: google/ExoPlayer#10361
PiperOrigin-RevId: 458475038
(cherry picked from commit 577e19168d981a92c18eff7f7a045c925d80ca8d)
2022-07-01 15:28:39 +00:00
rohks
3d79536f80 Fix MP4 parser issue in reading bitrates from esds boxes.
As per MP4 spec, bitrates in esds boxes can be a 32 bit number which doesn't fits in Java int type, so now reading it as a long value. Our class for holding media format, only allows bitrates value to be an int as we don't expect the bitrates to be greater than or equal to 2^31. So we're limiting the values for bitrates to Integer.MAX_VALUE.

#minor-release

PiperOrigin-RevId: 458423162
(cherry picked from commit 9e10286b5ea624b8a7533e5fc452b19476589764)
2022-07-01 09:52:45 +00:00
rohks
3709e90e34 Fix MP4 parser issue in reading length of URL array from esds boxes.
As per MP4 spec, the length of URL array is a 8 bit number.

#minor-release

PiperOrigin-RevId: 458421436
(cherry picked from commit 5095ff160bec2fdad21a51351373a03073236ffd)
2022-07-01 09:39:11 +00:00
ibaker
315bf6b898 Ensure TalkBack announces the selected playback speed in the UI menu
Issue: google/ExoPlayer#10298
#minor-release
PiperOrigin-RevId: 457991028
(cherry picked from commit bf86b603a30211ec2b48a78223683f758e6d5f83)
2022-06-29 16:10:11 +00:00
ibaker
d3b5f71f25 Consider shuffle order in Timeline.equals()
Previously two timelines that differed only in shuffle order were
considered equal, which resulted in no call to
Player.Listener.onTimelineChanged when calling
ExoPlayer.setShuffleOrder. This in turn resulted in no call to
MediaControllerCompat.Callback.onQueueChanged.

Also make a small fix inside ExoPlayerImpl.setShuffleOrder, to ensure
that the new shuffle order is used when constructing the masked
timeline.

Issue: google/ExoPlayer#9889
#minor-release
PiperOrigin-RevId: 457703727
(cherry picked from commit 5c7ec13e85d32bdb464082069d462c740bc7cd55)
2022-06-28 12:15:54 +00:00
ibaker
f3a350d651 Use a helper function and Truth Correspondence instead of NoUidTimeline
NoUidTimeline still exists as a private detail of TestUtil, but it no
longer extends ForwardingTimeline because the interactions are quite
hard to reason about.

#minor-release

PiperOrigin-RevId: 457703593
(cherry picked from commit 292f6de6305fa7fbbd2b80223e7860aa1f69118a)
2022-06-28 12:15:03 +00:00
ibaker
29a2292e99 Fix typo in the media3 1.0.0-alpha02 / ExoPlayer 2.17.0 release notes
PiperOrigin-RevId: 457680579
(cherry picked from commit 40350bcd471fbfe684a0c1e60bd463c852dae212)
2022-06-28 09:33:29 +00:00
ibaker
98f5bdb676 Fix release notes related to track selection renames and deletions
Issue: google/ExoPlayer#10363
PiperOrigin-RevId: 457679928
(cherry picked from commit 194043ae4ea2f8e982a5aef2eca90c9cf01018e3)
2022-06-28 09:30:11 +00:00
tonihei
0d83c44699 Clean up offload state tracking
1. The offloadSchedulingEnabled value doesn't need to be in
   PlaybackInfo because it's never updated in EPII.
2. The sleepingForOffload value in EPII wasn't updated explicitly
   (just via the return value of a method). It was also only
   meant to be enabled while the player is actively playing, but
   confusingly triggered from a path where the player may
   theoretically be buffering as well.
3. The offload sleeping (=not scheduling doSomeWork) was interwoven
   into the actual scheduling code making it slightly hard to follow.
   This can be improved slightly by keeping the offload sleeping
   decision and the scheduling separate.

PiperOrigin-RevId: 457427293
(cherry picked from commit aedde2de396995e4354f3110cc37e86b48525892)
2022-06-27 10:34:56 +01:00
tonihei
0b75c254ae Rename shouldUseDummySurface to shouldUsePlaceholderSurface
This was likely missed in 33373d0d0a.

PiperOrigin-RevId: 457422574
(cherry picked from commit aaa01529052bb299be41d5c56b2ea58abf738ce7)
2022-06-27 10:04:19 +01:00
olly
27538370d0 Inform ProgressiveMediaPeriod of known length earlier
PiperOrigin-RevId: 456753343
(cherry picked from commit 531f03a36964f47342f4049e0269b12bd7fb7511)
2022-06-23 14:31:27 +01:00
tonihei
de78cfa362 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 251389d7447d26b46783428133790d06daca2fd7)
2022-06-21 15:58:04 +01:00
olly
3727385555 Fix parsing H265 short term reference picture sets
Issue: google/ExoPlayer#10316
PiperOrigin-RevId: 456084302
(cherry picked from commit d86bc1078c8f95f8420253e8e8ad7550d09b03f1)
2022-06-20 16:46:15 +01:00
christosts
5051b47f4c Misc improvement in Util
#minor-release

PiperOrigin-RevId: 455380010
(cherry picked from commit 4f5e99c5432a4fadf64e242fb74d31bc614f7487)
2022-06-16 14:39:46 +00:00
christosts
643e78c4b0 Misc javadoc fix.
PiperOrigin-RevId: 455157744
(cherry picked from commit 91de5fa0cbbb976defd18bfd7d5d9981ce2dc577)
2022-06-15 17:05:54 +00:00
olly
92c3535de7 Cleanup: Remove unnecessary self-refs in Util
PiperOrigin-RevId: 455121899
(cherry picked from commit 545cd1eb461e504ff64d8d72295230824b4a6603)
2022-06-15 14:08:00 +00:00
olly
996f94754d 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 a90d5230e2856d08d1f7275b3d7244ed03fec466)
2022-06-10 14:29:55 +00:00
olly
3748cc8a82 Fix handling of content URIs by demo apps
PiperOrigin-RevId: 453510883
(cherry picked from commit 21ad8cfd6b55096029556b5c7fe226891173a8fb)
2022-06-07 20:23:51 +00:00
Ian Baker
03569f9e65
Merge pull request #10349 from google/dev-v2-r2.18.0
r2.18.0
2022-06-17 11:42:55 +01:00
Ian Baker
85d8682bc0 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:04:57 +01:00
bachinger
460d2219be Fix release notes
#minor-release

PiperOrigin-RevId: 455372269
(cherry picked from commit 71ae88fbefc760d2b401c8e7f77cc6acb2d56ba5)
2022-06-16 17:57:49 +00:00
Marc Baechinger
87814498f4
Merge branch 'release-v2' into dev-v2-r2.18.0 2022-06-16 13:13:17 +00:00
bachinger
3da5ab74b9 Update JavaDoc
#minor-release

PiperOrigin-RevId: 455361427
(cherry picked from commit 87420fcdabbe362d571edfd09f3128b6bb3ae873)
2022-06-16 13:04:43 +00:00
bachinger
da127923c3 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 495480a66adacff26fb0c9c10f4d44191656bbd0)
2022-06-16 13:04:42 +00:00
bachinger
3dcc24ef2e Version bump to exoplayer:2.18.0 and media3:1.0.0-beta01
#minor-release

PiperOrigin-RevId: 455350486
(cherry picked from commit 209d3085b710665d5659aaedd2290866f4561f7a)
2022-06-16 11:41:28 +00:00
Marc Baechinger
0a4684d045 Merge pull request #63 from ittiam-systems:rtp-h263
PiperOrigin-RevId: 455347182
(cherry picked from commit e220f5377bf8e72454218e8c13e297f0257bc49a)
2022-06-16 11:41:28 +00:00
tonihei
fb6e3ea24b Update initial bitrate estimates
#minor-release

PiperOrigin-RevId: 455140203
(cherry picked from commit 05b69a7a1cbfba4d79a91f4bd2b160625a7a9615)
2022-06-15 16:51:04 +00:00
bachinger
cdd2157f5c Updating translations
#minor-release

PiperOrigin-RevId: 455128997
(cherry picked from commit 499d3f94a504c06fcd06de7518ea6fff2a943873)
2022-06-15 16:51:04 +00:00
Marc Baechinger
a785fbe014 Merge pull request #9915 from dburckh:avi
PiperOrigin-RevId: 455094147
(cherry picked from commit 1ca382d138b30ecebe3d1ceab2442e0e53bdd388)
2022-06-15 16:51:04 +00:00
bachinger
4739e4d2f1 Add lint base to make gradle lint run without errors
PiperOrigin-RevId: 454951844
(cherry picked from commit 8b65c6a0aa5fe9e9e797633b47f0d6dfd6a44cd1)
2022-06-15 16:51:04 +00:00
bachinger
341f158f3b Add many quantity for fr an fr-CA
See https://issuetracker.google.com/208178382

PiperOrigin-RevId: 454949204
(cherry picked from commit 6fd777c5ca9805816c689fd9ad65a27083c07942)
2022-06-15 16:51:04 +00:00
bachinger
d1e50de90f Make HttpDataSourceTestEnv require API 19
PiperOrigin-RevId: 454945333
(cherry picked from commit 4759472427555d70c91af86e495cffbf0f0ac8f8)
2022-06-15 16:51:04 +00:00
bachinger
ff582ec2a1 Suppress lint errors RestrictedApis in lib-media2
PiperOrigin-RevId: 454939082
(cherry picked from commit d1fbef810699688fdfb832ba0bde7282df3d3260)
2022-06-15 16:51:04 +00:00
christosts
fd1fb96aa0 Spatializer: Assume linear channel count for E-AC3 JOC streams
#minor-release

PiperOrigin-RevId: 454884692
(cherry picked from commit 6dc4b39cb7165577bfa862675c8111c10df843e1)
2022-06-14 17:42:21 +00:00
Marc Baechinger
941c5d84b0 Merge pull request #10322 from DolbyLaboratories:dev-v2-multichannel
PiperOrigin-RevId: 454641746
(cherry picked from commit 1c373d515991f5aef15d75f6a6de80492fe14d70)
2022-06-14 17:42:21 +00:00
tonihei
c1f1eb7831 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 0ed53215c212753826d93daa7fb503e9aaf4ae8d)
2022-06-13 11:54:01 +00:00
ibaker
31e6ba9c71 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 c736a72c75ba5460de8db79482e920ff923dc580)
2022-06-13 11:54:01 +00:00
christosts
9a793dab70 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 9f3c595e022bc98fd776a16dcad10adc66b37e67)
2022-06-09 18:51:27 +00:00
christosts
64d33adc2d Minor fix: remove final from methods of final class
#minor-release

PiperOrigin-RevId: 453408087
(cherry picked from commit 527db57b26e5d6ea46320d203c1e402078321d1b)
2022-06-09 18:51:27 +00:00
christosts
b7cf772afb 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 917484100db2be8681f5a122d876012c1dd0f36b)
2022-06-09 18:08:16 +00:00
Marc Baechinger
56079ba84e Merge pull request #69 from ittiam-systems:rtp_amr_test
PiperOrigin-RevId: 453905355
(cherry picked from commit 8a31e33d41c198279e7c6008fcad43f39202c837)
2022-06-09 18:08:16 +00:00
tonihei
c1aff0dc8f 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 2056152824512bcd8f2f09b2f7c1a752e913feac)
2022-06-09 18:08:16 +00:00