637 Commits

Author SHA1 Message Date
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
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
ibaker
6424403907 Add tate-chu-yoko support to TtmlDecoder
PiperOrigin-RevId: 292161845
2020-01-30 19:30:21 +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
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
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
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
andrewlewis
a0f6bc877b Move getRendererCapabilities to DownloadHelper
PiperOrigin-RevId: 290934472
2020-01-24 11:10:47 +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
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
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
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
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
krocard
a99ab62241 Tunneling timestamp use Message instead of Runnable
This avoids allocating a Runnable.

PiperOrigin-RevId: 290079660
2020-01-16 20:35:22 +00:00
olly
775a17c498 Split SampleQueue.advanceTo for advance & seek use cases
This method has two use cases:

1. Seeking. Calls are immediately preceded by a call to rewind(), and
   the returned value isn't important unless it's ADVANCED_FAILED (i.e.
   the caller is only interested in success and failure).
2. Advancing. The return value is important unless it's ADVANCED_FAILED,
   in which case the caller wants to treat it as 0.

This change creates separate methods for each use case. The new seekTo
methods automatically rewind and return a boolean. The updated advanceTo
method returns 0 directly in cases where ADVANCED_FAILED was returned.
Arguments that were always hard-coded to true by callers have also been
removed.

This change is a step toward one possible solution for #6155. How we'll
solve that issue is still up for discussion, but this change seems like
one we should make regardless!

Issue: #6155
PiperOrigin-RevId: 290053743
2020-01-16 20:35:04 +00:00
tonihei
2e7978a0e2 Reorder renderer changes at period transitions
Currently the following sequence of events happens at automatic period transitions:
1. Update queue (=release old playing period)
2. Disable unused renderers
3. Enable newly needed renderers

This order requires difficult to follow workarounds in AnalyticsCollector for all
events related to step 2 (disable renderers). The current media period has already
been advanced so can't be used. The current workaround saves the last known playing
media period that was published as part of a PlaybackInfo update in ExoPlayerImpl.
This works in most cases, but is inherently wrong because the published state in
ExoPlayerImpl may be completely unrelated to the updates happening on the playback
thread (e.g. if many other operations are pending).

Simplify and fix this problem by changing the order of the events above:
1. Disable unused renderers.
2. Update queue
3. Enable newly needed renderers.
This way the current playing media period can be used for both renderer disable
and renderer enable events, thus it's correct in all cases and the workaround
in AnalyticsCollector can be removed.

PiperOrigin-RevId: 290037225
2020-01-16 13:52:26 +00:00
Oliver Woodman
17d1343375 Merge pull request #6678 from phhusson:feature/enable-multi-metadata-tracks
PiperOrigin-RevId: 290032841
2020-01-16 13:52:08 +00:00
olly
090aed3aca Add non-null by default to source.chunk
PiperOrigin-RevId: 289859343
2020-01-16 13:51:50 +00:00
samrobinson
96c648c2d6 Improve customisability of FakeSampleStream.
PiperOrigin-RevId: 289829592
2020-01-16 13:51:18 +00:00
andrewlewis
4c74f3cffd Make tests independent
PiperOrigin-RevId: 289521837
2020-01-16 13:50:44 +00:00
tonihei
c0ee312a30 Simplify keeping track of current id in DefaultPlaybackSessionManager
We currently have a currentMediaPeriodId and an activeSessionId that are more
or less tracking the same thing unless the current media period isn't "active" yet.

Simplify this logic by using a single currentSessionId field and the respective
isActive flag of this session. Also move all session creation and activation code in
the same method to make it easier to reason about the code.

This change also fixes a subtle bug where events after a seek to a new window
are not ignored as they should.

PiperOrigin-RevId: 289432181
2020-01-13 19:58:00 +00:00
Oliver Woodman
3e08e42168 Merge pull request #6797 from DolbyLaboratories:dev-v2-ac4-drm
PiperOrigin-RevId: 289092332
2020-01-10 15:57:40 +00:00
ibaker
2c02f787bd Remove unused styles from TTML test data
PiperOrigin-RevId: 288862795
2020-01-10 15:56:13 +00:00
olly
1a9b301f52 Fix extension FLAC decoder to correctly handle non-16-bit depths
PiperOrigin-RevId: 288860159
2020-01-10 15:55:49 +00:00
ybai001
74e01f4e97 Add protected AC-4 fmp4 test case 2020-01-10 14:19:30 +08:00
Oliver Woodman
4f15cfaa78 Merge pull request #6836 from DolbyLaboratories:dev-v2-refineAC4
PiperOrigin-RevId: 288772277
2020-01-08 22:15:53 +00:00
ibaker
14e401f53a Update TtmlDecoder to keep only one Span of each type
The current code relies on Android's evaluation order of spans, which
doesn't seem to be defined anywhere.

PiperOrigin-RevId: 288700011
2020-01-08 22:15:10 +00:00
ibaker
8e26505ee8 Fix what I think is a typo in WebVTT test data
Without the CSS tweak the additional test assertion fails.

PiperOrigin-RevId: 288698323
2020-01-08 22:15:02 +00:00
ibaker
448db89446 Add TypefaceSpan and hasNoFooSpanBetween() support to SpannedSubject
Use these to migrate the last WebvttDecoderTest method to SpannedSubject

PiperOrigin-RevId: 288688620
2020-01-08 15:58:20 +00:00
olly
63f90adef0 Add package level NonNull to extractor.ts
Also remove most classes from the nullness blacklist

PiperOrigin-RevId: 288494712
2020-01-08 15:57:56 +00:00
christosts
fb42f818ec Add start() method in MediaCodecAdapter
PiperOrigin-RevId: 288476415
2020-01-08 15:57:48 +00:00
ibaker
181606137d Remove assertCues() helper methods from WebvttDecoderTest
These make the interesting bits of each assertion harder to follow imo.

Also remove all the assertWithMessage() calls at the same time, Olly
convinced me these are rarely useful since you can click from the stack
trace to the failing line in the IDE.

PiperOrigin-RevId: 288470704
2020-01-08 15:57:31 +00:00
ibaker
09ca5c0783 Remove assertWithMessage() calls from SsaDecoderTest
As discussed with Olly, these don't add much info and are liable
to go stale.

PiperOrigin-RevId: 288463027
2020-01-08 15:57:06 +00:00
ibaker
a98fc7ca48 Add tate-chu-yoko support to WebVTT decoding
PiperOrigin-RevId: 288285953
2020-01-06 14:56:20 +00:00
kimvde
06fcf29edd Simulate IO exceptions in all FlacExtractor tests
- Simulate IO exceptions in the test using FlacBinarySearchSeeker for
  seeking in FlacExtractorTests. This makes the test slower but covers
  more test cases.

PiperOrigin-RevId: 288285057
2020-01-06 14:56:11 +00:00
ibaker
6f312c054e Add <ruby> tag support to WebvttCueParser
There's currently no rendering support for ruby text in SubtitleView
or SubtitlePainter, but this does have a visible impact with the
current implementation by stripping the ruby text from Cue.text
meaning it doesn't show up at all under the 'naive' rendering.
This is an improvement over the current behaviour of including
the ruby text in-line with the base text (no rubies is better than
wrongly rendered rubies).

PiperOrigin-RevId: 288280416
2020-01-06 14:55:54 +00:00