3635 Commits

Author SHA1 Message Date
christosts
a0d99a6ac8 Fix flaky unit tests
PiperOrigin-RevId: 334580007
2020-10-06 14:29:52 +01:00
yqritc
eaff9d5105 apply setOutputSurface workaround for more devices 2020-10-02 14:27:13 +09:00
ibaker
88999da3be Add playback tests for more TS assets
PiperOrigin-RevId: 334549894
2020-09-30 11:55:35 +01:00
andrewlewis
6b13640eeb Fix position ramping behavior with AudioTrack speed params
Non-realtime AudioTrack playback speed was not taken into account when
extrapolating the old mode's position, causing the position not to
advance smoothly.

This should be a no-op when not using AudioTrack playback params for
speed adjustment.

Issue: #7982
PiperOrigin-RevId: 334151163
2020-09-30 11:55:27 +01:00
Phil Cluff
1a63f9e3d2 Update HTTP status codes expected in failover scenarios. 2020-09-28 18:27:26 +01:00
christosts
397fe8f305 Bring back setRenderTimeLimitMs
PiperOrigin-RevId: 333712782
2020-09-25 16:34:10 +01:00
christosts
0066586499 Remove SynchronousMediaCodecBufferEnqueuer
Remove the SynchronousMediaCodecBufferEnqueuer interface
since we only keep the AsynchronousMediaCodecBufferEnqueuer
implementation.

PiperOrigin-RevId: 333701115
2020-09-25 16:33:42 +01:00
krocard
7dfdde9246 Retry AudioTrack init and write before throwing
Retry AudioTrack init and write for 100ms before
giving up and aborting playback.

This was tested by throwing every 2 init/write and
making sure playback did not stopped.

#exo-offload

PiperOrigin-RevId: 333536841
2020-09-25 16:33:33 +01:00
krocard
56cb327f1e Clarify offload stream event callback impl
#exo-offload

PiperOrigin-RevId: 333532900
2020-09-25 16:33:23 +01:00
krocard
55a13d8871 Callback on audio track failure
Intended for statistics now that all errors
are not surfaced to the app.

PiperOrigin-RevId: 333519898
2020-09-25 16:33:14 +01:00
krocard
fad2846d1c Workaround AudioTrack incorrect error code
#exo-offload

PiperOrigin-RevId: 333513385
2020-09-25 16:33:05 +01:00
krocard
aa7309cdea Release wakelock when sleeping for offload
#exo-offload

PiperOrigin-RevId: 333512383
2020-09-25 16:32:55 +01:00
krocard
d97af76280 Retry after offload playback failure
Do that by adding a recoverable state to
the ExoPlaybackException marking when
it is needed to recreate the renderers.

PiperOrigin-RevId: 333507849
2020-09-25 16:32:46 +01:00
christosts
3b14b05d93 Remove MediaCodecOperationMode
Remove MediaCodecOperationMode and replace it with a boolean
flag to enable/disable asynchronous queueing.

PiperOrigin-RevId: 333504817
2020-09-25 16:32:28 +01:00
krocard
dd99d23621 Remove unnecessary AudioTrack alias
Those aliases were introduced when the class
was also called AudioTrack.

PiperOrigin-RevId: 333499360
2020-09-25 16:32:18 +01:00
krocard
f37d79a4dd Callback when sleeping for offload and existing from it
#exo-offload

PiperOrigin-RevId: 333497538
2020-09-25 16:32:09 +01:00
tonihei
294ae10ef1 Change default of throwsWhenUsingWrongThread to true
Apps can still opt out for now, but this option will be removed in
the future.

Issue: #4463
PiperOrigin-RevId: 333489424
2020-09-25 16:32:00 +01:00
tonihei
66636f9ec0 Switch SntpClient to time.android.com and allow to set host.
PiperOrigin-RevId: 333480727
2020-09-25 16:31:38 +01:00
krocard
3be2463a94 Fix offload buffer full detection after setEndOfStream
This issue has been observed on a test app stress
testing setEndOfStream.

The issue has not been observed on ExoPlayer,
probably due to timing differences, but it is fixed
preventively.

#exo-offload

PiperOrigin-RevId: 333472136
2020-09-25 16:31:29 +01:00
tonihei
25e31743d3 Don't require the existence of the next period to wait for its stream.
We have a workaround for uneven sample stream durarions in playlists that
assumes a renderer allows playback if it's reading ahead or waiting for
the next stream.

