6213 Commits

Author SHA1 Message Date
olly
c9717f67ea Push all Downloader networking onto the executor
Issue: Issue: #6978
PiperOrigin-RevId: 318710782
2020-06-29 13:32:36 +01:00
kimvde
4227c8f19f Move MP4 getTrackSampleTables to AtomParsers
PiperOrigin-RevId: 318485946
2020-06-29 13:32:28 +01:00
bachinger
b9511697f6 Document specialties of the Player interface when timeline is empty
According to the discussion in <unknown commit>.

PiperOrigin-RevId: 318473575
2020-06-29 13:32:19 +01:00
samrobinson
81b0b53a37 Propagate gapless audio delay & padding.
MediaCodec does not need to be re-created in the
event of gapless metadata.

PiperOrigin-RevId: 318439694
2020-06-26 11:23:19 +01:00
krocard
5a72b9452b Allow offload gapless for Pixel on R
Gapless offload is fixed in later R beta builds of all Pixels supporting R.

On the firsts R beta builds of Pixel 4, run the following command.
`setprop vendor.audio.offload.gapless.enabled true`.

It can not be enabled on the first Pixel 2 and 3 beta build.

PiperOrigin-RevId: 318436134
2020-06-26 11:23:19 +01:00
krocard
a971d09a46 Add Offload gapless support
This it is enabled only on a list of
manually tested devices.
The list is empty in this CL.

*** Reason for rollforward ***

Fixed dependent cl was rolled forward.

*** Original change description ***

Rollback of 962e08d3be

*** Original commit ***

Add Offload gapless support

Confirmed to work on a Pixel 4 after enabling the feature:
 `setprop vendor.audio.offload.gapless.enabled true`

***

***

PiperOrigin-RevId: 318433123
2020-06-26 11:23:19 +01:00
krocard
1c018e71d4 Propagate format in supportsOutput
*** Reason for rollforward ***

Fixed dependent cl was rolled forward

*** Original change description ***

Rollback of 2aac0717d7

*** Original commit ***

Propagate format in supportsOutput

It is needed to know if gapless is needed,
as gapless offload might not be supported.

***

***

PiperOrigin-RevId: 318429321
2020-06-26 11:23:19 +01:00
krocard
e386b0b00a Automated g4 rollforward of commit ffa4ad0e77a24168430fb3ac4c2afd13b68a701a.
*** Reason for rollforward ***

Rollforward after making sure the handler is created,
and that a test is written preventing a
similar regression.

*** Original change description ***

Rollback of b6f5a263f7

*** Original commit ***

Rollforward of commit 5612ac50a332e425dc130c3c13a139b9e6fce9ec.

*** Reason for rollforward ***

Rollforward after making sure the handler is created
from the playback thread and not from an app thread.

*** Original change description ***

Rollback of e1beb1d194

*** Original commit ***

PiperOrigin-RevId: 318274400
2020-06-26 11:23:19 +01:00
krocard
a8ae98b1bf Test that ExoPlayer can be built in a background thread
PiperOrigin-RevId: 318264209
2020-06-26 11:23:19 +01:00
kimvde
aaa7fd114e Remove redundant default parameter in Parameter annotation
PiperOrigin-RevId: 318255509
2020-06-26 11:23:19 +01:00
christosts
efb4b1a5ff Ignore tests until ShadowMediaCodec update
Ignore two tests in AsynchronousMediaCodecBufferEnqueuerTest
until the ShadowMediaCodec's behavior is updated to apply
input buffer ownership.

PiperOrigin-RevId: 318251859
2020-06-26 11:21:38 +01:00
insun
d5f029315c Cleanup deprecated SimpleExoPlayerView and PlaybackControlView
PiperOrigin-RevId: 318152038
2020-06-26 11:14:13 +01:00
ibaker
d0309b3798 Add DefaultDrmSessionManagerTest
This uses a license server implemented using MockWebServer to test
DefaultDrmSessionManager and DefaultDrmSession.

