5394 Commits

Author SHA1 Message Date
andrewlewis
1ce040003a Add AdPlaybackState toString
This is useful for debugging both in tests and via logging.

PiperOrigin-RevId: 316102968
2020-06-17 20:26:42 +01:00
olly
e5ec8e6b47 Prevent shutter closing for within-window seeks to unprepared periods
Issue: #5507
PiperOrigin-RevId: 315512207
2020-06-17 20:19:11 +01:00
olly
46d29b25c9 Reintroduce isConnected check for download requirements
PiperOrigin-RevId: 314925639
2020-06-05 15:46:05 +01:00
olly
7a8f878a1f Bump version to 2.11.5
PiperOrigin-RevId: 314903986
2020-06-05 13:08:38 +01:00
olly
1347a2200f Fix more cases of downloads not being resumed
Issue: #7453
PiperOrigin-RevId: 314710328
2020-06-04 15:56:54 +01:00
olly
a818049143 Fix position jank after pausing and seeking
Issue: #6901
PiperOrigin-RevId: 314418536
2020-06-03 10:18:04 +01:00
olly
fb011e66a6 AudioTrackPositionTracker: Prevent negative timestamps
Issue: #7456
PiperOrigin-RevId: 314408767
2020-06-03 10:17:53 +01:00
aquilescanta
79acadcc89 Check for section_syntax_indicator in TS tables
Issue:#7325
PiperOrigin-RevId: 314321914
2020-06-03 10:17:39 +01:00
tonihei
145754618d Simplify keeping track of current id in DefaultPlaybackSessionManager
We currently have a currentMediaPeriodId and an activeSessionId that are more
or less tracking the same thing unless the current media period isn't "active" yet.

Simplify this logic by using a single currentSessionId field and the respective
isActive flag of this session. Also move all session creation and activation code in
the same method to make it easier to reason about the code.

This change also fixes a subtle bug where events after a seek to a new window
are not ignored as they should.

PiperOrigin-RevId: 289432181
2020-06-01 18:04:26 +01:00
tonihei
f4cc1d6250 Make sure finishAllSessions() can be called without removing listener
Currently, this method is only supposed to be called before removing
the listener from the player or when releasing the player.

If called at other times, it will throw an exception later when
a playback session is ended automatically.

issue:#7193
PiperOrigin-RevId: 308254993
2020-06-01 18:01:46 +01:00
tonihei
18eccf9a81 Make sure not to create new playback sessions while still IDLE.
The first session should only be created once we have the media items
and/or called prepare. Otherwise the first session is created with
an EventTime having an empty timeline making it less useful.

issue:#7193
PiperOrigin-RevId: 308100555
2020-06-01 17:52:48 +01:00
Oliver Woodman
1062edf52e Revert "Update TrackSelectionDialogBuilder to use androidx compat Dialog."
This reverts commit b05e9944ea95c2b1a341610568e5cfbe8df6f333.
2020-06-01 09:50:40 +01:00
andrewlewis
51a3f214ed Fix handling of fetch errors for post-rolls
The ad break time in seconds from IMA was "-1" for postrolls, but this didn't
match C.TIME_END_OF_SOURCE in the ad group times array.

Handle an ad break time of -1 directly by mapping it onto the last ad group,
instead of trying to look it up in the array.

PiperOrigin-RevId: 312064886
2020-05-29 22:29:29 +01:00
andrewlewis
51b2a0f7a9 Add support for timing out ad preloading
Detect stuck buffering cases in ImaAdsLoader, and discard the ad group after
a timeout. This is intended to make the IMA extension more robust in the case
where an ad group unexpectedly doesn't load.

The timing out behavior is enabled by default but apps can choose to retain
the old behavior by setting an unset timeout on ImaAdsLoader.Builder.

PiperOrigin-RevId: 311729798
2020-05-29 22:29:14 +01:00
andrewlewis
de03e389c0 Enable nullness checking for the IMA extension
adPlaybackState is now non-null, and the uninitialized case is covered by a new
boolean hasAdPlaybackState. Position progress updates are now non-null and
initialized with IMA's VIDEO_TIME_NOT_READY constant.

Also fix some misc code issues:
- Remove empty branch for SmoothStreaming (Android Studio warns about this).
- Tidy onTimelineChanged and onPositionDiscontinuity and the methods they call
  to improve naming.
- Remove logging for IMA events after release, as these methods are expected to
  be called in the current IMA SDK behavior.

