7889 Commits

Author SHA1 Message Date
christosts
dee0c2cc71 Bump version to 2.15.1 and tidy release notes
PiperOrigin-RevId: 397758146
2021-09-21 09:54:16 +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
claincly
212e37f82a Fix RTSP WWW-Authenticate header parsing.
Issue: #9428

PiperOrigin-RevId: 397064086
2021-09-16 17:50:19 +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
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
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
olly
a1d376fae1 Fix incorrect assertion in CacheDataSource
#minor-release
#exofixit

PiperOrigin-RevId: 395233639
2021-09-16 14:37:21 +01:00
claincly
624d212df2 Handle when additional spaces are in SDP's RTPMAP atrribute
Issue: #9379
PiperOrigin-RevId: 395226701
2021-09-16 14:36:40 +01:00
olly
28d5b35723 Use defStyleAttr when obtaining styled attributes in player views
Issue #9024

PiperOrigin-RevId: 395224661
2021-09-16 14:33:32 +01:00
olly
ced4232fd8 Duration readers: Return TIME_UNSET rather than a negative value
This typically happens if there's a discontinuity in the stream.
It's better to say we don't know, than it is to return a negative
position.

Issue: #8346
#exofixit
#minor-release
PiperOrigin-RevId: 395224088
2021-09-16 14:30:42 +01:00
olly
140e110e44 Workaround ConnectivityManager SecurityException on Android 11
Issue: #9002
PiperOrigin-RevId: 395221648
2021-09-16 14:29:54 +01:00
kimvde
aa88e0b430 Avoid OMX.qti.audio.decoder.flac on API level < 32
Before, this decoder was avoided on API levels < 30.

#minor-release
Issue:#9349
PiperOrigin-RevId: 395209684
2021-09-16 14:01:28 +01:00
gyumin
b40a6b86d6 Fix FlagSet.equals on API levels below 24
PiperOrigin-RevId: 395004645
2021-09-16 14:00:50 +01:00
olly
e7a7235a47 Remove max API level for reading TV resolution from system properties
PiperOrigin-RevId: 394415421
2021-09-16 13:59:07 +01:00
kimvde
4a7aaaa3b9 Fix DefaultTrackSelector Javadoc about tunneling
#minor-release
Issue:#9350
PiperOrigin-RevId: 394112689
2021-09-16 13:58:30 +01:00
ibaker
8909f2017f Fix incorrect DataSourceContractTest test names
These should have been updated as part of
1affbf9357

#minor-release

PiperOrigin-RevId: 392913561
2021-09-16 13:56:22 +01:00
kimvde
152d1c7dc9 TsExtractor: handle packets without PTS
Issue: #9294
PiperOrigin-RevId: 392844983
2021-09-16 13:55:36 +01:00
andrewlewis
66d1e2cc9e Remove stray symlinks
These are unneeded for the external project

#minor-release

PiperOrigin-RevId: 392835942
2021-09-16 13:54:09 +01:00
bachinger
6f01e2f035 Make constructor of PlayerNotificationManager protected
Issue: #9303
#minor-release
PiperOrigin-RevId: 392022613
2021-09-16 13:53:40 +01:00
olly
54418eb644 Size dolby vision buffers for H265 by default
PiperOrigin-RevId: 391965200
2021-09-16 13:53:00 +01:00
olly
287e72c477 Add note that isLastBuffer is best-effort only
PiperOrigin-RevId: 391952144
2021-09-16 13:50:40 +01:00
kimvde
4fd7d777b6 Fix issue caused by using ForwardingPlayer and StyledPlayerControlView
StyledPlayerControlView was checking whether the player is an ExoPlayer
instance to set the track selector. This means that, if apps were
wrapping an ExoPlayer in a ForwardingPlayer (to replace a
ControlDispatcher for example), the track selector wasn't set anymore.

PiperOrigin-RevId: 391776305
2021-09-16 13:50:04 +01:00
christosts
64002f6b9a Annotate deprecated methods in ForwardingPlayer
This change is needed to generate correct javadoc, otherwise
these methods appear as not deprecated.

#minor-release

PiperOrigin-RevId: 390339092
2021-09-16 13:48:15 +01:00
christosts
8f3dbdf81c Minor javadoc fix in BaseUrlExclusionList
PiperOrigin-RevId: 390136807
2021-09-16 13:47:51 +01:00
christosts
f34446123d Bump version to 2.15.0 and tidy release notes
PiperOrigin-RevId: 389871495
2021-08-10 15:41:20 +01:00
christosts
bf462aca69 Fix bug in Timeline.getRemovedAdGroupCount()
#minor-release

PiperOrigin-RevId: 389174519
2021-08-06 16:10:43 +01:00
andrewlewis
8fb1e5ce51 Set StreamIndex Name as format.label in SS
Issue: #9252

#minor-release

