12248 Commits

Author SHA1 Message Date
ibaker
ad99a44083 Add empty sdk-version node to all AndroidManifest.xml files
PiperOrigin-RevId: 397772916
2021-09-21 14:17:33 +01:00
christosts
dee0c2cc71 Bump version to 2.15.1 and tidy release notes
PiperOrigin-RevId: 397758146
2021-09-21 09:54:16 +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
andrewlewis
7d524d6d6f Fix incorrect @IntRange
PiperOrigin-RevId: 397753634
2021-09-20 17:37:43 +01:00
ibaker
9666fbdda6 Add MediaItem.LiveConfiguration.Builder
PiperOrigin-RevId: 397748657
2021-09-20 17:35:59 +01:00
ibaker
47b82cdc45 Add MediaItem.AdsConfiguration.Builder
PiperOrigin-RevId: 397718885
2021-09-20 13:04:31 +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
andrewlewis
8a910fd0aa Make @HlsMediaSource.MetadataType TYPE_USE
PiperOrigin-RevId: 397717018
2021-09-20 13:00:46 +01:00
tonihei
0f3a86b89d Remove accidental log line.
PiperOrigin-RevId: 397707790
2021-09-20 12:58:48 +01:00
ibaker
8d3cad570e Document MediaItem.DrmConfiguration#buildUpon()
PiperOrigin-RevId: 397697019
2021-09-20 12:57:08 +01:00
ibaker
701be41534 Demo app: Fail fast if parsing invalid DRM config from JSON
These fields can't be used if `drm_uuid` isn't set. Make that case throw
an exception, so it's obvious to a developer what's wrong.

Most of the fields 'obviously' need `drm_uuid` to be set, but it's not
obvious for `drm_session_for_clear_content` (because it might be
reasonable to assume it's possible to play clear content without
specifying a UUID). This tripped me up in
https://github.com/google/ExoPlayer/issues/8842#issuecomment-833659808.

PiperOrigin-RevId: 397328556
2021-09-20 12:54:55 +01:00
kimvde
0f0e11aaeb Make README structure match the desired androidx structure
PiperOrigin-RevId: 397319051
2021-09-17 16:06:00 +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
ibaker
5f3953d336 Improve AdtsExtractor#sniff when trying different sync word offsets
The previous implementation did the following (after skipping any ID3
headers at the start of the stream):
1. Skip forward byte-by-byte looking for a sync word (0xFFF)
2. Assume this indicates the start of an ADTS frame and read the size
  a) If frameSize <= 6 immediately return false
3. Skip forward by frameSize and expect to find another ADTS sync word
   (with no further scanning).
   b) If we find one, great! Loop from step 2.
   a) If we don't find one then assume the **last** sync word we found
      wasn't actually one, so loop from step 1 starting one extra byte
      into the stream. This means we're looking for a sync word we would
      have skipped over in step 3.

The asymmetry here comes from the different handling of frameSize <= 6
(immediately return false) and frameSize being 'wrong because it doesn't
lead to another sync word' (scan the file again from the beginning for
alternative sync words).

With this change both these cases are handled symmetrically (always scan
for alternative sync words). Step 2a) becomes the same as 3b): Loop back
to the beginning of the stream with an incremented offset and scan for
another sync word.

#minor-release

PiperOrigin-RevId: 397285756
2021-09-17 13:22:13 +01:00
olly
8d01d66ac9 Fix documention for specifying a custom exolist.json
Issue: #9437
#minor-release
PiperOrigin-RevId: 397273931
2021-09-17 13:21:26 +01:00
ibaker
04943db71c Don't call MediaItem.Builder#setKeySetId without setting the DRM UUID
This is known to silently drop the value. This setter is now deprecated
in favour of `MediaItem.Builder#setDrmConfiguration(MediaItem.DrmConfiguration)`,
which requires a UUID in order to construct the `DrmConfiguration`
instance.

