2927 Commits

Author SHA1 Message Date
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
Pierre-Hugues Husson
1d65afdd16 Add minimal support of DVB AIT
This is used by broadcast channels to provide interactive contents.
2020-01-28 16:07:02 +01: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
ibaker
3aa52c2317 Add vertical text support to TtmlDecoder
I needed to use Cue.Builder instead of just SpannableStringBuilder for
the regionOutput values, so I could attach the vertical info where
appropriate (since this is a property of the Cue, not a span).

PiperOrigin-RevId: 290709294
2020-01-24 11:09:12 +00:00
ibaker
37908dd4df Remove TTML package from null-checking blacklist
PiperOrigin-RevId: 290629644
2020-01-24 11:09:04 +00:00
tonihei
8a2a527129 Ensure timeline and position are updated even if an error occurs
If an exception is thrown between updating the timeline and updating
the position in playbackInfo, the state may be inconsistent.
Exceptions are expected to be thrown while updating the player state
and we should handle such cases in a consistent way.

Similar to how we handle the same situation in seekToInternal,
the state is updated in a final block such that it gets updated to the
latest state even if an error occurs. Moving both the timeline and
position update together also ensures they always stay consistent.

PiperOrigin-RevId: 290624020
2020-01-24 11:08:55 +00:00
tonihei
21c76b012c No-op restructure of playlist update handling.
This restructure moves all the position resolving code to a static method and
removes the dependency of the MediaPeriodQueue on having an up-to-date timeline.

Both steps allow simplified reasoning about the code as the static method can't change
the state of the player, and there is no risk the queue can use the wrong timeline.

These propoerties allow to fix a bug causing inconsistent states in a follow-up step.

PiperOrigin-RevId: 290616395
2020-01-24 11:08:47 +00:00
ibaker
04d325331b Add default to switch in TtmlDecoder
Also de-dupe a couple of case statements

PiperOrigin-RevId: 290610993
2020-01-24 11:08:30 +00:00
ibaker
9cfc75ff8a Fix warning about adjacent overload methods in TtmlStyle
PiperOrigin-RevId: 290610936
2020-01-24 11:08:21 +00:00
ibaker
f7470c5126 Remove CEA package from null-checking blacklist
PiperOrigin-RevId: 290610312
2020-01-24 11:08:13 +00:00
ibaker
de3f04b721 Delete TtmlStyle#inheritableStyle
It's never assigned or accessed from outside the class.

It was added in
<unknown commit>
then the accessor was removed in
<unknown commit>

PiperOrigin-RevId: 290601998
2020-01-24 11:08:04 +00:00
andrewlewis
ea69a3dbb6 Move MpegAudioHeader to MpegUtil
This makes MPEG audio utilities similar to utilities we have for WAV,
AC-3 etc., and moves them out of the extractor package so that an
extractor module can be split out without needing to have a class in the
extractor package in the common library.

PiperOrigin-RevId: 290595089
2020-01-24 11:07:40 +00:00
tonihei
5e2b4117bd Add ID3 genres added in Wimamp 5.6 (2010).
All these genres are currently causing a warning and are not added to the Metadata.Entry.

PiperOrigin-RevId: 290594810
2020-01-24 11:07:32 +00:00
tonihei
747ae64196 Rollback of 72437e4442
*** Original commit ***

Rollback of ff89170b00

*** Original commit ***

Fix some logic in AnalyticsCollector.

All events issued from ExoPlayerImpl (i.e. Player.EventListener events) currently
try to use the media period data from the playing media period as set in the
playback thread queue. This is only correct as long as there no pending masking
operations in ExoPlayerImpl. That's why we currently disable this whenever the timeline
is...

***

PiperOrigin-RevId: 290593700
2020-01-24 11:07:23 +00:00
bachinger
72437e4442 Rollback of ff89170b00
*** Original commit ***

Fix some logic in AnalyticsCollector.

All events issued from ExoPlayerImpl (i.e. Player.EventListener events) currently
try to use the media period data from the playing media period as set in the
playback thread queue. This is only correct as long as there no pending masking
operations in ExoPlayerImpl. That's why we currently disable this whenever the timeline
is empty or a seek is pending. Since adding all the playlist API methods to the player,
this is no longer the right choice. Moreover,...

