4178 Commits

Author SHA1 Message Date
olly
ae47a138ee Delete unused surfacecapturer package
PiperOrigin-RevId: 366131005
2021-04-01 16:06:18 +01:00
ibaker
af926deb7a Use outputStreamEnded for MetadataRenderer#isEnded
Issue: #8710
#minor-release
PiperOrigin-RevId: 366051836
2021-04-01 16:06:09 +01:00
tonihei
a7d7cfd023 Release all PlaybackStatsListener session when timeline becomes empty.
Currently they are only released when the timeline becomes non-empty
again or the player is released.

Issue: #8778
PiperOrigin-RevId: 366041625
2021-04-01 16:06:01 +01:00
olly
f5a4f3e609 Switch tests to use SimpleExoPlayer
PiperOrigin-RevId: 366033200
2021-04-01 16:05:35 +01:00
Oliver Woodman
6603c6bbcf Merge pull request #8720 from dlafayet:tts-shear-block
PiperOrigin-RevId: 365998615
2021-04-01 16:05:00 +01:00
tonihei
dc0ee7580e Deprecate AnalyticsListener.onSeekStarted.
The new onPositionDiscontinuity callback contains sufficient information, so
that this former workaround to obtain the position before a seek is no longer
needed.

PiperOrigin-RevId: 365993937
2021-04-01 16:04:51 +01:00
olly
db42bef17b Modify visibility of onQueueInputBuffer.
Aims to achieve visibility parity with MediaCodecRenderer#onQueueInputBuffer.

Allows measuring the time when the codec queue the first input buffer in the codec. Which means the Codec has been initialized and is about to start decoding.

It also allows measuring how long it takes for the Codec to render its first frame.

PiperOrigin-RevId: 365906756
2021-04-01 16:04:34 +01:00
tonihei
192c1a18f7 Don't include video tracks without bitrate in adaptive selection.
This is generally not supported by our classes. A similar change for audio
was made in aa2beb080c.

PiperOrigin-RevId: 365795371
2021-04-01 16:04:26 +01:00
tonihei
f31894616c Ensure callback can't access player before constructor finished.
If the player is created on a background thread (which is allowed
as the only exception to the access-on-one-thread-only rule), it
may happen that a callback on the main thread tries to access the
player before the constructor even finished. This is dangerous and
can cause exceptions due to uninitialized variables.

To solve this, we can make sure that every player access is blocked
until the constructor finished. Blocking is safe because the
constructor itself is not doing any blocking work or acquiring locks.

The thread verification method is already called on every entry
point to the player, so we can reuse the same method for checking.

PiperOrigin-RevId: 365792949
2021-04-01 16:04:08 +01:00
tonihei
394ab7bcfd Make use of position discontinuity changes.
The extended onPositionDiscontinuity callback can be used to improve some
listener classes:
 - Listening to onTimelineChanged to detect discontinuities is no longer needed.
 - Listening to onSeekStarted is no longer needed as the start position is part
   of the onPositionDiscontinuty callback.
 - The exact old position is also useful for media time history logging.

As a side effect, removing onSeekStarted handling from PlaybackStatsListener
fixes Issue: #8675 that was caused by the special EventTime handling for
onSeekStarted.

PiperOrigin-RevId: 365558959
2021-04-01 16:04:00 +01:00
olly
47af9a6889 Enable internal retry for recoverable codec exceptions
PiperOrigin-RevId: 365556167
2021-04-01 16:03:51 +01:00
tonihei
e42004652a Add 5G-NSA detection for API 31+
The hacky workaround for APIs 29/30 doesn't work on API 31. Instead,
we can use the onDisplayInfoChanged callback, that is accessible from
API 31.

PiperOrigin-RevId: 364997282
2021-04-01 16:03:17 +01:00
krocard
1526ca5e3c Move add/remove Player.Listener down of BasePlayer
The BasePlayer implementation of add/remove
Listener knows about Components.
As those are removed from the Player
interface, the implementation of those
methods needs to be moved down in Player
implementations.

This commit makes no functional change.

