5963 Commits

Author SHA1 Message Date
olly
ee14fe7adf Align Decoder(Audio|Video)Renderer decoder re-use logic
- Fix DecoderAudioRenderer to re-init codec if the DRM session changes.
- Add canKeepCodec to DecoderVideoRenderer. Previously it was assumed
  that the decoder could be re-used, but this will not be true in all
  cases for FfmpegVideoRenderer.

Issue: #7079
PiperOrigin-RevId: 309935278
2020-05-05 18:38:50 +01:00
tonihei
2e81186a33 Add timeout to TestExoPlayer runUntil methods.
If the condition isn't fulfilled, they currently block until the
test runner times out the test. Our usual approach is to timeout
in the test itself so that the error message is clearly showing the
blocked condition.

Also clean-up some documentation.

PiperOrigin-RevId: 309930198
2020-05-05 18:38:41 +01:00
samrobinson
d944f32f24 Change SilenceSkippingAudioProcessor to not rely on the frame MSB.
PiperOrigin-RevId: 309925306
2020-05-05 18:38:32 +01:00
krocard
918963c2b4 Do not use MediaCodec in passthrough mode.
Now that MediaCodec is not use in passthrough, no
MediaCodec should be created in this mode.

Additionally, do not instantiate a MediaCodec in passthrough

#exo-offload

PiperOrigin-RevId: 309916131
2020-05-05 18:38:23 +01:00
aquilescanta
a8d1de5198 Fix TrackOutput documentation for encryption data format
PiperOrigin-RevId: 309899166
2020-05-05 18:38:05 +01:00
aquilescanta
fff3f99f4a Pass LoadErrorInfo to LoadErrorHandlingPolcy
Issue: #7309
PiperOrigin-RevId: 309749566
2020-05-05 18:37:57 +01:00
olly
862a6e4dd2 Pass appropriate frame-rate to Surface.setFrameRate
PiperOrigin-RevId: 309746009
2020-05-05 18:37:47 +01:00
tonihei
3c2e5df527 Update initial bitrate estimates.
PiperOrigin-RevId: 309720018
2020-05-05 18:37:12 +01:00
tonihei
5819b47f41 Use helper method for duplicated message sending logic.
PiperOrigin-RevId: 309709215
2020-05-05 18:36:54 +01:00
tonihei
3ebad15338 Fix usage of deprecated IntDef.
And allow default value constant to be assigned as valid value.

PiperOrigin-RevId: 309708888
2020-05-05 18:36:45 +01:00
tonihei
3100f5938d Reorder SimpleExoPlayer constructor calls.
We currently call the old (deprecated) from the new one and not
the other way round.

Also remove a duplicated method.

PiperOrigin-RevId: 309702752
2020-05-05 18:36:34 +01:00
olly
bb744e5f9b DownloadManager.Task: Remove top level thread interrupt
DownloadManager doesn't know enough about the Downloader implementations to
know that interrupting the thread is the right thing to do. In particular,
if a Downloader implementation wants to delegate work to additional worker
threads, then it will probably not want its main thread to be interrupted
on cancelation. Instead, it will want to cancel/interrupt its worker threads,
and keep its main thread blocked until work on those worker threads has
stopped (download() must not return whilst the Downloader is still touching
the cache).

This change moves control over what happens to the individual Downloader
implementations.

Issue: #5978
PiperOrigin-RevId: 309419177
2020-05-01 19:51:14 +01:00
olly
32516d85be Simplify thread interruption for downloads.
- Stop throwing InterruptedException from CacheUtil. When a CacheUtil operation
  throws or returns, the caller should always check its own state to determine
  whether they canceled the operation. If a caller is trying to catch
  InterruptedException separately to IOException to do something different in
  that case, they're probably doing the wrong thing. So it's simpler, and probably
  less error prone, just to throw an IOException in the case of interruption.
- Throwing InterruptedIOException is also consistent with what our Extractor and
  DataSource implementations do.