PiperOrigin-RevId: 308977116
2020-05-29 21:58:59 +01:00
tonihei
67d1b728d3 Clarify/fix position reference points for AdPlaybackState.
The positions were interchangeably used with window and period
positions. This change more clearly ensures that all positions in the
AdPlaybackState are based on periods and that we use the right adjustments
for all usages.

PiperOrigin-RevId: 297811633
2020-05-29 21:50:07 +01:00
tonihei
d1b900604a Add test to ensure AdsLoader is initialized.
This tests explicitly that initialization happens even if the Timeline
is a placeholder.

No other change is needed. While the Timeline is still a placeholder
ImaAdsLoader.getCurrentPeriodPosition will return 0 and trigger
pre-rolls (intended behaviour) and it doesn't matter whether the
actual initial period position may be somewhere else.

PiperOrigin-RevId: 298833867
2020-05-29 21:42:22 +01:00
Oliver Woodman
4e6fe31ee1 Merge pull request #6724 from nnoury:fix/subtitles-outline-color
PiperOrigin-RevId: 292316767
2020-05-29 21:15:17 +01:00
olly
d162c07ecf Add show/hideScrubber to DefaultTimeBar
PiperOrigin-RevId: 300249371
2020-05-29 21:15:17 +01:00
olly
2640538228 Apply minimal layout change according to view size
- Add method to scale scrubber handle of DefaultTimeBar

PiperOrigin-RevId: 294366734
2020-05-29 21:15:17 +01:00
andrewlewis
10b8eff727 Don't overwrite MP4 container fps using capture fps
The capture frame rate is currently available both via Format.metadata
and decoded in Format.frameRate. As the container Format.frameRate may
be useful to apps, only store the capture frame rate in metadata (apps
will need to decode it but can now access the container frame rate too).

PiperOrigin-RevId: 284165711
2020-05-29 21:15:17 +01:00
tonihei
d14f559e94 Fix message indexing bug.
We keep an index hint for the next pending player message. This hint
wasn't updated correctly when messages are removed due to a timeline
update.

This change makes sure to only use the hint locally in one method so
that it doesn't need to be updated anywhere else and also adds the "hint"
suffix to the variable name to make it clearer that it's just a hint and
there are no guarantees this index actually exists anymore.

issue:#7278
PiperOrigin-RevId: 309217614
2020-05-29 21:15:17 +01:00
Oliver Woodman
7e02066f6e Merge pull request #7422 from noamtamim:bandwidthmeter-5g
PiperOrigin-RevId: 313372995
2020-05-29 21:15:17 +01:00
tonihei
b05e9944ea Update TrackSelectionDialogBuilder to use androidx compat Dialog.
This ensure style themes are correctly applied.

issue:#7357
PiperOrigin-RevId: 313145345
2020-05-29 21:15:17 +01:00
olly
1d8dd763f0 Fix SimpleCache.getCachedLength rollover bug & improve test coverage
PiperOrigin-RevId: 312266156
2020-05-29 21:15:17 +01:00
samrobinson
09025d3912 Allow MP3 files to play with size greater than 2GB.
Issue:#7337
PiperOrigin-RevId: 312042768
2020-05-29 21:15:17 +01:00
olly
4736a102f8 Attach ExoMediaCryptoType for progressive streams
PiperOrigin-RevId: 311628160
2020-05-29 21:15:17 +01:00
olly
f116f29812 Prevent leaking of the Thread.interrupt flag to other LoadTasks
PiperOrigin-RevId: 311290214
2020-05-29 21:15:17 +01:00
samrobinson
ad1dffcae8 Make the base values of SilenceSkippingAudioProcessor configurable.
Issue:#6705
PiperOrigin-RevId: 310907118
2020-05-29 21:15:17 +01:00
samrobinson
8304cf3480 Change SilenceSkippingAudioProcessor to not rely on the frame MSB.
PiperOrigin-RevId: 309925306
2020-05-29 21:15:17 +01:00
tonihei
d159f622c2 Update initial bitrate estimates.
PiperOrigin-RevId: 309720018
2020-05-29 21:15:17 +01:00
Oliver Woodman
01ff17f3e7 Merge pull request #7304 from AChep:patch-1
PiperOrigin-RevId: 309395364
2020-05-29 21:15:17 +01:00
olly
2fa2fb73b7 Catch correct exception from Context.startService
Issue: #7306
PiperOrigin-RevId: 309392633
2020-05-29 21:15:17 +01:00
Oliver Woodman
7414a86fe0 Let MediaSourceFactory setDrmSessionManager accept null
Issue: #7168
2020-05-29 21:15:17 +01:00
Oliver Woodman
dfc3c507a0 Don't allow bad MediaSource release implementation to crash player.
This also allows subsequent MediaSource instance in the list to still
be released successfully.

