560 Commits

Author SHA1 Message Date
kimvde
ecc04b2b6f ExtractorAsserts: always test against .unklen.dump files
This allows the file to be created automatically when
FakeExtractorOutput#WRITE_DUMP is true.

PiperOrigin-RevId: 293834547
2020-02-11 17:10:33 +00:00
kimvde
04af8e60ba Add the possibility to specify the dump files path in ExtractorAsserts
PiperOrigin-RevId: 293554489
2020-02-11 17:09:16 +00:00
tonihei
486f401736 Pass in initial sample timestamp to FakeSampleStream.
This allows to simulate samples in a stream more accurately
particularly when streams are prepared at a non-zero position and
issuing a sample with position=0 is not expected.

Also makes seek more realistic by also issuing one sample again.

PiperOrigin-RevId: 293344081
2020-02-11 17:08:15 +00:00
tonihei
c9245c61de Fix order of timeline and prepare callback in MaskingMediaSoure
Once we receive an update from a masked source, we first start the
preparation of an already pending period, and only then notify the
player of the new timeline. If the period prepares immediately inline,
the MediaPeriod.onPrepared callback arrives before the
onPlaylistUpdateRequested call in the Player. THis is the wrong order
and causes issues when the player tries to lookup information in the
timeline that doesn't exist yet.

This change fixes preroll playbacks before live streams.

PiperOrigin-RevId: 293340031
2020-02-11 17:08:07 +00:00
kimvde
a9507a0064 Make FakeExtractorOutput dump additional seek points
PiperOrigin-RevId: 293337032
2020-02-11 17:08:00 +00:00
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
olly
cda6cba5a5 More nullness fixes in testutil
PiperOrigin-RevId: 292907271
2020-02-03 14:45:22 +00:00
ibaker
dd10d96a3f Tweak SpannedSubject error message when actual has no spans
Before:
No matching span found
in text  : Text with combined section.
expected : start=10	end=18	type=HorizontalTextInVerticalContextSpan	substring='combined'
but found:

After:
No matching span found
in text : Text with combined section.
expected: start=10	end=18	type=HorizontalTextInVerticalContextSpan	substring='combined'
but found no spans
PiperOrigin-RevId: 292878264
2020-02-03 11:21:13 +00:00
olly
3774530831 Fix annotation position
PiperOrigin-RevId: 292519511
2020-01-31 17:52:26 +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
olly
7c8a54c6d0 Start fixing nullness in testutil
PiperOrigin-RevId: 292340530
2020-01-30 19:31:06 +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
6b03d4bc40 Make resolveSeekPositionUs an instance method
PiperOrigin-RevId: 291125686
2020-01-24 11:10:56 +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
samrobinson
df41ae3f42 Add FakeSampleStreamItem to an existing FakeSampleStream.
Allows items to be added to the queue once the sample stream has already been created.
Means tests can simulate data not all being available at the start.

PiperOrigin-RevId: 290613392
2020-01-24 11:08:38 +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
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
samrobinson
96c648c2d6 Improve customisability of FakeSampleStream.
PiperOrigin-RevId: 289829592
2020-01-16 13:51:18 +00:00
olly
3feb263cfe Fix nullability issues for testutil.truth
PiperOrigin-RevId: 289658098
2020-01-16 13:50:53 +00:00
andrewlewis
4c74f3cffd Make tests independent
PiperOrigin-RevId: 289521837
2020-01-16 13:50:44 +00:00
ibaker
b562e8687b Add {Relative,Absolute}SizeSpan support to SpannedSubject
I'll use this in TtmlDecoderTest

PiperOrigin-RevId: 289091526
2020-01-10 15:57:31 +00:00
olly
d24188f663 Add tests to validate FLAC decoder output
PiperOrigin-RevId: 289091494
2020-01-10 15:57:23 +00:00
ibaker
48f8a78f57 Simplify SpannedSubjectTest using helper methods
Suggested during the review of <unknown commit>

PiperOrigin-RevId: 289088296
2020-01-10 15:57:15 +00:00
ibaker
bae4d786e2 Add {Strikethrough,Alignment}Span support to SpannedSubject
I'm going to use these in TtmlDecoderTest

PiperOrigin-RevId: 288862274
2020-01-10 15:56:06 +00:00
ibaker
f22ac32c2c Relax the check in SpannedSubject.hasBoldItalicSpanBetween
Ultimately we only care if the style is both bold & italic, if some of
those are specified multiple times there's no problem.

