6574 Commits

Author SHA1 Message Date
tonihei
2e749f70ae Don't support upstream discard from spliced-in chunks.
We can't restore the previous state of the remaining chunk, so we can't
support discarding from spliced-in chunks. Mark this explicitly instead
of attempting to discard from the previous chunk.

PiperOrigin-RevId: 318983628
2020-07-03 09:00:01 +01:00
ibaker
311d21bf8d Remove the multi-threading from DrmSessionManagerTest
I don't need to keep a separate playback looper, I can just use
ShadowLooper.idleMainLooper().

PiperOrigin-RevId: 318823190
2020-07-03 08:59:51 +01:00
Juanky Soriano
5c096acc29 Use default text size if captioning manager is disabled
This fixes an issue where, even if captioning manager is disabled, the latest used captioning manager preference
related to text size is being applied.

In order to replicate:
1. Go to Captioning Preferences under device Settings and enable it
2. Change the text size to "very large"
3. Observe the selected text size is used for subtitles, for example in Youtube
4. Go to Captioning Preferences under device Settings and disable it
5. Observe the text size used for subtitles does not come back to normal, stays on "very large"
2020-07-01 00:15:31 -05:00
olly
314bc65d62 Enable download parallelisation in demo app
- Deprecate constructors that don't take an executor, to direct
  developers toward the new ones. Callers can trivially pass
  Runnable::run to one of the new ones if they want old behaviour.
- Add comment explaining warning suppression added in the CL that
  added parallelised download support.

Issue: #5978
PiperOrigin-RevId: 318803296
2020-06-29 14:38:51 +01:00
kimvde
2eab6802c9 Parse stbl in FragmentedMp4Extractor
This will be necessary to support partially fragmented MP4s.

PiperOrigin-RevId: 318798726
2020-06-29 14:38:42 +01:00
kimvde
e9249c3a73 Add methods to get the current sample info in FragmentedMp4Extractor
This enhances readability, particularly as those methods will become
more complex when partially fragmented media will be supported.

PiperOrigin-RevId: 318795536
2020-06-29 13:33:26 +01:00
olly
159c77919a Bump release to 2.11.7
PiperOrigin-RevId: 318790917
2020-06-29 13:33:18 +01:00
krocard
78825a41dc Store encodings in Format instead of just pcm encodings
Previously only pcm encoding were stored in Format,
this was an issue as for audio passthrough and offload
lots of code needs to pass complex format informations
(encoding, sample rate, channel count, gapless metadata)
but could not use Format and each function was taking
each as different parameter.

By allowing Format to contain any encoding, and not only
pcmEncoding, it allows to pass a Format everywhere in ExoPlayer
code that needs a Format.

This patch does not have any functional change. It is only an internal refactor.

PiperOrigin-RevId: 318789444
2020-06-29 13:33:09 +01:00
tonihei
f770ff677f Fix method Javadoc.
PiperOrigin-RevId: 318786283
2020-06-29 13:33:01 +01:00
bachinger
6884dfb313 Move SimpleExoPlayer.Builder unit test to a separate class
PiperOrigin-RevId: 318785458
2020-06-29 13:32:53 +01:00
kimvde
8e09cf45c0 Fix bug unseekable FMP4
The seek start position was set to the first mdat but this box was
always skipped because the moof box was not read.

PiperOrigin-RevId: 318762126
2020-06-29 13:32:44 +01:00
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