***

PiperOrigin-RevId: 290312118
2020-01-24 11:07:05 +00:00
tonihei
4cf614c639 Ensure tracks in PlaybackInfo are always in sync with position.
Currently both are updated by separate setters. If an exception is thrown between
the two setters, the state may not be consistent.

Avoid this problem by always setting them together.

PiperOrigin-RevId: 290293600
2020-01-24 11:06:56 +00:00
tonihei
ff89170b00 Fix some logic in AnalyticsCollector.
All events issued from ExoPlayerImpl (i.e. Player.EventListener events) currently
try to use the media period data from the playing media period as set in the
playback thread queue. This is only correct as long as there no pending masking
operations in ExoPlayerImpl. That's why we currently disable this whenever the timeline
is empty or a seek is pending. Since adding all the playlist API methods to the player,
this is no longer the right choice. Moreover, we don't have a definite API that tells
AnalyticsCollector when a playlist API call has been handled (and we don't want to
have one).

We can fix this by always using the current Player position information as the source
of truth (instead of the media period queue). This is definitely more correct and also
works while a masking operation is pending. To fill in the additional information from
the media period queue, we can look up a matching media period. This may not be the
first one in the list if an operation is pending.

The new methods are similar to the previous tryResolveWindowIndex method, but:
 1. They are always used (i.e. the current Player state is the main source of truth)
 2. They also check the correct ad playback state, that was just ignored previously.

PiperOrigin-RevId: 290284916
2020-01-24 11:06:47 +00:00
tonihei
460449ce1e Make seek in FakeMediaPeriod more realistic.
Currently seeks are basically ignored. However, it's more realistic to re-queue the
single sample if the seek is to position 0.

PiperOrigin-RevId: 290273564
2020-01-17 16:57:51 +00:00
tonihei
3e41c0a1d2 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 into DefaultLoadControl to keep the workaround, and also apply the
maximum buffer size check in bytes if enabled. ExoPlayerImplInternal will now
throw if a...

***

PiperOrigin-RevId: 290273295
2020-01-17 16:57:43 +00:00
olly
a7f7d8fb03 Tidy up DownloadService restart. Final change for #6798.
- Add additional Listener methods to DownloadManager, to inform of
  changes to whether the downloads are paused or waiting for requirements.

- Only schedule the Scheduler if we really are waiting for requirements.

- Only restart the service if we're no longer waiting for requirements,
  and if there are queued downloads that will now be restarted.
  Previously the service would be restarted whenever the requirements
  were met, regardless of whether there was any work to do.

- Restart service if it might be stopping, as well as if it's already
  stopped. Also restart service if there's a download state change to a
  state for which the service should be started, if.

Issue: #6798
PiperOrigin-RevId: 290270547
2020-01-17 16:12:49 +00:00
bachinger
c5e1169666 make media source factories reusable
First cl towards DefaultMediaSourceFactory (<unknown commit>) does not change the MediaSourceFactory interface except adding @Nullable anotations to setters.

PiperOrigin-RevId: 290269640
2020-01-17 16:12:41 +00:00
olly
118d690666 2.11.2 release notes and version bump
PiperOrigin-RevId: 290269098
2020-01-17 16:12:27 +00:00
krocard
598538253a Do not hold a codec in OnFrameRenderedListener
Doing so prevent Codec which is a big object with
JNI to be garbage collected.

As the codec can not be hold in the listener, there
is no way to call release, as it must be called on
the same codec.
As a result the release method is also removed.
The downside is that at runtime some callbacks may be
dropped but it should be a short transitive state.

This also simplifies lifecycle of the listener as
the client does not have to know if release needs
to be called or not.

An alternative would have been to hold a weak ref,
but I deemed it too complicated for the
runtime gain.

PiperOrigin-RevId: 290231659
2020-01-17 14:54:48 +00:00
olly
2859a34027 HLS: Fix slow seeking into long MP3 segments
Issue: #6155
PiperOrigin-RevId: 290117324
2020-01-16 20:35:39 +00:00
kimvde
db75012503 FlacExtractor: handle case where last frame < MAX_FRAME_HEADER_SIZE
PiperOrigin-RevId: 290079840
2020-01-16 20:35:30 +00:00