PiperOrigin-RevId: 288862235
2020-01-10 15:55:57 +00:00
ibaker
e5eaacec20 Fix typo in SpannedSubject.hasBoldItalicSpanBetween
PiperOrigin-RevId: 288710939
2020-01-08 22:15:27 +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
ibaker
a98fc7ca48 Add tate-chu-yoko support to WebVTT decoding
PiperOrigin-RevId: 288285953
2020-01-06 14:56:20 +00:00
ibaker
2b1a066339 Add RubySpan support to SpannedSubject
PiperOrigin-RevId: 288280332
2020-01-06 14:55:45 +00:00
ibaker
1e7db22ee2 Convert StyleSpan assertions in SpannedSubject to fluent style
PiperOrigin-RevId: 288274998
2020-01-06 14:55:28 +00:00
ibaker
0587180f14 Make SpannedSubject more fluent
I decided the flags bit was a bit unclear so I played around with this

It's also needed for more 'complex' assertions like colors - I didn't
want to just chuck in a fourth int parameter to create:
hasForegroundColorSpan(int start, int end, int flags, int color)

PiperOrigin-RevId: 287989424
2020-01-06 14:54:44 +00:00
bachinger
06ffd23cdc make removeMediaItem return void
PiperOrigin-RevId: 286551438
2019-12-20 12:37:13 +00:00
olly
7a03e8edc0 Add NonNull to testutil.truth
PiperOrigin-RevId: 286185549
2019-12-18 18:53:48 +00:00
bachinger
36fa9d5a43 add top-level playlist API
Design doc: https://docs.google.com/document/d/11h0S91KI5TB3NNZUtsCzg0S7r6nyTnF_tDZZAtmY93g/edit

Issue: #6161, #5155
PiperOrigin-RevId: 286020313
2019-12-18 18:52:51 +00:00
tonihei
021291b38f Add server-client time offset to Window.
This offset allows to improve the calculated live offset because it
can take known client-server time offsets into account.

PiperOrigin-RevId: 285970738
2019-12-18 18:52:11 +00:00
kimvde
fcfc4eb5b6 Add FlacExtractorSeekTest
PiperOrigin-RevId: 285823771
2019-12-18 18:51:15 +00:00
kimvde
3e4baa101c Implement seeking from seektable in FLAC extractor
PiperOrigin-RevId: 285799995
2019-12-18 18:51:00 +00:00
olly
2fe3e188a9 FakeTrackOutput: Throw if sample size exceeds maxInputSize
This indicates the extractor has output a Format with a specified
maxInputSize that's too small. Failing in FakeTrackOutput ensures
this doesn't happen during Extractor tests.

PiperOrigin-RevId: 285776069
2019-12-18 18:50:52 +00:00
olly
4eb06373b1 Manual rollback of b3f485d7d9
It's technically possible to output a seekable SeekMap with unknown duration. This can occur if the media defines seek points but doesn't define either the overall duration or the duration of the media from the last seek point to the end.

PiperOrigin-RevId: 285769121
2019-12-18 18:50:44 +00:00
olly
53ec532a0e Add more SeekMap assertions, and "fix" MatroskaExtractor
In MatroskaExtractor, if the last cue time exceeds the duration
specified in the header, then we end up generating a negative
duration chunk as the last item in the SeekMap. We should probably
not do this, so drop it instead.

Note: Matroska does have a CueDuration element, but it's not used
in the one problematic file I've found.
PiperOrigin-RevId: 285738418
2019-12-18 18:50:28 +00:00
olly
b3f485d7d9 Add an additional sanity check to FakeExtractorOutput
PiperOrigin-RevId: 285422885
2019-12-18 18:49:41 +00:00
olly
b7b3a15855 Make it easier to update extractor test dump files
PiperOrigin-RevId: 285407744
2019-12-18 18:49:25 +00:00
ibaker
38e9213a9d Use SpannedSubject in WebvttCueParserTest
This is a useful test to see if it works well in a real situation.

PiperOrigin-RevId: 285386471
2019-12-13 15:22:39 +00:00
olly
59083c9f1c Suppress rawtypes warning when instantiating generic array
Change FakeAdaptiveMediaPeriod back to this style for consistency.

PiperOrigin-RevId: 284967667
2019-12-11 13:46:39 +00:00
kimvde
a95c28a929 Implement binary search seeking for FLAC extractor
PiperOrigin-RevId: 284814594
2019-12-11 13:45:43 +00:00
ibaker
7263699c2e Create Truth SpannedSubject for style assertions
This will be used in subtitle decoding tests

I followed this guide: https://truth.dev/extension.html

PiperOrigin-RevId: 284787298
2019-12-11 13:45:11 +00:00
ibaker
5da510cf00 Fix generics warning in FakeAdaptiveMediaPeriod.
Remove all generic arrays from this class.

FakeAdaptiveMediaPeriod.java:171: warning: [rawtypes] found raw type: ChunkSampleStream
    return new ChunkSampleStream[length];
               ^
  missing type arguments for generic class ChunkSampleStream<T>
  where T is a type-variable:
    T extends ChunkSource declared in class ChunkSampleStream

PiperOrigin-RevId: 284761750
2019-12-11 13:44:39 +00:00
kimvde
70ba4b197c Add peek() method to ExtractorInput
PiperOrigin-RevId: 284586799
2019-12-10 12:37:02 +00:00