PiperOrigin-RevId: 318086890
2020-06-26 11:14:05 +01:00
olly
21b07ba4db Fix broken @value Javadoc
PiperOrigin-RevId: 318077821
2020-06-26 11:13:57 +01:00
olly
35cd367c4c Throw EOFException if requested position is past end of content
PiperOrigin-RevId: 318046646
2020-06-26 11:13:49 +01:00
ibaker
54eccd3893 Change WebViewSubtitleOutput to use em not % for line offsets
The existing code moves a multi-line cue box by multiples of the height
of the whole cue box (incorrect), rather than multiples of the first
line of text (correct). These two are equivalent for single-line cues,
which is why I didn't initially spot the problem.

PiperOrigin-RevId: 318036793
2020-06-26 11:13:41 +01:00
ibaker
06c17f5152 Redefine numeric Cue.line in terms of viewport lines, ignore lineAnchor
Numerical lines conceptually map to a grid of lines in the viewport,
with the Cue text lines being aligned to one of the viewport lines.

It doesn't make sense to position a single-line cue differently based
on lineAnchor when it's expected to 'snap' to a particular line on the
viewport grid. So we redefine the position to be in terms of the cue
lines rather than the bounds of the cue box.

It's also not possible to always handle ANCHOR_TYPE_MIDDLE when
lineType=NUMBER (as it relies on the number of lines in the cue being
odd), so it's easier to ignore lineAnchor completely.
PiperOrigin-RevId: 318034664
2020-06-26 11:13:33 +01:00
tonihei
4138e28d62 Move common gradle setup to a setting file.
This removes a lot of duplication from the module configuration,
avoids divergence, and makes sure that only the important differences
to the default are visible in each module file.

PiperOrigin-RevId: 318024823
2020-06-26 11:13:25 +01:00
olly
73546231d2 Bump ExoPlayerLibraryInfo versions to 2.11.6
PiperOrigin-RevId: 317921368
2020-06-26 11:13:10 +01:00
aquilescanta
05f3fd8138 Add MediaParserHlsMediaChunkExtractor
Which is an HlsMediaChunkExtractor based on MediaParser.

PiperOrigin-RevId: 317886412
2020-06-26 11:13:01 +01:00
gyumin
3eac5b4328 Move AudioAttributes to common module
PiperOrigin-RevId: 317864048
2020-06-26 11:12:53 +01:00
tonihei
9d8f54ab3a Simplify MediaSourceList setup and make class final.
The class was only non-final to allow mocking. Using the real class
in the test works equally well.

PiperOrigin-RevId: 317858805
2020-06-26 11:12:45 +01:00
andrewlewis
093f9931b4 Fix resuming postrolls
Postrolls would be skipped because the period duration wasn't know at
the moment of resuming playback after backgrounding, so the position
wouldn't be resolved to resume the postroll ad.

We have the period duration stored in the AdPlaybackState, so we can
use that directly.

Issue: #7518
PiperOrigin-RevId: 317830418
2020-06-23 11:07:52 +01:00
samrobinson
836babd5d6 Replace usages of Charset.forName with Guava Charsets.
PiperOrigin-RevId: 317672619
2020-06-23 11:07:43 +01:00
tonihei
1836f1df36 Update Checkerframework.
The compat dependency is no longer maintained and we need to keep
it at its old version.

PiperOrigin-RevId: 317658349
2020-06-23 11:07:34 +01:00
ibaker
8cccbcf4fd Migrate DefaultHttpDataSourceTest from Mockito to MockWebServer
PiperOrigin-RevId: 317636681
2020-06-23 11:07:16 +01:00
andrewlewis
dbe16cd268 Remove unnecessary null check
PiperOrigin-RevId: 317604812
2020-06-23 11:06:41 +01:00
tonihei
c5c4c87728 Restrict some Handler to current Looper only.
They currently fall back to the main Looper if the current thread
doesn't have a Looper. All the changed Handlers are guaranteed to
be created on a thread with a Looper (mostly the ExoPlayer playback
Looper) and thus can make this stricter assumption. This makes it
easier to reason about the code as there are no ambiguities as to which
thread the Handler is running on.

