9055 Commits

Author SHA1 Message Date
Chang Xiangzhong
8d8233c330 Convert rootDir to string to fix a gradle sync issue 2020-07-04 21:24:08 +02:00
ibaker
391f9b923e TTML: Fix writingDirection to be parsed from regions not styles
It applies only to regions:
https://www.w3.org/TR/2018/REC-ttml2-20181108/#style-attribute-writingMode

PiperOrigin-RevId: 319515547
2020-07-03 15:32:01 +01:00
ibaker
f39b1d0f90 Fix TTML ruby decoding to resolve styles by ID
The current code only works if the tts:ruby attributes are defined
directly on the in-line elements. This changes that so we also consider
tts:ruby attributes on `style` nodes referenced by ID.
PiperOrigin-RevId: 319515177
2020-07-03 15:31:51 +01:00
tonihei
08478d1163 Remove throws clause from Renderer.stop
We don't need the renderer immediately after stopping, so the
renderer should not throw a checked exception until it's used again.
This is inline with the not throwing from disable().

Also, none of the known implementation throw an exception at the moment
and all reasonable base classes omit the throws clause already.

PiperOrigin-RevId: 319503643
2020-07-03 15:31:41 +01:00
tonihei
113a2df775 Add some missing nullness assertions.
They are all for Context.getSystemService that is allowed to return
null. In most cases where we need to service, we make an assertion that
it is available.

PiperOrigin-RevId: 319503557
2020-07-03 15:31:30 +01:00
aquilescanta
968a0baa8d Fix handling of intents with no license server URI
PiperOrigin-RevId: 319497156
2020-07-03 15:31:20 +01:00
kimvde
ccb337f2e1 MP4: set TrackSampleTable to 0 when there are no samples
Because the stbl atom is mandatory, there is no reason for having a
special C.TIME_UNSET value instead of 0.

PiperOrigin-RevId: 319496999
2020-07-03 15:31:09 +01:00
insun
4fc45b92c0 Increase char limits for some string translations
And also replaced "Click" with "Tap" for CC button descriptions.

PiperOrigin-RevId: 319455553
2020-07-03 09:03:24 +01:00
ibaker
752fe1b679 Allow FakeMediaSource to specify the FakeSampleStream data
PiperOrigin-RevId: 319420451
2020-07-03 09:03:15 +01:00
christosts
8d131cad7b Fix flaky AsynchronousMediaCodecAdapterTest
The test was incorrectly assuming that with LooperMode.PAUSE,
HandlerThread instances needed explicit calls to execute
tasks. This commit fixes the test flakiness by manually pausing the
HandlerThead when needed.

PiperOrigin-RevId: 319411552
2020-07-03 09:03:07 +01:00
ibaker
31efd5387b Set MediaPeriodId in MergingMediaPeriodTest
PiperOrigin-RevId: 319399717
2020-07-03 09:02:58 +01:00
krocard
cf3fbdd19b Rename createDefaultLoadControl() to build()
The standard, least surprising name, for a builder's method
that builds the object is `build`.

PiperOrigin-RevId: 319379622
2020-07-03 09:02:49 +01:00
krocard
513b268558 Detect invalid frames early in passthrough/offload
Without checking if getFramesPerEncodedSample fails,
the frame count becomes negative which leads to
hard to debug errors.

PiperOrigin-RevId: 319247618
2020-07-03 09:02:41 +01:00
krocard
541568386b Merge onOutputCodecBypassFormatChanged and onOutputFormatChanged
PiperOrigin-RevId: 319230328
2020-07-03 09:02:32 +01:00
krocard
69187523b1 Renaming to make pasthrough modes more explicit
Passthrough mode can use a codec or not, but
the code only mentioned "passthrough" in most cases,
making the specific mode confusing.

For example both `MediaCodecRenderer` and
it's derived class `MediaCodecAudioRenderer`
had a private `passthroughEnabled` field,
but they were used for the opposite modes!

This change renames all relevant variables/functions
to explicit `CodecPassthrough` or `Bypass`.

PiperOrigin-RevId: 319225235
2020-07-03 09:02:24 +01:00
Oliver Woodman
ab348c045c Merge pull request #7568 from juankysoriano:subtitles-font-size-bug
PiperOrigin-RevId: 319223173
2020-07-03 09:02:13 +01:00
samrobinson
729ec8a1c6 Separate DefaultAudioSink state flush into helper method.
PiperOrigin-RevId: 319222833
2020-07-03 09:02:03 +01:00
krocard
48f2b44936 Use a passthrough codec if there is an exoMediaCryptoType
Even without a drmInitData, a format can still has
a DRM.