Issue: #7168
2020-05-29 21:15:17 +01:00
olly
1772b0d917 ConditionVariable: Fix block(long) to correctly handle large timeouts
PiperOrigin-RevId: 308815613
2020-05-27 20:35:00 +01:00
olly
9213ffafa8 ConditionVariable: Improve documentation and allow clock injection
- Improve documentation explaining the benefits of ExoPlayer's ConditionVariable
  over the one that the platform provides
- Allow Clock injection
- Create TestUtil method for obtaining a ConditionVariable whose block(long)
  method times out correctly when used in a Robolectric test
- Add basic unit tests for ConditionVariable

PiperOrigin-RevId: 308812698
2020-05-27 20:33:54 +01:00
christosts
3ac4c1a6e5 Add Clock#currentTimeMillis()
PiperOrigin-RevId: 306602043
2020-05-27 20:31:38 +01:00
aquilescanta
49e5e66033 Fix NPE when reading from a SampleQueue from a loading thread
Issue: #7273
PiperOrigin-RevId: 308238035
2020-05-27 20:22:32 +01:00
aquilescanta
7ee08f09d2 Fix AdsMediaSource parameter when reporting load error
PiperOrigin-RevId: 308041841
2020-05-27 20:10:24 +01:00
tonihei
b954a5aa5f Fix timestamp rounding error in fMP4 extractor.
The sample timestamps are currently rounded to milliseconds, only to
be multiplied by 1000 later. This causes rounding errors where the sample
timestamps don't match the timestamps in the seek table (which are already
in microseconds).

issue:#7086
PiperOrigin-RevId: 307630559
2020-05-27 20:07:46 +01:00
ibaker
d9703358ac Use anti-aliasing and bitmap filtering for bitmap subtitles
issue:#6950
PiperOrigin-RevId: 307411067
2020-05-27 20:07:46 +01:00
olly
a697905cfb Fix H265Reader to correctly output SEI and AUD NAL units
Issue: #7113
PiperOrigin-RevId: 307380133
2020-05-27 20:07:46 +01:00
olly
190d81f0f6 Noop naming generalization for H265Reader
This change generalizes the concept of "reading parameter sets" to
"reading prefix NAL units", ahead of a change that will treat AUD
and suffix SEI NAL units in the same way.

The change also introduces some static isXxxNalUnit methods for
clarity.

Issue: #7113
PiperOrigin-RevId: 307376967
2020-05-27 20:07:46 +01:00
andrewlewis
e7e74afbff Fix AdsMediaSource child sources not being released
Also add unit tests for AdsMediaSource.

PiperOrigin-RevId: 307365492
2020-05-27 20:07:42 +01:00
andrewlewis
cf52742ad9 Fix gapless playback
Audio processors are now flushed twice after reconfiguration.
The second flush call cleared the pending trim start bytes so
transitions between tracks were no longer gapless.

Fix this by removing logic to clear pending trim bytes on flush.
As a result we may trim data incorrectly if there is a flush
before any data has been handled for seeking to a non-zero
position, but this edge case will happen rarely and the effect
shouldn't be noticeable.

PiperOrigin-RevId: 307344357
2020-05-27 19:36:49 +01:00
olly
e6b5e6eb6e Merge trick play tracks into main track groups
Issue: #6054
PiperOrigin-RevId: 307285068
2020-05-27 19:36:27 +01:00
Oliver Woodman
ad36f64965 Merge pull request #7210 from nebyan:CacheKeyFactoryNotUsed
PiperOrigin-RevId: 307045655
2020-05-27 19:29:20 +01:00
bachinger
aea9f8e550 Merge pull request #7245 from Clement-Jean:silence-media-source-factory
PiperOrigin-RevId: 307010600
2020-05-27 19:28:30 +01:00
andrewlewis
4dc1d317c3 Fix TeeAudioProcessor sink configuration
TeeAudioProcessor needs to configure its sink when it is initially set up.

PiperOrigin-RevId: 306808871
2020-05-27 19:27:16 +01:00