Issue: #5978
PiperOrigin-RevId: 309411556
2020-05-01 19:51:05 +01:00
olly
f946606643 Map R-prerelease to SDK_INT=30
PiperOrigin-RevId: 309411490
2020-05-01 19:50:56 +01:00
Oliver Woodman
af6baaed90 Merge pull request #7304 from AChep:patch-1
PiperOrigin-RevId: 309395364
2020-05-01 19:50:46 +01:00
olly
36b43780d3 Catch correct exception from Context.startService
Issue: #7306
PiperOrigin-RevId: 309392633
2020-05-01 19:50:34 +01:00
ibaker
e11ae734ed Add RelativeSizeSpan support to SpannedHtmlConverter
PiperOrigin-RevId: 309391401
2020-05-01 19:50:26 +01:00
aquilescanta
192b6832b6 Notify eventDispatcher.loadError when wrong kind of playlist is loaded
PiperOrigin-RevId: 309390501
2020-05-01 19:50:17 +01:00
ibaker
eb7c14704f Add AbsoluteSizeSpan to SpannedHtmlConverter
PiperOrigin-RevId: 309390205
2020-05-01 19:50:08 +01:00
ibaker
fa0178d043 Add TypefaceSpan support to SpannedToHtmlConverter
PiperOrigin-RevId: 309390050
2020-05-01 19:50:00 +01:00
ibaker
10db7a9c45 Ensure we destroy WebViews when we detach them from SubtitleView
PiperOrigin-RevId: 309389731
2020-05-01 19:49:51 +01:00
ibaker
79c003f5a8 Add bitmap support to SubtitleWebView using SubtitleTextView
PiperOrigin-RevId: 309389571
2020-05-01 19:49:42 +01:00
ibaker
222231dd8e Update SubtitleWebView to use center alignment by default
This mimics the behaviour of SubtitleTextView for cues that don't have
alignment set.

PiperOrigin-RevId: 309389392
2020-05-01 19:49:33 +01:00
aquilescanta
0774ee1da9 Merge LoadErrorHandlingPolicy cleanup methods
Issue: #7309
PiperOrigin-RevId: 309387483
2020-05-01 19:49:24 +01:00
aquilescanta
956514ad9b Add internal demo flavor that uses MediaParser for progressive media
PiperOrigin-RevId: 309258505
2020-05-01 19:49:16 +01:00
ibaker
ab57c8010f Add bottomPaddingFraction support to SubtitleWebView
PiperOrigin-RevId: 309245320
2020-05-01 19:49:07 +01:00
ibaker
caeeae2c9e Use system foreground & background color in SubtitleWebView
PiperOrigin-RevId: 309244671
2020-05-01 19:48:58 +01:00
ibaker
4371617ec9 Add HTML support for BackgroundColorSpan
PiperOrigin-RevId: 309244135
2020-05-01 19:48:50 +01:00
ibaker
8c64d188cc Add support for Cue and default text sizes in SubtitleWebView
PiperOrigin-RevId: 309243467
2020-05-01 19:48:41 +01:00
tonihei
85bc1d6e14 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-01 19:48:14 +01:00
olly
1950905990 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
PiperOrigin-RevId: 309202170
2020-05-01 19:48:06 +01:00
aquilescanta
c4f65eb84a Add LoadErrorHandlingPolicy cleanup callbacks
Implementors should use the new callbacks to
clean up any resources associated with the
corresponding LoadEventInfo ids.

PiperOrigin-RevId: 309198455
2020-05-01 19:47:57 +01:00
olly
f6a2fad6b6 DownloadManagerTest: Clean up the tests themselves
PiperOrigin-RevId: 309022070
2020-05-01 19:47:40 +01:00
ibaker
b74b4f3c35 In-line WebvttSubtitleTest helper methods
testSubtitleEventTimes/IndicesHelper make assertions that only happen
to be the same because values in two different constants match up. It
seems much better to explicitly put the assertions in each test.

The other assert methods are just obscuring the underlying call to
Truth.

PiperOrigin-RevId: 309022044
2020-05-01 19:47:31 +01:00
ibaker
767b29f159 Implement the rest of WebVTT's line computation
Steps 4-10 of https://www.w3.org/TR/webvtt1/#cue-computed-line