PiperOrigin-RevId: 388889406
2021-08-05 12:44:20 +01:00
claincly
6ca0b30755 Handle RTSP session id properly.
Issue: #9254

#minor-release

We used to allow only alphanumerical characters in session id. The spec also
allows "$", "-", "_", ".", "+" (RFC2326 Sections 3.4 and 15.1).

PiperOrigin-RevId: 388873742
2021-08-05 12:43:57 +01:00
aquilescanta
17723c0836 Simplify network-related error codes
This change removes ERROR_CODE_IO_NETWORK_UNAVAILABLE,
ERROR_CODE_IO_NETWORK_CONNECTION_CLOSED, and ERROR_CODE_IO_DNS_FAILED
in favor of keeping only ERROR_CODE_IO_NETWORK_CONNECTION_FAILED.

PiperOrigin-RevId: 388715972
2021-08-04 19:05:41 +01:00
Christos Tsilopoulos
f23ab8e2c1 Merge pull request #9247 from colinbarr:dev-v2-rtsp-fmtp-trailing-semicolon
PiperOrigin-RevId: 388713101
2021-08-04 19:04:04 +01:00
olly
ba3f86821f Tweak use of TimestampAdjuster for seeking
- Fix use of getTimestampOffsetUs in TsExtractor where
  getFirstSampleTimestampUs should have been used.
- Don't reset TimestampAdjuster if it's in no-offset mode.
- Improve comment clarity

#minor-release

PiperOrigin-RevId: 388682711
2021-08-04 19:03:06 +01:00
christosts
5689e093da Set HlsSampleStreamWrapper.trackType for audio-only playlists
For audio-only playlists, when formats are communicated to the app with
AnalyticsListener.onDownstreamFormatChanged(), the passed MediaLoadData
do not indicate this is an audio track and therefore the
PlaybackStatsListener cannot derive audio format-related information.

This change sets the main SampleStreamWrappers track type to AUDIO, if
the master playlist contains only audio variants.

Issue: #9175

#minor-release

PiperOrigin-RevId: 388676060
2021-08-04 19:02:50 +01:00
christosts
5b2b882e81 Change how AnalyticsCollector releases listeners
The AnalyticsCollector releases listeners lazily so that listener
callbacks triggered on the application looper after
SimpleExoPlayer.release() are still handled. The change in ListenerSet
to post the onEvents callback on the front of the application looper
changed (correctly) how onEvents are propagated, however this made
the AnalyticsCollector deliver onEvents with out-of-order EventTimes.

This change fixes AnalyticsCollector to trigger onPlayerReleased() and
the matching onEvents() event in the correct order.

#minor-release

PiperOrigin-RevId: 388668739
2021-08-04 19:02:29 +01:00
andrewlewis
5932406926 Use AudioTrack.isDirectPlaybackSupported on TVs only
Issue: #9239

PiperOrigin-RevId: 388437614
2021-08-04 19:01:19 +01:00
apodob
95dcd89651 Add font-size support to WebVTT CssParser.
This CL addresses the github issue [#8946](https://github.com/google/ExoPlayer/issues/8964). That issue requests support for `font-size` CSS property in WebVTT subtitle format. This CL:
* Adds support for `font-size` property by extending capabilities of WebVTT `CssParser`. Implementation of `font-size` property value parsing is based on the one in `TtmlDecoder`.
* Adds unit test along with test file containing WebVTT subtitles with all currently supported `font-size` units.

#minor-release

PiperOrigin-RevId: 388423859
2021-08-04 18:57:58 +01:00
olly
8732f2f030 HLS: Avoid stuck-buffering issues
Issue: #8850
Issue: #9153
#minor-release
PiperOrigin-RevId: 388257563
2021-08-04 18:57:08 +01:00
olly
e95c42ef98 Simplify TimestampAdjuster logic
- Use timestampOffsetUs == C.TIME_UNSET directly as the way of
  determining whether the adjuster has determined the offset,
  rather than relying on lastSampleTimestampUs checks for this.
- Remove comment referring to lastSampleTimestampUs as holding
  the "adjusted PTS". Its value may not have originated from a PTS
  timestamp. It's also confusing to refer to it as "adjusted"
  given timestampOffsetUs has not been applied to it.
- Fix PassthroughSectionPayloadReader to make sure it'll never
  output a sample with an unset timestamp.

#minor-release

PiperOrigin-RevId: 388226180
2021-08-04 18:56:39 +01:00
olly
ff71425dca Fix resetting TimestampAdjuster with DO_NOT_OFFSET
Prior to this change, an initalized TimestampAdjuster that's then
reset with DO_NOT_OFFSET would incorrectly continue to apply the
offset.

Also add a test case for this issue, and for some other simple use
cases.

#minor-release

PiperOrigin-RevId: 388182645
2021-08-04 18:55:25 +01:00