652c2f9c18 changed this logic to no longer require to
wait until the next stream is prepared due to a change in how we advance
media periods in the queue. However, the code falsely still requires the
next stream to exist (even if it's not prepared). This can cause a stuck
buffering state when the difference in the duration of the streams is more
than what we buffer ahead because we never create the next stream in such
a case.

Note: DefaultMediaClock.shouldUseStandaloneClock has roughly the same logic
and also doesn't require the next stream to be present.

Also fix a test that seemed to rely on this stuck buffering case to test
stuck buffering detection. Changed the test to not read the end of stream
to ensure it runs into the desired stuck buffering case.

Issue:#7943
PiperOrigin-RevId: 333050285
2020-09-25 16:30:25 +01:00
ibaker
77d125b243 Use replace() instead of replaceAll() in SsaDecoder
We're not using regex so there's no need to use replaceAll()

PiperOrigin-RevId: 332865724
2020-09-21 22:58:28 +01:00
krocard
dc24274391 Recover from audio server crash while sleeping for offload
Without this patch, playback would be frozen indefinitely
until the user manually pauses and unpauses it.

This has the side effect of disabling offload until
the next stop due to the workaround of
disabling offload when it encounters a failure.

As an audio server crash is considered very
infrequent, especially in stable conditions like
an audio only playback, it is unlikely that disabling
offload is an issue.

PiperOrigin-RevId: 332857094
2020-09-21 22:58:19 +01:00
Oliver Woodman
cf3e61ae6f Merge pull request #7938 from bennettpeter:pullreq-ssa-subtitles
PiperOrigin-RevId: 332814223
2020-09-21 22:57:58 +01:00
kimvde
4aa3a0482d Add unit tests for Transformer
PiperOrigin-RevId: 332416139
2020-09-21 22:57:47 +01:00
ibaker
70ebe12ef9 Suppress Guava-related ProGuard/R8 warnings
I didn't copy-paste the whole of
https://github.com/google/guava/wiki/UsingProGuardWithGuava because
this line seems relevant based on our current usage.

Lots of that file seems to relate to classes that are strongly
discouraged on Android:
https://github.com/google/guava/wiki/Android#specifics

I've only added this to the `common` module, since everyone that uses
ExoPlayer must depend on that. This avoids duplicating this line into
every module that has a Guava dependency.

Also remove some other warning suppressions that are defined in both
`core` and `common`.

Issue: #7904
PiperOrigin-RevId: 332203086
2020-09-17 17:41:34 +01:00
Peter Bennett
efd5265e87 text: Fix handling of unbreakable-space in ssa subtitles
The character sequence \h is used for "unbreakable space".
Replace these sequences with space to avoid strings of \h
showing up on screen.
2020-09-17 11:21:30 -04:00
olly
f387574140 Fix OOM-is-prevented test OOM-ing :)
This test is intended to check that DefaultLoadControl will cause
playback to fail as "stuck buffering" rather than OOM-ing, in the
case that its target buffer size is reached and playback still
hasn't started.

Unfortunately, the target buffer size is ~130MB, and when running
on some setups an OOM actually ends up happening before this much
memory is allocated.

This change makes the target buffer size much smaller to avoid the
problem.

PiperOrigin-RevId: 331748208
2020-09-16 13:33:42 +01:00
olly
6be879c21b Clean up experimental offload Javadoc
PiperOrigin-RevId: 331591005
2020-09-16 13:33:33 +01:00
bachinger
91a491ea31 Add getMediaItemCount() and getMediaItemAt(int)
PiperOrigin-RevId: 331211708
2020-09-11 23:09:38 +01:00
olly
cdcb30ed21 Exclude Guava transitive annotation dependencies
PiperOrigin-RevId: 331148067
2020-09-11 16:01:15 +01:00
olly
f7ff5d59a4 Make BatchBufferTest allocate less memory
Setting to 2x BATCH_SIZE_BYTES

PiperOrigin-RevId: 331124129
2020-09-11 13:25:14 +01:00
olly
b9ed9ee379 Fix incorrect type when creating ExoPlaybackException
PiperOrigin-RevId: 331027732
2020-09-11 13:24:56 +01:00
bachinger
a3bac6b63e fix typo
PiperOrigin-RevId: 331025924
2020-09-11 13:24:48 +01:00
tonihei
157dffdca9 Don't keep 100MB static buffer in test.
This may remove available memory from other tests running in the same
process. Instead, create the huge buffer when needed so it can be GCed
immediately.