PiperOrigin-RevId: 317334503
2020-06-23 11:06:31 +01:00
tonihei
7d66865d20 Rollback of 63ae4cc54b
*** Original commit ***

Rollback of 6ae472243f

*** Original commit ***

PiperOrigin-RevId: 317331407
2020-06-23 11:06:22 +01:00
aquilescanta
a8bf7e217b Fix init data loading for non-reused extractors
PiperOrigin-RevId: 317322247
2020-06-23 11:06:13 +01:00
tonihei
457b215565 Use experimental release timeout in setForgroundMode(false).
The setForeground mode method blocks in the same way as release
and should use the same timeout if configured.

In case the method runs into the timeout, a player error is reported.

PiperOrigin-RevId: 317283808
2020-06-23 11:06:04 +01:00
olly
63ae4cc54b Rollback of 6ae472243f
*** Original commit ***

Rename Util methods to clarify which Looper is used.

The method name didn't clarify that either the main or current
Looper is used.

***

PiperOrigin-RevId: 317283606
2020-06-23 11:05:56 +01:00
tonihei
6ae472243f Rename Util methods to clarify which Looper is used.
The method name didn't clarify that either the main or current
Looper is used.

PiperOrigin-RevId: 317276561
2020-06-23 11:05:46 +01:00
olly
f8843441a2 Align flags between the core and extension FLAC extractors
- It seems conceptually simpler for DefaultExtractorsFactory
- It seems unlikely we'll need to diverge the two. In the case of
  workaround flags we can just have them be no-ops in the version
  that doesn't need them.

PiperOrigin-RevId: 317151955
2020-06-23 11:05:37 +01:00
olly
816a364a51 Clean up MimeTypes Javadoc
PiperOrigin-RevId: 317148010
2020-06-23 11:05:29 +01:00
ibaker
590aade74b De-duplicate Cue.Builder detailed javadoc
The details are available on the public fields, which are referenced with @see

PiperOrigin-RevId: 317092269
2020-06-23 11:05:20 +01:00
ibaker
685061431c Call onKeysRemoved (not onKeysRestored) when releasing offline keys
Looks like this change was introduced in
<unknown commit>

onKeysRemoved is currently not triggered in DefaultDrmSessionManager
as far as I can tell. It seems like it should be called from here.

PiperOrigin-RevId: 317072794
2020-06-23 11:05:11 +01:00
olly
88883ffd67 Generalize MimeTypes.isWebm to MimeTypes.isMatroska
It seems more natural given we always end up instantiating a Matroska extractor,
not one that's specific to the WebM subset of Matroska. There's also no reason
not to support Matroska MIME types in DASH.

PiperOrigin-RevId: 316975451
2020-06-23 11:04:56 +01:00
olly
ffa4ad0e77 Rollback of b6f5a263f7
*** Original commit ***

Rollforward of commit 5612ac50a332e425dc130c3c13a139b9e6fce9ec.

*** Reason for rollforward ***

Rollforward after making sure the handler is created
from the playback thread and not from an app thread.

*** Original change description ***

Rollback of e1beb1d194

*** Original commit ***

Expose experimental offload scheduling

Add a new scheduling mode that stops ExoPlayer main loop
when the audio offload buffer is full and resume it...

***

PiperOrigin-RevId: 316914147
2020-06-17 22:20:48 +01:00
aquilescanta
a5bc91f09b Remove unused previousExtractor from HlsExtractorFactory
PiperOrigin-RevId: 316902430
2020-06-17 22:20:31 +01:00
bachinger
733e71b4de Remove overloaded set method
PiperOrigin-RevId: 316900193
2020-06-17 22:20:16 +01:00
krocard
b6f5a263f7 Rollforward of commit 5612ac50a332e425dc130c3c13a139b9e6fce9ec.
*** Reason for rollforward ***

