12124 Commits

Author SHA1 Message Date
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
claincly
5f0395ee2d Add RTSP state machine.
Please reference RFC2326 Section A.1 for the state transitions.

PiperOrigin-RevId: 396799104
2021-09-16 12:05:27 +01:00
kimvde
416ec75b94 Add factory methods to create MediaCodecAdapter.Configuration
#exofixit

PiperOrigin-RevId: 396793873
2021-09-16 12:03:30 +01:00
huangdarwin
7947d27819 Docs: Add demos and testapps documentation.
* Add new README files for the Transformer demo and media/testapps/.
* Add an androidx demos README in media/github/

PiperOrigin-RevId: 396784430
2021-09-16 12:01:45 +01:00
andrewlewis
8540b7266c Add open @IntDef for track selection type
#exofixit

PiperOrigin-RevId: 396780460
2021-09-16 11:59:57 +01:00
ibaker
aa8fe5df86 Add a test for MediaItem equality when using whole-object setters
Follow-up to 9f3c2fb5e1

PiperOrigin-RevId: 396776798
2021-09-16 11:58:05 +01:00
krocard
92bf5d80c7 Add nullness annotations to TsExtractors
#exofixit

PiperOrigin-RevId: 396658717
2021-09-14 21:35:08 +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
andrewlewis
ee11d08760 Fix DashChunkSource @param name
This needs to match with the implementation for Dackka javadoc generation to succeed.

PiperOrigin-RevId: 396377019
2021-09-14 12:13:35 +01:00
olly
f8d60e2bbb Add flag for constant bitrate seeking even if input length is unknown
PiperOrigin-RevId: 396363113
2021-09-14 12:11:48 +01:00
krocard
cf0ec91934 Simplify rendererDisabledFlags bundling
Align redererDisableFlags (un)bundling
with the other field by using an explicit
temporary data structure (int array).

PiperOrigin-RevId: 396358143
2021-09-14 12:09:58 +01:00
olly
4940f21d48 Make position-out-of-range errors non-retryable
PiperOrigin-RevId: 396354920
2021-09-14 12:07:52 +01:00
andrewlewis
469c0e756a Use @C.TrackType more widely
Also add `TYPE_USE` target on the @IntDef (and fix @Targets for other
@IntDefs).

#exofixit

PiperOrigin-RevId: 396333212
2021-09-14 12:04:11 +01:00
kimvde
040a45f310 Remove deprecated getDefaultRequestProperties from HttpDataSource
#exo-fixit

PiperOrigin-RevId: 396329591
2021-09-14 12:02:18 +01:00
christosts
cd91ae4053 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-14 12:00:24 +01:00
bachinger
76d60b911e Migrate media item transition tests to TestExoPlayer
PiperOrigin-RevId: 396313679
2021-09-14 11:58:30 +01:00
andrewlewis
71a4b6337c Fix javadoc consistency
#exofixit

PiperOrigin-RevId: 396304941
2021-09-14 11:56:45 +01:00
andrewlewis
d74be1780d Fix issue ref
PiperOrigin-RevId: 396303288
2021-09-14 11:54:55 +01:00
claincly
ff7dcbd6f2 Handle RTSP 301/302 redirection.
PiperOrigin-RevId: 396303242
2021-09-14 11:53:06 +01:00
andrewlewis
76014cf0e9 Add support for generating javadoc with Dackka
PiperOrigin-RevId: 396297834
2021-09-14 11:51:14 +01:00
huangdarwin
a951769eaa Transformer Demo: Reduce visibility of demo-only include.
PiperOrigin-RevId: 395936070
2021-09-14 11:49:13 +01:00
Marcus Wichelmann
65001cc0e5
Added javadoc comments to HevcConfig 2021-09-13 16:48:08 +02:00
Marcus Wichelmann
45db77dc6d
Fixed some spaces 2021-09-13 12:34:44 +02:00
Marcus Wichelmann
dbc7088716
Keep the existing parseSpsNalUnit (and similar) methods to avoid breaking changes 2021-09-13 12:30:21 +02:00
Marcus Wichelmann
296074fbea
Extend SPS parsing when building the initial MP4 HevcConfig and include the PAR for propagating it into the Format 2021-09-13 10:27:55 +02: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
ibaker
9f3c2fb5e1 Add MediaItem.DrmConfiguration.Builder and use it in MediaItem.Builder
PiperOrigin-RevId: 395896034
2021-09-10 15:07:48 +01:00
huangdarwin
7dff223d80 Transformer Demo: Add config page to remove audio/video.
The new ConfigurationActivity can be used to
configure settings specifying Transformer inputs,
using checkboxes and submitted via a button.

PiperOrigin-RevId: 395826358
2021-09-10 15:05:26 +01:00
bachinger
2138bfb396 Add DASH samples with multiple base URLs
PiperOrigin-RevId: 395727438
2021-09-09 18:21: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
andrewlewis
0c4bb23dd3 Rename audioVolume parameter to volume
The new name is consistent with the corresponding parameters to `onVolumeChanged`, `setDeviceVolume` and `onDeviceVolumeChanged`.

PiperOrigin-RevId: 395705288
2021-09-09 18:17:40 +01:00
olly
1bef1a2b38 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-09 18:15:24 +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
kimvde
b6e0ade939 Rename transformer renderer methods to make them match
#exofixit

PiperOrigin-RevId: 395479329
2021-09-08 17:20:25 +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
apodob
837667dea1 Add seeking support to the SubtitleExtractor
SubtitleExtractor is using IndexSeekMap with only one position to
indicate that its output is seekable. SubtitleExtractor is keeping Cues
in memory anyway so more seek points are not needed. SubtitleExtractor
gets notified about seek occurrence through seek() method. Inside that
method extractor saves seekTimeUs, and on the next call to read()
extractor outputs all cues that should be displayed at this time and
later.

PiperOrigin-RevId: 395477127
2021-09-08 17:16:31 +01:00
ibaker
87d2054b67 Update value of C.TRACK_TYPE_NONE to -2 to allow for future 'real'
track types.

PiperOrigin-RevId: 395460563
2021-09-08 17:14:34 +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
samrobinson
c403de1c19 Fix AudioSink reset javadoc.
PiperOrigin-RevId: 395444714
2021-09-08 17:10:44 +01:00
olly
c2e6d2028b Fix poor documentation and variable name choice in StreamKey
Issue #9284

PiperOrigin-RevId: 395443015
2021-09-08 17:08:56 +01:00
claincly
e088cb4318 Handle RTSP request by replying Method Not Allowed.
PiperOrigin-RevId: 395438728
2021-09-08 17:06:46 +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
andrewlewis
3cdc8a9ea3 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-08 17:02:48 +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
apodob
66335ab6f5 Redesign states of the SubtitleExtractor.
Simplifies the SubtitleExtractor implementation. Makes the extractor
more aligned with the Extractor interface documentation by removing
STATE_DECODING in which extractor was doing nothing in term of input
and output while returning RESULT_CONTINUE at the same time.

PiperOrigin-RevId: 395267468
2021-09-07 20:24:16 +01:00
ibaker
9949424da4 Deprecate all methods on C and move them to Util
C should only hold constants.

Also resolve the TODO in getErrorCodeForMediaDrmErrorCode(), and
annotate the deprecated methods with Error Prone's @InlineMe to
facilitate automated refactoring of callers.

PiperOrigin-RevId: 395244855
2021-09-07 17:56:41 +01:00