PiperOrigin-RevId: 364985291
2021-04-01 16:03:09 +01:00
olly
3ebf94cd45 DataSources: Remove position-out-of-range workarounds
PiperOrigin-RevId: 364871094
2021-04-01 16:02:50 +01:00
Denise LaFayette
475b1fe3de Address code review comments 2021-03-25 11:59:28 -07:00
bachinger
dc4148d576 Add positions and new reasons to onPositionDiscontinuity
PiperOrigin-RevId: 364861539
2021-03-24 19:56:25 +00:00
Denise LaFayette
4be774aaac Support tts:shear in TTML parser and WebView output 2021-03-24 12:39:44 -07:00
ibaker
94a4ed7981 Treat Dolby Vision as H264 in MCVR#getCodecMaxInputSize()
Issue: #8705
PiperOrigin-RevId: 364821429
2021-03-24 18:08:06 +00:00
kimvde
e1fec35ff3 Add command to seek to default position
PiperOrigin-RevId: 364821216
2021-03-24 18:07:56 +00:00
tonihei
6f73ac659f Add 5G-SA initial bitrate estimates to bandwidth meter.
PiperOrigin-RevId: 364810286
2021-03-24 18:07:46 +00:00
tonihei
b35c81124d Add 5G-NSA detection.
PiperOrigin-RevId: 364607555
2021-03-24 18:07:06 +00:00
kimvde
b6290b1164 Add commands only available in SimpleExoPlayer
PiperOrigin-RevId: 364598601
2021-03-24 18:06:46 +00:00
krocard
bb1261da3c setPlaybackParameters no longer accepts null for DEFAULT
Null was an alias for DEFAULT. Remove this for nullness
safety in the API.

The ExoPlayer implementation still checks for null and
replaces it by DEFAULT, so this is ABI compatible.

PiperOrigin-RevId: 364370017
2021-03-24 18:05:57 +00:00
Ian Baker
6c688891e3 Merge pull request #8653 from dlafayet:textemphasis
PiperOrigin-RevId: 364363882
2021-03-24 18:05:46 +00:00
gyumin
7b4b5cbf5a Preserve window indices of Timeline when bundling
PiperOrigin-RevId: 364324490
2021-03-24 18:05:35 +00:00
ibaker
10a8c603f7 Fix review comments on SpannedData
Comments made after submitting
e14180e532

PiperOrigin-RevId: 364276495
2021-03-24 18:05:26 +00:00
aquilescanta
d9d2b1fbdd Add 'once' to list of devices that need SetOutputSurfaceWorkaround
Issue: #8718
PiperOrigin-RevId: 363869093
2021-03-24 18:05:06 +00:00
tonihei
adffd43194 Remove AnalyticsCollector.resetForNewPlaylist.
The methods has been a no-op for while now and can be removed.

PiperOrigin-RevId: 363673199
2021-03-24 18:04:47 +00:00
tonihei
f8727b5e87 Move Util.getNetworkType into NetworkTypeObserver.
The main user of the Util method is the bandwidth meter to set the
initial network type. If this is the first call to the
NetworkTypeObserver, then we should also allow the first update to
a known network type even if no reset on network type is activated.

The other uses are analytics listeners that check the network type
at certain events. This can just use the lookup method of the
NetworkTypeObserver.

PiperOrigin-RevId: 363670771
2021-03-24 18:04:37 +00:00
olly
1affbf9357 DataSources: Enforce that opening at end-of-resource succeeds
- Update the three `HttpDataSource` implementations to use the
  Content-Range response header to determine when this is the
  case. The Content-Range header is included when the status
  code is 416. See [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/416).
- Update `ByteArrayDataSource` to conform to the requirement.
- Update `DataSourceContractTest` to enforce the requirement.

PiperOrigin-RevId: 363642114
2021-03-24 18:04:27 +00:00
krocard
b24d9f64a9 Implement deprecated getPlaybackError in PlayerBase
PiperOrigin-RevId: 363606255
2021-03-24 18:03:48 +00:00
olly
8b5090048d Add option to skip samples too big for MediaCodec input buffers
PiperOrigin-RevId: 363480412
2021-03-24 18:03:38 +00:00
olly
2d9177b7c2 SampleStream/SampleQueue: Introduce read flags
- SampleQueue.peek is replaced with SampleQueue.read with
  FLAG_PEEK. This also exposes peek functionality through
  SampleStream.
- Use of DecoderInputBuffer.isFlagsOnly is replaced with
  FLAG_OMIT_SAMPLE_DATA. This flag can be used with or
  without FLAG_PEEK, where-as previously the read position
  would never be advanced for an isFlagsOnly buffer.
- formatRequired is replaced with FLAG_FORMAT_REQUIRED.

