2799 Commits

Author SHA1 Message Date
bachinger
4bb6036cf6 add playback state changed listener
This change deprecates Player.onPlayerStateChanged(boolean pwr, int state). It removes deprecation for trivial cases. I'll remove other deprecated usages (mostly in ui module) in follow-up CLs to not bloat this CL.

PiperOrigin-RevId: 292917872
2020-02-11 17:07:03 +00:00
kimvde
ed88f4f1dd Add possibility to update ExtractorOutput duration
PiperOrigin-RevId: 292912511
2020-02-11 17:06:48 +00:00
olly
de3877237b Add some missing nullness annotations
PiperOrigin-RevId: 292910310
2020-02-11 17:06:40 +00:00
olly
6d550ef2d6 Don't re-init codec if DRM session is unchanged
This condition is trying to detect when it might be necessary
to switch from a non-secure to a secure codec. This is not
possible if the DRM session is unchanged, unless a different
codec is required for some other reason (e.g., H264 -> H265),
which is anyway handled by canKeepCodec below.

PiperOrigin-RevId: 292909126
2020-02-03 14:45:30 +00:00
olly
cda6cba5a5 More nullness fixes in testutil
PiperOrigin-RevId: 292907271
2020-02-03 14:45:22 +00:00
ibaker
ad115a5ab3 Fix some boolean logic in TtmlStyle#inherit
I got confused copying the hasBackgroundColor logic in
3aa52c2317

Add tests to confirm I got it right this time

PiperOrigin-RevId: 292898421
2020-02-03 14:45:13 +00:00
kimvde
49fa6d63f9 Remove redundant prepared flag in ProgressiveMediaPeriod
PiperOrigin-RevId: 292892407
2020-02-03 14:45:04 +00:00
olly
97fbbad6a7 Avoid unnecessary decoder instantiations on key rotation
Issue: #6903
PiperOrigin-RevId: 292884280
2020-02-03 11:21:54 +00:00
olly
c095a9ff98 Make SingleSampleMediaSource.Factory reusable
PiperOrigin-RevId: 292879934
2020-02-03 11:21:30 +00:00
ibaker
b6bd57ab12 Replace most usages of @TargetApi with @RequiresApi
We keep @TargetApi where the method is a safe no-op on
older versions due to an in-line version check.

PiperOrigin-RevId: 292878727
2020-02-03 11:21:21 +00:00
olly
d287e13d9e Add Format.createSampleFormat for common use case
PiperOrigin-RevId: 292562678
2020-01-31 17:52:51 +00:00
olly
660cfd2863 Lock down SampleQueue to reasonable extension points
PiperOrigin-RevId: 292542298
2020-01-31 17:52:34 +00:00
olly
2a718c5aa6 Rollback of 3e41c0a1d2
*** Original commit ***

Rollback of 3c56b113e4

*** Original commit ***

Rollback of d48dc4c159

*** Original commit ***

Move getting-stuck-prevention into DefaultLoadControl.

We recently added code that prevents getting stuck if the buffer is low and
the LoadControl refuses to continue loading (b84bde0252).

Move this logic...

***

PiperOrigin-RevId: 292457964
2020-01-31 17:52:18 +00:00
samrobinson
52fb5f38a7 Adjust FakeSampleStream to take varargs of FakeSampleStreamItem.
This is instead of taking a list.

PiperOrigin-RevId: 292354720
2020-01-30 19:31:31 +00:00
samrobinson
3e6efe7eaf Fix outputFormat not being assigned after position is reset.
PiperOrigin-RevId: 292350437
2020-01-30 19:31:23 +00:00
olly
7c8a54c6d0 Start fixing nullness in testutil
PiperOrigin-RevId: 292340530
2020-01-30 19:31:06 +00:00
olly
d75aa97c0c SampleQueue: Let subclasses easily invalidate format adjustment
This is a nice-regardless improvement to SampleQueue, which will
likely to used to fix the referenced issue. It makes it possible
for SampleQueue subclasses to support dynamic changes to format
adjustment in a non-hacky way.