Issue: #9378 tracks correctly propagating the DRM info out of
`DownloadRequest#toMediaItem`.
PiperOrigin-RevId: 397291013
2021-09-17 13:14:57 +01:00
ibaker
13827186aa Use the new MediaItem.Builder#setDrmConfiguration method
PiperOrigin-RevId: 397290953
2021-09-17 13:12:53 +01:00
ibaker
73aece6356 Improve AdtsExtractor#sniff when trying different sync word offsets
The previous implementation did the following (after skipping any ID3
headers at the start of the stream):
1. Skip forward byte-by-byte looking for a sync word (0xFFF)
2. Assume this indicates the start of an ADTS frame and read the size
  a) If frameSize <= 6 immediately return false
3. Skip forward by frameSize and expect to find another ADTS sync word
   (with no further scanning).
   b) If we find one, great! Loop from step 2.
   a) If we don't find one then assume the **last** sync word we found
      wasn't actually one, so loop from step 1 starting one extra byte
      into the stream. This means we're looking for a sync word we would
      have skipped over in step 3.

The asymmetry here comes from the different handling of frameSize <= 6
(immediately return false) and frameSize being 'wrong because it doesn't
lead to another sync word' (scan the file again from the beginning for
alternative sync words).

With this change both these cases are handled symmetrically (always scan
for alternative sync words). Step 2a) becomes the same as 3b): Loop back
to the beginning of the stream with an incremented offset and scan for
another sync word.

#minor-release

PiperOrigin-RevId: 397285756
2021-09-17 13:10:58 +01:00
bachinger
6f728a43ad Remove obsolete imports
PiperOrigin-RevId: 397280475
2021-09-17 12:03:50 +01:00
olly
985e73dec8 Fix documention for specifying a custom exolist.json
Issue: #9437
#minor-release
PiperOrigin-RevId: 397273931
2021-09-17 12:00:41 +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
krocard
a75f902c81 Add track type disabling to Track selection parameters
This will allow to disable video/audio... through the player
interface.

PiperOrigin-RevId: 397183548
2021-09-17 11:55:51 +01:00
olly
4ff4263af3 DownloadService: Minor improvements
* Avoid ActivityManager log spam by only calling startForeground once,
  and subsequently updating the notification via NotificationManager.
* Tweak demo app service to make it a tiny bit easier to swap the Scheduler.

PiperOrigin-RevId: 397179398
2021-09-17 11:53:39 +01:00
olly
6edf9c31bf DownloadService: Only call getScheduler once
The second getScheduler() call violates the documentation of
the class, which states that getScheduler() is not called if
foregroundNotificationId if FOREGROUND_NOTIFICATION_ID_NONE.
Presumably implementing subclasses would return null, in which
case this didn't do any harm, but we should make sure the
implementation behaves as documented regardless.

PiperOrigin-RevId: 397167603
2021-09-16 22:44:06 +01:00
christosts
a95ee0aeba Move release note entry to correct section
#minor-release

PiperOrigin-RevId: 397164973
2021-09-16 22:41:50 +01:00
bachinger
f7abce6aea Move FlacConstant to lib-extractor
PiperOrigin-RevId: 397156268
2021-09-16 22:39:14 +01:00
bachinger
c21d5c7f33 Remove fully qualified link tag
PiperOrigin-RevId: 397141742
2021-09-16 22:37:20 +01:00
olly
f6d8cfeb1f DownloadService: Remove deprecated protected methods
PiperOrigin-RevId: 397138908
2021-09-16 22:35:23 +01:00
claincly
212e37f82a Fix RTSP WWW-Authenticate header parsing.
Issue: #9428

PiperOrigin-RevId: 397064086
2021-09-16 17:50:19 +01:00
krocard
4455554e9e Use Android 12's AudioManager.getPlaybackOffloadSupport
Previously gapless offload support was hardcoded to Pixel
only.