PiperOrigin-RevId: 363460105
2021-03-24 18:03:28 +00:00
tonihei
31f65f63ff Remove AutoAdvancingFakeClock.
The class is just an empty shell around the super class and can be
removed.

PiperOrigin-RevId: 363386440
2021-03-24 18:03:18 +00:00
tonihei
4048033491 Move static network type observation out of DefaultBandwidthMeter
In order to detect 5G-NSA, we need to remove Util.getNetworkType
and replace it with a class that is actively listening to changes.
The network type observation in DefaultBandwidthMeter already provides
the right framework to integrate this and in order to facilitate
further changes we move it to a separate Util class.

The overall effect of this change should be a complete no-op.

PiperOrigin-RevId: 363384567
2021-03-24 18:03:08 +00:00
tonihei
3e613beb78 Use time-to-first-byte in AdaptiveTrackSelection.
Knowing the time-to-first-byte allows to update the available
allocatable bandwidth to take this into account.

PiperOrigin-RevId: 363225573
2021-03-24 18:02:58 +00:00
bachinger
57796914a7 Add TimeToFirstByteEstimator
PiperOrigin-RevId: 363188096
2021-03-24 18:02:49 +00:00
kimvde
adcaf4b027 Add available command to seek to any media item
PiperOrigin-RevId: 363144142
2021-03-24 18:02:38 +00:00
olly
675b81e5f7 DataSource: Tighten contract to return -1 on premature end-of-input
PiperOrigin-RevId: 363001266
2021-03-24 18:02:17 +00:00
kimvde
6c9f9f9def Add available command to seek in current item
PiperOrigin-RevId: 362972550
2021-03-15 19:15:19 +00:00
kimvde
46aab92206 Add permanently available commands
PiperOrigin-RevId: 362906290
2021-03-15 19:15:10 +00:00
olly
10de7b2ab0 Tighten DataSource contract test assertions
Assert that opening the DataSource at the end of the resource
results in only RESULT_END_OF_INPUT being read.

open() and read() are still permitted to throw, although this
permissiveness will be removed in subsequent commits.

PiperOrigin-RevId: 362905314
2021-03-15 19:15:01 +00:00
ibaker
6b63bb2248 Fix CEA-708 priority
According to the spec (section 8.4.2), high numeric values represent low
priorities, so we need to flip this sort.

Issue: #8704
#minor-release
PiperOrigin-RevId: 362558370
2021-03-15 19:14:43 +00:00
andrewlewis
93c9c7a072 Don't update the ad group count when releasing ImaAdsLoader
`ImaAdsLoader` clears its `AdPlaybackState` when it's released but this could
cause `AdsMediaSource` to look up information in the ad playback state that is
no longer in bounds.

Issue: #8693

#minor-release

PiperOrigin-RevId: 362556286
2021-03-15 19:14:34 +00:00
tonihei
7c8ab133e9 Move playback speed adjustment of available bandwidth.
When comparing stream bitrate with available (allocated) bandwidth,
we need to take the playback speed into account. In the current
calculation, this can happen on both sides of the equation, but we
take the time to first byte into account, we need to move the speed
into the available, allocated bandwidth.

This change moves the speed adjustment to the bandwidth calculation
side in AdaptiveTrackSelection.

PiperOrigin-RevId: 362540071
2021-03-15 19:14:25 +00:00
ibaker
e14180e532 Add SpannedData.isEmpty() method and simplify some logic in SampleQueue
PiperOrigin-RevId: 362527505
2021-03-15 19:14:16 +00:00
ibaker
795ddfee40 Preacquire DRM sessions from the loading side of SampleQueue
Issue: #4133
PiperOrigin-RevId: 362478801
2021-03-12 10:53:46 +00:00
krocard
3f4f2f90b5 Move offload events to their own listener
Move offload events from Player.EventListener to
ExoPlayer.AudioOffloadListener.

PiperOrigin-RevId: 362472462
2021-03-12 10:44:50 +00:00
olly
93cc91641b Make DataSchemeDataSource consistent with other DataSource impls
PiperOrigin-RevId: 362388683
2021-03-12 10:44:29 +00:00
tonihei
4665ac5490 Add tests to DataSourceContractTest asserting uri/response headers.
These values must be null/empty while the source isn't opened. And the
Uri must be non-null if the source is open.

PiperOrigin-RevId: 362329032
2021-03-12 10:44:09 +00:00