PiperOrigin-RevId: 319217188
2020-07-03 09:01:55 +01:00
olly
8bd01a7bec Discard samples on the write-side of SampleQueue
PiperOrigin-RevId: 319205008
2020-07-03 09:01:46 +01:00
tonihei
f8217140d7 Add missing null check.
The system services may return a null value if the service is
not available. Guard against this by falling back to default values.

PiperOrigin-RevId: 319187882
2020-07-03 09:01:37 +01:00
ibaker
316f8a88cd Keep DRM sessions alive for a while before fully releasing them
Issue: #7011
Issue: #6725
Issue: #7066

This also mitigates (but doesn't fix) Issue: #4133 because it
prevents a second key load after a short clear section.

PiperOrigin-RevId: 319184325
2020-07-03 09:01:29 +01:00
tonihei
e4e743a35f Fix remaining common module nullness issues.
PiperOrigin-RevId: 319183621
2020-07-03 09:01:20 +01:00
krocard
7d46be5564 Do not use no codec passthrough with a sourceDrmSession
PiperOrigin-RevId: 319183486
2020-07-03 09:01:12 +01:00
insun
22802506cd Minor changes regarding animation_enabled in StyledPlayerControlView.
- Removed unnecessary private method
- Revised document for animation_enabled attribute
- Added setAnimationEnabled/isAnimationEnabled in StyledPlayerControlView

PiperOrigin-RevId: 319054648
2020-07-03 09:01:03 +01:00
tonihei
a3977b94be Fix import of settings file for relative ExoPlayer paths.
Including ExoPlayer via relative paths currently breaks the import
logic of the common library settings file because it's referenced
from different directories. Fix this by resolving the setting path
to its canonical name.

Issue: #7554
PiperOrigin-RevId: 319043560
2020-07-03 09:00:54 +01:00
tonihei
0be98e2b79 Add stubs for CryptoInfo fields.
See https://developer.android.com/reference/android/media/MediaCodec.CryptoInfo#numBytesOfClearData. Both values are allowed to be null.

PiperOrigin-RevId: 319038124
2020-07-03 09:00:45 +01:00
olly
0a2bacb7b7 MediaCodecRenderer: Remove unused code path
SampleStreams should always provide samples starting from a keyframe.
We do not have equivalent logic in any of our extension decoder renderers.

PiperOrigin-RevId: 319012365
2020-07-03 09:00:37 +01:00
olly
5be6eaa88c Make GL demo easier to understand
PiperOrigin-RevId: 319007693
2020-07-03 09:00:28 +01:00
bachinger
20820800f3 Prevent parallel timeline access in MaskingMediaSource
The list of MediaSourceHolder in ExoPlayerImpl is only maintained to be able to create a PlaylistTimeline for masking. By keeping only the id and a snapshot of the timeline of the MediaSourceHolder in ExoPlayerImpl, parallel access is prevented and we still have sufficient information to create the masking timeline.

PiperOrigin-RevId: 319003837
2020-07-03 09:00:19 +01:00
insun
a3bbcf3395 Add StyledPlayerView and StyledPlayerControlView into ui/
Moved ui2/ code and resources into ui/

PiperOrigin-RevId: 318984707
2020-07-03 09:00:10 +01:00
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
andrewlewis
eb9de7a120 Fix postroll content complete notifications
On reaching the end of the content we would notify content complete
and skip unplayed ads, causing a timeline change. That timeline change
was handled in a way that caused a further timeline change in the
2.11.6 release, where we don't yet deduplicate no-op Timeline changes,
causing repeated timeline changes indefinitely.

At tip-of-tree, the timeline wouldn't refresh repeatedly. However the
code for sending content complete at the point of transitioning to
play a preloaded postroll ad was not correct in that it didn't mark
previous ads as skipped. Instead they happened to be marked as
skipped later on due to the timeline change handling content
completion code triggering again.

Fix this by only marking ads as skipped when content completes once,
to avoid the duplicate timeline change, and moving the skipped ad
marking so it happens in the same place as notifying content complete.

PiperOrigin-RevId: 318454908
2020-06-26 13:46:53 +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