PiperOrigin-RevId: 330960844
2020-09-11 13:24:39 +01:00
tonihei
267cc53770 Release player in e2e playback tests.
Not releasing the player means the playback thread keeps running
and also keeps its entire allocated playback buffer.

PiperOrigin-RevId: 330958821
2020-09-11 13:24:30 +01:00
krocard
19e6de778d Introduce audio offload scheduling tests
PiperOrigin-RevId: 330918396
2020-09-11 13:24:13 +01:00
tonihei
362d4f5b16 Add convenience constructor methods.
When passing in ExtractorFactory instances to SimpleExoPlayer.Builder or
DefaultMediaSourceFactory, we currently need to pass in one other
instance (RenderersFactory or DataSource.Factory), that developers will
often set to its default. To avoid specifying these defaults, these new
convience methods allow to just set the ExtractorsFactory if required.

PiperOrigin-RevId: 330908002
2020-09-11 13:24:04 +01:00
andrewlewis
abc39088d0 Remove testutil dependency on Robolectric shadows
Move shadow-related utils for end-to-end tests into core test.

PiperOrigin-RevId: 330902696
2020-09-11 13:23:45 +01:00
kimvde
6abe6a676e Support android.resource URI scheme
Issue: #7866
PiperOrigin-RevId: 330736774
2020-09-09 17:43:15 +01:00
olly
9e42b24e26 Fix Javadoc for DefaultDataSourceFactory constructors
PiperOrigin-RevId: 330736458
2020-09-09 17:43:06 +01:00
olly
b2b08ade99 Make User-Agent optional
PiperOrigin-RevId: 330593247
2020-09-09 09:41:51 +01:00
tonihei
bfe17aee3e Support ExtractorFactory in DefaultMediaSourceFactory.
This allows to customize extractor flags more easily when setting up the player.

In addition, we need to provide a way to pass in the ExtractorFactory through
the constructor chain starting in SimpleExoPlayer so that removing the
DefaultExtractorsFactory is possible for R8.

PiperOrigin-RevId: 330472935
2020-09-09 09:41:42 +01:00
olly
04f67e4adc Simplify DefaultMediaSourceFactory ad configuration
- Use a setter, which is consistent with how other optional
  components are passed.
- Remove nesting where a provider provides another provider.
  Since AdSupportProvider then only provides one thing, it
  can be renamed to AdsLoaderProvider, which more clearly
  expresses what it provides.

PiperOrigin-RevId: 330396334
2020-09-07 20:43:41 +01:00
Oliver Woodman
442aa78196 Merge pull request #7814 from zubcoco:dev-v2
PiperOrigin-RevId: 330366909
2020-09-07 20:43:30 +01:00
olly
45dc66ef2f Clear CodecInfos on InputFormat if codec is null
In maybeInitCodecWithFallback, it caches availableCodecInfos with mediaCryptoRequiresSecureDecoder and inputFormat as inputs, and won't clear it if shouldInitCodec is false, resulting in a case where availableCodecInfos is not null and codec is null.
When we have a new format, it's reasonable to clear availableCodecInfos if codec is null. Otherwise we might not be able to properly initialize a new codec.

PiperOrigin-RevId: 329971796
2020-09-07 20:43:00 +01:00
christosts
8dcab1d20a Remove fragile tests
PiperOrigin-RevId: 329894431
2020-09-07 20:42:42 +01:00
olly
fe2fc8b73f Add useful DownloadRequest to MediaItem conversion method
PiperOrigin-RevId: 329722775
2020-09-07 20:42:14 +01:00
olly
8e5336c59e Dev guide: Start updating the download page
PiperOrigin-RevId: 329719402
2020-09-07 20:41:55 +01:00
christosts
29f2a31af7 Re-enable ignored unit tests
PiperOrigin-RevId: 329675833
2020-09-07 20:41:36 +01:00
gyumin
d155416c54 Add Util.postOrRun
To avoid repetition, it adds Util.postOrRun and replaces existing
instances with the util method.

PiperOrigin-RevId: 329472769
2020-09-07 20:40:04 +01:00