PiperOrigin-RevId: 397070378
2021-09-16 16:57:02 +01:00
bachinger
f8dde8ed5f Move classes from util package in lib-exoplayer
PiperOrigin-RevId: 397066804
2021-09-16 16:54:59 +01:00
samrobinson
e5e8d9dc17 Make StubExoPlayer take a context in constructor.
This is a pre-requisite step for merging SimpleExoPlayer into
ExoPlayer, because when StubExoPlayer extends ExoPlayer, it needs
a matching constructor.

PiperOrigin-RevId: 397065374
2021-09-16 16:52:52 +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
dfc29fc315 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

PiperOrigin-RevId: 397045802
2021-09-16 16:44:22 +01:00
ibaker
b4aa8688df 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.

PiperOrigin-RevId: 396613352
2021-09-16 16:41:35 +01:00
christosts
e6cb52a471 PlaybackStatsListener: add check when adding guessed times
This is was reported in #9257 where the PlaybackStatsListener may try to
access an emtpy ArrayList.

Issue: #9257

#minor-release
#exofixit

PiperOrigin-RevId: 396329373
2021-09-16 16:39:51 +01:00
olly
3147a53c47 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-16 16:14:20 +01:00
claincly
927d507397 Fix RTSP session header parsing regex error.
Issue: #9416

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

PiperOrigin-RevId: 395909845
2021-09-16 16:11:51 +01:00
bachinger
5a5aeda3ec Add DASH samples with multiple base URLs
PiperOrigin-RevId: 395727438
2021-09-16 16:09:35 +01:00
bachinger
25a6ff5753 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`.

PiperOrigin-RevId: 395721221
2021-09-16 16:08:05 +01:00
olly
051e18b26f Fix STATE_IDLE Javadoc
Since playlist support was added, it's possible for the player to "have media"
and be in STATE_IDLE. The STATE_IDLE documentation therefore became incorrect.

Issue: #8946
#exofixit
#minor-release
PiperOrigin-RevId: 395653716
2021-09-16 15:14:48 +01:00
ibaker
9046124f97 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-16 15:13:51 +01:00
claincly
036039fb64 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

PiperOrigin-RevId: 395452741
2021-09-16 15:11:42 +01:00
samrobinson
745c33f2d0 Fix AudioSink reset javadoc.
PiperOrigin-RevId: 395444714
2021-09-16 15:08:48 +01:00
olly
8a85cbbcd2 Fix poor documentation and variable name choice in StreamKey
Issue #9284

PiperOrigin-RevId: 395443015
2021-09-16 15:06:02 +01:00
bachinger
69c75fb5b0 Use identical cache keys for downloading and playing DASH segments
Issue: #9370
PiperOrigin-RevId: 395429794
2021-09-16 14:51:20 +01:00
andrewlewis
ee2ef1c3d5 Use correct last timestamp for C2 MP3 workaround
The C2 MP3 decoder produces an extra output buffer when draining after
end-of-stream is queued. This output buffer has a later timestamp than the last
queued input buffer so we need to calculate its timestamp to detect a stream
change in the correct position.

Before this CL we used the original input buffer timestamp as the largest
queued timestamp, which caused the stream change to be detected at the correct
position because the original input buffer timestamp was slightly larger than
the actual last output buffer timestamp. After this change we use exact
calculated timestamp as the largest queued timestamp. I manually verified
gapless continues to work on a device using the C2 MP3 decoder by comparing
output of the MP3 gapless and MP3 gapless stripped playlists in the demo app,
and that the last buffer timestamp now matches.

#exofixit

PiperOrigin-RevId: 395428928
2021-09-16 14:49:31 +01:00
klhyun
6452364c1c Update PlayerView's UI when available commands change
PiperOrigin-RevId: 395395015
2021-09-16 14:48:55 +01:00
olly
dd33afb335 Fix some PlayerControlView accessibility issues
- Fix focus when pausing and resuming
- Prevent repeated readout of the playback position when paused

Issue #9111

PiperOrigin-RevId: 395301765
2021-09-16 14:46:44 +01:00
olly
1bd96fbaf7 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.

Issue: #9087
PiperOrigin-RevId: 395274934
2021-09-16 14:40:45 +01:00