Rollforward after making sure the handler is created
from the playback thread and not from an app thread.

*** Original change description ***

Rollback of e1beb1d194

*** Original commit ***

Expose experimental offload scheduling

Add a new scheduling mode that stops ExoPlayer main loop
when the audio offload buffer is full and resume it when
it has been partially played.

This mode needs to be enabled and dissabled manually by the app
for now.

#exo-offload

***

***

PiperOrigin-RevId: 316898804
2020-06-17 22:19:59 +01:00
andrewlewis
2546be51fe Remove some ad playback state change requirements
Ads can appear due to asynchronous ad tag requests completing after
earlier ads in a pod have loaded, so remove the requirement that the
ad count can't change. The MediaPeriodQueue should handling discarding
buffered content if an ad appears before already buffered content, so
I think this case is actually handled correctly by the core player
already.

Also remove the requirement that an ad URI can't change. This is a
defensive measure for now, but it's likely that a later fix in the IMA
SDK for an issue where loadAd is not called after preloading then
seeking before a preloaded ad plays will result in loadAd being called
more than once, and I think it's possible that the second call to
loadAd may have a different URI. Because the ad URI should only change
after an intermediate seek to another MediaPeriod, there shouldn't be
any problems with buffered data not getting discarded.

Issue: #7477
PiperOrigin-RevId: 316871371
2020-06-17 14:32:48 +01:00
tonihei
99954b4ca0 Deflake DecoderVideoRendererTest
The test was trying to synchronize a background decoding thread by
waiting for pending decode calls. However, the background thread needs
to fully queue the newly available output buffer before we can stop
waiting to ensure it's actually fully predictable. So we change the
pending wait to wait until the input buffer is cleared, which only
happens after the decoder is definitely done with it.

Also properly clean-up decoder (including shutting down the background
thread).

PiperOrigin-RevId: 316870659
2020-06-17 14:32:32 +01:00
olly
f85098a88f Update deprecation JavaDoc for ExoPlayer DataSpec
constructor to note that the builder does NOT
infer the http method from the existence of the
post body.

PiperOrigin-RevId: 316765677
2020-06-17 14:31:59 +01:00
olly
c808db9935 Add MIME types for which every sample is known to be a sync sample.
- Leaving the TODO, since there are still MIME types we're unsure about.
- Removing AAC because xHE-AAC does not have this property. We may re-add
  it with an additional profile check to exclude xHE-AAC in the future.

PiperOrigin-RevId: 316715147
2020-06-17 14:31:43 +01:00
olly
e6b6a86a77 Remove support for MKV invisible flag
We haven't seen it used anywhere in practice. It's a niche feature not
supported by any other extractors, and is one of the very few things
stopping us from simplifying MediaSource implementations to not set the
decodeOnly sample flag. This is a simplification that we want to make,
since the current mechanism doesn't work properly for cases where a
downstream decoder adjusts the buffer presentation timestamps so that
they're different on the output side than on the input side.

PiperOrigin-RevId: 316712302
2020-06-17 14:31:27 +01:00
aquilescanta
2273b00a53 Create HlsMediaChunkExtractor
To be the abstraction to use for integrating with MediaParser.

PiperOrigin-RevId: 316710421
2020-06-17 14:31:10 +01:00
tonihei
aed8cad8c3 Remove unused waitingForKeys in renderers.
This flag isn't needed anymore because the waiting for keys happens on
the source side and the source just returns NOTHING_READ under the
same conditions.

PiperOrigin-RevId: 316704214
2020-06-17 14:30:54 +01:00
tonihei
cc97bcb469 Move runUntil method to TestUtil as it's used by multiple tests.
We started using this method from other tests unrelated to
TestExoPlayer, so the method is better placed inside a generic Util
class.

PiperOrigin-RevId: 316675067
2020-06-17 14:30:37 +01:00