This part is harder to fit into our code structure because it depends on
how many cues are simultaneously visible - so it has to go in
WebvttSubtitle not WebvttCueParser (which only deals with individual
cues in isolation).

This removes the `isNormal()` method that was trying to approximate
the correct behaviour.

PiperOrigin-RevId: 309021686
2020-05-01 19:47:23 +01:00
olly
c98caa86e9 DownloadManagerTest: Flatten downloader list
PiperOrigin-RevId: 308999582
2020-05-01 19:47:14 +01:00
olly
b65e682957 DownloadManagerTest: Disambiguate between download and removal
PiperOrigin-RevId: 308997845
2020-05-01 19:47:05 +01:00
olly
ec34c083f4 DownloadManagerTest: Make posting consistent
PiperOrigin-RevId: 308991602
2020-05-01 19:46:56 +01:00
andrewlewis
3b315b8134 Add TrackSelectionView getTag null check
PiperOrigin-RevId: 308988419
2020-05-01 19:46:48 +01:00
ibaker
922b8a2c15 Add option to FakeTrackOutput to de-duplicate repeated formats
Expose this through ExtractorAsserts via a new AssertionConfig object

PiperOrigin-RevId: 308980701
2020-05-01 19:46:30 +01:00
andrewlewis
625c734726 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-01 19:46:22 +01:00
andrewlewis
dcbdbe5341 Fix handling of ad timelines without prerolls
The player's initial PlaylistTimeline has no ad cue points, so its first
MediaPeriodId has no nextAdGroupIndex. When the AdsMediaSource provides its
first timeline, the cue points become known. For the case where a preroll cue
point appeared, the preroll was detected due to isAd changing on the
MediaPeriodId.  For the case where a midroll/postroll cue point appeared, the
MediaPeriodId was actually treated as the same, which leads to keeping the
unclipped original MediaPeriod.

Fix this behavior by checking for nextAdGroupIndex becoming set or decreasing.

PiperOrigin-RevId: 308974490
2020-05-01 19:46:13 +01:00
bachinger
b22783f895 Rename sourceUri to uri
PiperOrigin-RevId: 308918151
2020-05-01 19:46:04 +01:00
ibaker
284b843da0 Add fall-back behaviour for vertical cues if rendering isn't supported
PiperOrigin-RevId: 308854072
2020-05-01 19:45:55 +01:00
aquilescanta
053a8ac425 Add some mime type constants to MimeTypes
PiperOrigin-RevId: 308846313
2020-05-01 19:45:46 +01:00
olly
2d494861ec Cleanup and document TestDownloadManagerListener
PiperOrigin-RevId: 308843488
2020-05-01 19:45:29 +01:00
insun
4580b52454 Clean up old xml files which are not referenced anymore.
PiperOrigin-RevId: 308841370
2020-05-01 19:45:20 +01:00
olly
8ab709c677 DownloadManagerTest: Remove DownloadRunner
Its only real purpose is to encapsulate a download ID, but it doesn't actually save
any code, and arguably makes it more complicated by having multiple lists of
Downloader instances, indexed by key, and also because it's another (undocumented)
class to understand.

This CL retains the multiple Downloader lists, but they will be flattened in a
child CL.

PiperOrigin-RevId: 308838026
2020-05-01 19:45:12 +01:00
olly
528104919f Add DownloadManager.getApplicationLooper
This is equivalent to the method ExoPlayer provides. It's nice for consistency,
and for retrieving the looper from test code.

PiperOrigin-RevId: 308830288
2020-05-01 19:44:54 +01:00
olly
c746885ca2 DownloadManagerTest: Don't make Downloaders ahead of the manager
DownloadRunner.getDownloader was creating Downloader instances before the actual
DownloadManager under test would have created them. Tests were then asserting and
manipulating these Downloader instances, which is quite confusing. In particular
FakeDownloader.assertDoesNotStart() is an assertion on a Downloader instance that
only makes sense when called on an instance that DownloadManager would not have
created by itself.

This change replaces FakeDownloader.assertDoesNotStart() with an assertion on
DownloadRunner that no Downloader instance has been created.

PiperOrigin-RevId: 308822398
2020-05-01 19:44:45 +01:00