Issue: #6903
PiperOrigin-RevId: 292314720
2020-01-30 19:30:38 +00:00
bachinger
21fe13d3d7 add playWhenReady changed callback with reasons
PiperOrigin-RevId: 292194805
2020-01-30 19:30:29 +00:00
ibaker
6424403907 Add tate-chu-yoko support to TtmlDecoder
PiperOrigin-RevId: 292161845
2020-01-30 19:30:21 +00:00
aquilescanta
6377e277c7 Move DrmSession into the core module
PiperOrigin-RevId: 292112214
2020-01-30 19:30:12 +00:00
olly
016042defa Fix incorrect parameter name comment
PiperOrigin-RevId: 292099759
2020-01-30 19:29:55 +00:00
tonihei
b83534ee03 Simplify startMediaTimeUs states.
We currently have 3 states, but the NOT_SET state isn't needed
anymore. We can therefore replace the IntDef by a simple boolean.

PiperOrigin-RevId: 291926049
2020-01-28 16:56:43 +00:00
tonihei
739fd5f5bb Include startMediaTime in media position checkpoints.
We currently apply new parameter checkpoints from an absolute media
time and then substract the current media start time again to retrieve
the media time offset for this playback parameter checkpoint.

However, the media start time may change when unexpected discontinuities
happen (the start time doesn't actually change, but we change it to
correct for this discontinuity). This then invalidates the absolute
media time in the playback parameter checkpoints (which should have been
corrected as well).

Avoid this problem by also only applying the new start position
from the checkpoint. We don't have to save the start position anymore
because it will cancel itself out.

Also add some documentation and code clarification for improved
readability.

PiperOrigin-RevId: 291923069
2020-01-28 16:56:35 +00:00
olly
00fe2eb4a6 Tweak isPlaceholder documentation
PiperOrigin-RevId: 291905440
2020-01-28 16:56:26 +00:00
olly
331edb4fb2 Expand dangal workaround to all API levels
It doesn't seem worth keeping the cap, since the device
will presumably stop receiving major version updates at
some point anyway.

Issue: #6899
PiperOrigin-RevId: 291899439
2020-01-28 16:56:08 +00:00
aquilescanta
bb9b3fd45e Fix some typos
PiperOrigin-RevId: 291750515
2020-01-28 16:55:41 +00:00
tonihei
4dddad831a Keep requested content position even for content periods.
We currently only keep the requested next content start position while
we are playing ads. However, we should also keep at least before a content
period is fully prepared to not loose the information about the user intent.

PiperOrigin-RevId: 291705752
2020-01-27 18:22:23 +00:00
tonihei
c0a3feee00 Add window.isPlaceHolder flag
There are existing bugs that need this flag to know whether the
current information in the window is still a placeholder or can
already be relied on for further calculation.

This flag will probably only ever be set in DummyTimeline, so it's
not added to the window.set method to avoid updating all clients.

Issue:#5924
PiperOrigin-RevId: 291705637
2020-01-27 18:22:15 +00:00
olly
3fc61de7f7 give SimpleDecoder's thread a name.
PiperOrigin-RevId: 291401328
2020-01-27 11:05:12 +00:00
andrewlewis
7b05f3384d Remove duplicate package-info.javas
PiperOrigin-RevId: 291394101
2020-01-24 18:15:27 +00:00
andrewlewis
91517dc957 Split out extractor and common modules
PiperOrigin-RevId: 291378636
2020-01-24 18:15:19 +00:00
andrewlewis
7b63afb212 Move FlacSteamMetadata to extractor package
It could either live in .util or .extractor, but since it's not needed
outside the extractor package in core (and the FLAC extension), and
FlacStreamMetadataTest uses a FLAC asset, it seems preferable to move it
into the extractor package.

PiperOrigin-RevId: 291372032
2020-01-24 18:15:11 +00:00
andrewlewis
01bc853993 Move CeaUtil to extractors package
CeaUtil depends on TrackOutput so should live in the extractors package.

To avoid having Cea708Decoder depend on extractors, this change also
moves the initialization data building/parsing to CodecSpecificDataUtil.

PiperOrigin-RevId: 291348317
2020-01-24 18:15:02 +00:00
kimvde
e8da2f9d43 FlacMetadataReaderTest: replace @Test(expected =) by assertThrows
Using @Test(expected=...) is discouraged, since the test will pass if
any statement in the test method throws the expected exception.

