1384 Commits

Author SHA1 Message Date
ibaker
f92ae23dd8 Version bump to exoplayer:2.17.0 and media3:1.0.0-alpha02
#minor-release

PiperOrigin-RevId: 430456963
2022-02-23 16:22:43 +00:00
Andrew Lewis
933e207b3e Update to androidx.media3
PiperOrigin-RevId: 405656499
2021-10-27 09:12:46 +01:00
samrobinson
68729ecd49 Remove unneeded release notes.
PiperOrigin-RevId: 405626270
2021-10-26 14:23:32 +01:00
samrobinson
cd6c2e989f Change MediaMetadata update priority to favour MediaItem values.
The static and dynamic metadata now build up in a list, such that when
the MediaMetadata is built, they are applied in an event order. This
means that newer/fresher values will overwrite older ones. The MediaItem
values are then applied at the end, as they take priority over any other.

#minor-release

PiperOrigin-RevId: 405383177
2021-10-25 15:16:16 +01:00
olly
2dc7ac3851 Upgrade RTMP dependency and remove jcenter()
PiperOrigin-RevId: 405375352
2021-10-25 14:12:15 +01:00
ibaker
bcaadf434f Remove checkState calls from DefaultDrmSession#acquire() and release()
Issue: #9392 reports occasional IllegalStateExceptions from release()
in crashlytics,`with no way to reproduce locally. It seems likely there
is a bug somewhere in DRM handling, and ideally we would find that and
fix it.

However we haven't been able to find the problem, and in the meantime
these exceptions cause the entire app to crash. Although this is
arguably useful from a debugging perspective, it's obviously a poor
experience for developers and users, since all we're actually trying to
do is release the session, so maybe we shouldn't strictly care that it's
already released?

This change replaces the exception with an error log, which might be a
useful debugging hint if we see other DRM unexpected behaviour due to
references to released sessions being held for too long.

PiperOrigin-RevId: 403942546
2021-10-18 15:41:08 +01:00
olly
a4c1005823 Move CachedRegionTracker to upstream root
PiperOrigin-RevId: 403914807
2021-10-18 15:29:52 +01:00
kimvde
5ef00f0e96 Remove deprecated ControlDispatcher
The possibilities to set a ControlDispatcher have been removed in
<unknown commit> so that the ControlDispatcher is always a
DefaultControlDispatcher.

PiperOrigin-RevId: 403327092
2021-10-15 12:45:39 +01:00
kimvde
746ad2e6aa Remove deprecated ControlDispatcher from API surface
PiperOrigin-RevId: 403101980
2021-10-14 17:03:23 +01:00
kim-vde
059dfaef7c Merge pull request #9496 from DolbyLaboratories:dev-v2-truehd
PiperOrigin-RevId: 403081883
2021-10-14 16:16:05 +01:00
olly
8827ccb568 Upgrade to WorkManager release compatible with Android 12
Issue #9181
#minor-release

PiperOrigin-RevId: 403049218
2021-10-14 12:19:53 +01:00
samrobinson
96a2c03f59 Add public SimpleExoPlayer methods to ExoPlayer.
PiperOrigin-RevId: 401535981
2021-10-07 22:04:05 +01:00
olly
585b0bddcc DASH: Set MIME, width and height for image adaptation sets
Issue: #9500
PiperOrigin-RevId: 401091261
2021-10-06 20:55:10 +01:00
olly
80d365163d Rollback of 912c47ff6f
*** Original commit ***

Rollback of 8ed6c9fcf5

*** Original commit ***

Fix capitalization of language in track selector

Issue: #9452

***

***

PiperOrigin-RevId: 400942287
2021-10-05 23:18:25 +01:00
christosts
7a2c7c3297 Make asynchronous queueing non-experimental
This change makes asynchronous queueing non-experimental, it enables the
feature by default on devices with API level >= 31 (Android 12+) and
exposes APIs for apps to either fully opt-in or opt-out from the
feature.

The choice to use or not asynchronous queueing is moved out of
MediaCodecRenderer to a new MediaCodecAdapter factory, the
DefaultMediaCodecAdapterFactory. This is because, at the moment,
if an app passes a custom adapter factory to a MediaCodecRenderer and
then enables asynchronous queueing on it, the custom
adapter factory is not used but this is not visible to the user.

The default behavior of DefaultMediaCodecAdapterFactory is to create
asynchronous MediaCodec adapters for devices with API level >= 31
(Android 12+), and synchronous MediaCodec adapters on devices with older
API versions.

DefaultMediaCodecAdapterFactory exposes methods to force enable or force
disable the use of asynchronous adapters so that applications can enable
asynchronous queueing on devices with API versions before 31 (but not
before 23), or fully disable the feature. For applications that build
MediaCodecRenderers directly, they will need to create a
DefaultMediaCodecAdapterFactory and pass it to the renderer constructor.
For applications that rely on the DefaultRenderersFactory, additional
methods have been added on the DefaultRenderersFactory to control
enabling/disabling asynchronous queueing.

Issue: #6348
PiperOrigin-RevId: 400733506
2021-10-05 11:22:01 +01:00
kimvde
84881739ee Map TS stream type 0x80 to H262
Issue: #9472
PiperOrigin-RevId: 400715255
2021-10-04 15:43:47 +01:00
olly
912c47ff6f Rollback of 8ed6c9fcf5
*** Original commit ***

Fix capitalization of language in track selector

Issue: #9452

***

PiperOrigin-RevId: 400706984
2021-10-04 15:40:47 +01:00
olly
8ed6c9fcf5 Fix capitalization of language in track selector
Issue: #9452
PiperOrigin-RevId: 400680794
2021-10-04 12:13:49 +01:00
bachinger
168d0cc9a6 Merge pull request #9525 from talklittle:fix-initial-position
PiperOrigin-RevId: 400666736
2021-10-04 11:56:36 +01:00
samrobinson
e335022e0b Fix mediaMetadata being reset when media is repeated.
Issue: #9458
PiperOrigin-RevId: 399901865
2021-09-30 21:24:10 +01:00
ibaker
679e3751d5 Fix bug in MCVR where dummySurface is released but surface isn't nulled
The fix for Issue: #8776 was to release and null-out dummySurface if
it doesn't match the security level of the decoder. But it's possible
that this.surface is already set to this.dummySurface, in which case we
must also null out this.surface otherwise we will later try and re-use
the old, released DummySurface instance.

This logic already exists in MCVR#onReset, so I pulled it into a
releaseDummySurface() helper function.

Issue: #9476
#minor-release
PiperOrigin-RevId: 399420476
2021-09-28 16:43:39 +01:00
Oliver Woodman
9108dc5b0e Merge pull request #9421 from MarcusWichelmann:hevc-sps-parsing
PiperOrigin-RevId: 398749045
2021-09-24 18:13:01 +01:00
olly
a720380e77 Update DownloadService for Android 12
- If DownloadService is configured to run as a foreground service,
  it will remain started and in the foreground when downloads are
  waiting for requirements to be met, with a suitable "waiting for
  XYZ" message in the notification. This is necessary because new
  foreground service restrictions in Android 12 prevent to service
  from being restarted from the background.
- Cases where requirements are not supported by the Scheduler will
  be handled in the same way, even on earlier versions of Android.
  So will cases where a Scheduler is not provided.
- The Scheduler will still be used on earlier versions of Android
  where possible.

Note: We could technically continue to use the old behavior on
Android 12 in cases where the containing application still has a
targetSdkVersion corresponding to Android 11 or earlier. However,
in practice, there seems to be little value in doing this.
PiperOrigin-RevId: 398720114
2021-09-24 18:04:42 +01:00
christosts
276d2e9d0d Bump version to 2.15.1 and tidy release notes
#minor-release

PiperOrigin-RevId: 397758146
2021-09-20 17:39:23 +01:00
kimvde
46d97bdd39 Fix DTS_X audio mime type
Issue: #9429

#minor-release

PiperOrigin-RevId: 397717740
2021-09-20 13:02:53 +01:00
claincly
fd6a6ec8df Support RFC4566 SDP attribute.
Issue: #9430

The current supported SDP (RFC2327) spec only allows for alpha-numeric
characters in the attribute-field. RFC4566 (section 9, token type) allowed
extra characters, and this CL adds the support.

PiperOrigin-RevId: 397301173
2021-09-17 16:02:10 +01:00
krocard
74c6ef9ba0 Move EventListener registration down from Player
The deprecated `Player.addListener(EventListener)`
is moved out of Player into its subclasses
(CastPlayer and ExoPlayer).

This is unlikely to break users because:
 - the method has been deprecated in the last major version
 - the method is still present in the major implementations

If an users is affected, they can either:
 - use ExoPlayer instead of Player
 - (recommended) switch to Player.Listener.

Additionally update the threading guarantees that did not
reflect the current implementation.

PiperOrigin-RevId: 397272144
2021-09-17 11:58:31 +01:00
christosts
a95ee0aeba Move release note entry to correct section
#minor-release

PiperOrigin-RevId: 397164973
2021-09-16 22:41:50 +01:00
olly
f6d8cfeb1f DownloadService: Remove deprecated protected methods
PiperOrigin-RevId: 397138908
2021-09-16 22:35:23 +01:00
claincly
2f0aae0d5f Fix RTSP WWW-Authenticate header parsing.
Issue: #9428

#minor-release

PiperOrigin-RevId: 397064086
2021-09-16 16:50:54 +01:00
christosts
78fc27a1c6 Fix HLS endless retrying on load errors
This was originally reported on #9390. There was a bug that when HLS
loads failed, the player would endlessly retry and never fail with a
player error.

This change fixes a bug in HlsSampleStreamWrapper.onPlaylistError()
which would return true for a playlist whose load encountered an error
but could not be excluded, whereas the method should return false.

Issue: #9390

#minor-release

PiperOrigin-RevId: 397045802
2021-09-16 12:14:33 +01:00
ibaker
4433ac5a2a Rollback of ee8df7afcb
*** Original commit ***

Ensure MediaSourceFactory instances can be re-used

This fixes DefaultDrmSessionManager so it can be used by a new Player
instance (by nulling out its reference to the playback thread, which is
unique per-Player instance). This only works if the
DefaultDrmSessionManager is 'fully released' before being used by the
second Player instance, meaning that the reference count of the manager
and all its sessions is zero.

#exofixit
Issue: #9099

***

PiperOrigin-RevId: 396861138
2021-09-16 12:07:27 +01:00
ibaker
4d668f1b7b Fix how preacquired DRM sessions are released under resource contention
Previously the released preacquired sessions would start their keepalive
timeout, and so no additional resources would be freed in time for the
manager to retry the session acquisition.

This change adds an additional purge of keepalive sessions *after* the
preacquired sessions are released, which fixes the problem.

#exofixit
#minor-release

PiperOrigin-RevId: 396613352
2021-09-14 21:33:01 +01:00
kimvde
040a45f310 Remove deprecated getDefaultRequestProperties from HttpDataSource
#exo-fixit

PiperOrigin-RevId: 396329591
2021-09-14 12:02:18 +01:00
andrewlewis
d74be1780d Fix issue ref
PiperOrigin-RevId: 396303288
2021-09-14 11:54:55 +01:00
olly
68ee587e25 Constrain resolved period positions to be within the period
This is a candidate fix for #8906. As mentioned in that issue,
negative positions within windows might be (kind of) valid in
live streaming scenarios, where the window starts at some
non-zero position within the period. However, negative positions
within periods are definitely not valid. Neither are positions
that exceed the period duration.

There was already logic in ExoPlayerImplInternal to prevent a
resolved seek position from exceeding the period duration. This
fix adds the equivalent constraint for the start of the period.
It also moves the application of the constraints into Timeline.
This has the advantage that the constraints are applied as part
of state masking in ExoPlayerImpl.seekTo, removing any UI flicker
where the invalid seek position is temporarily visible.

Issue: #8906
PiperOrigin-RevId: 395917413
2021-09-10 15:11:52 +01:00
claincly
4f06419334 Fix RTSP session header parsing regex error.
Issue: #9416

The dash "-" in the brackets must be escaped, or it acts like a range operator.

#minor-release

PiperOrigin-RevId: 395909845
2021-09-10 15:09:50 +01:00
bachinger
9e3ef8180f Select base URL on demand when a new chunk is created
Instead of selecting the base URL initially or when a load error occurs, it is now selected when a chunk or initialization chunk is created. The selected base URL is then assigned to `RepresentationHolder.lastUsedBaseUrl` that is excluded in case of a load error. For a next chunk another base URL will be selected by using the `BaseUrlExclusionList`.

#minor-release #exo-fixit

PiperOrigin-RevId: 395721221
2021-09-09 18:19:51 +01:00
kimvde
0c969bb73d Remove deprecated SingleSampleMediaSource.createMediaSource
#exofixit

PiperOrigin-RevId: 395518824
2021-09-09 18:13:25 +01:00
ibaker
ee8df7afcb Ensure MediaSourceFactory instances can be re-used
This fixes DefaultDrmSessionManager so it can be used by a new Player
instance (by nulling out its reference to the playback thread, which is
unique per-Player instance). This only works if the
DefaultDrmSessionManager is 'fully released' before being used by the
second Player instance, meaning that the reference count of the manager
and all its sessions is zero.

#exofixit
#minor-release
Issue: #9099
PiperOrigin-RevId: 395490506
2021-09-09 18:09:21 +01:00
ibaker
bd38c28bb8 Fix a bug in core_settings.gradle with relative paths
I think this has been broken since 617267bfcf (which was trying to fix
the same problem).

This change initializes `rootDir` to always be the current project (i.e. ExoPlayer)
directory. From the [Gradle docs](https://docs.gradle.org/current/userguide/working_with_files.html#sec:single_file_paths):
> What happens in the case of multi-project builds? The file() method
> will always turn relative paths into paths that are relative to the
> current project directory, which may be a child project.

We can also then remove exoplayerRoot completely and simplify the local
dependency instructions.

* #minor-release
* #exofixit
* Issue: #9403

PiperOrigin-RevId: 395478121
2021-09-08 17:18:31 +01:00
claincly
e6b5392e63 Handle malformed URL in RTP-Info header.
Some server will send partial URIs in the RTP-Info header, while the RTSP spec
requires absolute URLs.

Issue: #9346

#exofixit

PiperOrigin-RevId: 395452741
2021-09-08 17:12:47 +01:00
bachinger
d9bc22314a Use identical cache keys for downloading and playing DASH segments
#minor-release #exofixit
Issue: #9370
PiperOrigin-RevId: 395429794
2021-09-08 17:04:57 +01:00
klhyun
442a5f4500 Update PlayerView's UI when available commands change
PiperOrigin-RevId: 395395015
2021-09-08 16:58:44 +01:00
olly
86f8c4e44e Fix some PlayerControlView accessibility issues
- Fix focus when pausing and resuming
- Prevent repeated readout of the playback position when paused

#exofixit
#minor-release
Issue #9111

PiperOrigin-RevId: 395301765
2021-09-07 20:28:54 +01:00
olly
e53e59388f ID3: Fix end-of-string detection for UTF-16
The current detection logic checks that the two byte terminator starts
at an even position in the ID3 data, where-as it should check that it
starts at an even position relative to the start of the string.

#minor-release
#exofixit
Issue: #9087
PiperOrigin-RevId: 395274934
2021-09-07 20:26:35 +01:00
olly
b6089758ff Fix incorrect assertion in CacheDataSource
#minor-release
#exofixit

PiperOrigin-RevId: 395233639
2021-09-07 17:54:35 +01:00
claincly
093d117127 Handle when additional spaces are in SDP's RTPMAP atrribute
Issue: #9379
PiperOrigin-RevId: 395226701
2021-09-07 17:50:42 +01:00
olly
730cdbb9e6 Use defStyleAttr when obtaining styled attributes in player views
#minor-release
#exofixit
Issue #9024

PiperOrigin-RevId: 395224661
2021-09-07 17:48:45 +01:00
olly
2e21208f63 Workaround ConnectivityManager SecurityException on Android 11
#exofixit
#minor-release
Issue: #9002
PiperOrigin-RevId: 395221648
2021-09-07 17:44:41 +01:00