PiperOrigin-RevId: 291338224
2020-01-24 11:11:47 +00:00
olly
9cd49120a0 Marks ConditionVariable as non-final so it can be mocked.
PiperOrigin-RevId: 291207668
2020-01-24 11:11:39 +00:00
kimvde
15a43e5c78 Improve tests of binary search utility methods
Improve unit tests of binary search methods by making them more
behavior-driven.

PiperOrigin-RevId: 291175304
2020-01-24 11:11:30 +00:00
tonihei
454d4add4a Remove unused code path
The deleted path was only used if resetPosition=false and clearPlaylist=true,
which is never the case.

PiperOrigin-RevId: 291154550
2020-01-24 11:11:22 +00:00
tonihei
23f316d67e Always keep front period uid in MediaPeriodQueue.
Since we have the Playlist layer on top, it's always guaranteed that a
new playlist item has a new uid. So we can just keep the old one in all
cases and don't have to be careful to delete it. The deletion was necessary
previously in case multiple MediaSources use the same uids.

PiperOrigin-RevId: 291152349
2020-01-24 11:11:13 +00:00
andrewlewis
0f63c501a8 Tidy CEA utils
Move Cea708InitializationData functionality into CeaUtil and delete the
class.

Move CeaUtil to the util package as it needs to be used both in
extraction and decoding.

PiperOrigin-RevId: 291128220
2020-01-24 11:11:05 +00:00
andrewlewis
6b03d4bc40 Make resolveSeekPositionUs an instance method
PiperOrigin-RevId: 291125686
2020-01-24 11:10:56 +00:00
andrewlewis
a0f6bc877b Move getRendererCapabilities to DownloadHelper
PiperOrigin-RevId: 290934472
2020-01-24 11:10:47 +00:00
andrewlewis
c8f0814bd0 Remove references to core player classes from C
Move player messages and scaling modes to Renderer.

Remove @links to ExoPlayer AudioAttributes and renderers.

PiperOrigin-RevId: 290932785
2020-01-24 11:10:39 +00:00
christosts
78fe1afa85 Fix flaky unit tests
PiperOrigin-RevId: 290910992
2020-01-24 11:10:30 +00:00
tonihei
e7cdd16407 Remove PlaybackInfo.startPositionUs
The only remaining use is to provide the initial position for the first media
period in the queue. At this point, the value is always equivalent to
PlaybackInfo.positionUs because they are set together to the same value in
PlaybackInfo.copyWithNewPosition.

PiperOrigin-RevId: 290749294
2020-01-24 11:10:12 +00:00
tonihei
2564a121dc Remove pointless use of playbackInfo.startPositionUs
We have a flag that gets turned on if the current playback position has been
reset, so that messages from this reset position can be triggered. This
mechanism isn't actually depending on the startPositionUs field because it
should always be triggered in the first iteration with the new position.

PiperOrigin-RevId: 290749201
2020-01-24 11:10:04 +00:00
tonihei
5f9a585075 Fix a bunch of position problems.
There are a couple of problems with how positions in PlaybackInfo are set at
the moment:
1. PositionUs isn't allowed to be C.TIME_UNSET. This is prevented by always
resolving to the current default position if needed.
2. In some places a window position was used as a period position. Use correct
position resolution procedure.
3. When creating a placeholder position to restart playback, we used the first
period in a window, not the one where the default position is.
4. The start position for ads was in some cases set to 0 without checking
the ad resume position.

PiperOrigin-RevId: 290749042
2020-01-24 11:09:56 +00:00
christosts
665092e4be MediaCodecAdapter supports queueing input buffers
Add queueInputBuffer() and queueSecureInputBuffer() in
MediaCodecAdapter.

PiperOrigin-RevId: 290720307
2020-01-24 11:09:47 +00:00
samrobinson
cf3939838b Adjust FakeSampleStream#readData logic.
Once EOS has been read, that will be returned every time readData is called.
EOS needs to be an item in the items.

PiperOrigin-RevId: 290715513
2020-01-24 11:09:38 +00:00
ibaker
6923316cfa Migrate TtmlDecoderTest to use SpannedSubject
PiperOrigin-RevId: 290712014
2020-01-24 11:09:29 +00:00
ibaker
4da0d0a4b5 In-line calls to SpannableStringBuilder.length() in TtmlNode
This avoids keeping a redundant (and potentially out of sync) copy of
the same info in builderLength.

PiperOrigin-RevId: 290709360
2020-01-24 11:09:21 +00:00