473 Commits

Author SHA1 Message Date
aquilescanta
b5112492be Add loadTaskId to LoadEventInfo
To be used by the LoadErrorHandlingPolicy.

PiperOrigin-RevId: 308657905
2020-05-01 19:43:34 +01:00
ibaker
9dac400734 Rename ExtractorAsserts "test everything" methods
This makes the distinction more clear between the methods that test
a specific behaviour (and are meant to be used with parameterized
tests) and those that test everything in one go.

Also add a TODO to FlacExtractorTest to migrate it when we can

PiperOrigin-RevId: 308228421
2020-04-27 10:41:49 +01:00
ibaker
0e6b318138 Remove ExtractorAsserts overloads that take a Context
Also mark the two assertOutput methods private, to make the API surface
smaller.

PiperOrigin-RevId: 308228186
2020-04-27 10:41:49 +01:00
aquilescanta
25f17acd21 Move LoadEventInfo creation to the caller
LoadEventInfo needs to also be sent to the LoadErrorHandlingPolicy.

PiperOrigin-RevId: 308066998
2020-04-27 10:41:33 +01:00
ibaker
cfa8e19f77 Use parameterization in most extractor tests
Part of what makes these tests hard to deal with (imo) is being
unable to easily run a specific config, or seeing exactly which one
failed (because you always see only the first failure).

I put the parameters as a method on ExtractorAsserts to
reduce the boiler-plate required in each test class.

I'll migrate the extension FlacExtractorTest in a follow-up CL

PiperOrigin-RevId: 307785380
2020-04-27 10:40:01 +01:00
aquilescanta
7839955f31 Separate encryption data into a new TrackOutput method
Allows media parser to populate crypto data.

PiperOrigin-RevId: 307616083
2020-04-27 10:19:13 +01:00
olly
fea4376779 Merge trick play tracks into main track groups
Issue: #6054
PiperOrigin-RevId: 307285068
2020-04-20 13:29:05 +01:00
ibaker
9937744f0e Improve the error message when an extractor dump file is not found
PiperOrigin-RevId: 307078446
2020-04-20 13:28:47 +01:00
tonihei
7350981ef9 Use higher level interface for method parameters where possible.
This makes it easier to use the helper methods because the player doesn't
have to be assigned to a SimpleExoPlayer in all cases.

PiperOrigin-RevId: 307039126
2020-04-20 13:28:16 +01:00
tonihei
ca2105d50c Wait with throwing stuck buffering error until pending load is finished
We currently check for shouldContinueLoading, which is the intention to load,
not playbackInfo.isLoading, which is the actual loading state, when detecting
stuck buffering issues.

They only differ if the LoadControl said stop loading (based on nextLoadPosition),
but there is still a load in flight (updating bufferedPosition). This may cause
the exception to be thrown in edge cases that are only temporary.

PiperOrigin-RevId: 307022608
2020-04-20 13:27:57 +01:00
ibaker
15bbd181e5 Add Format.label to the extractor test dumps
Needed to test issue:#7247

PiperOrigin-RevId: 307016276
2020-04-20 13:27:48 +01:00
christosts
91690f06ed Add Clock#currentTimeMillis()
PiperOrigin-RevId: 306602043
2020-04-15 17:42:19 +01:00
tonihei
76ad0bc4ff Fix NPE in AdaptiveBitrateTest due to missing Looper.
The new TestExoPlayer.Builder asserts that a Looper is present in
the constructor, although it can be set later for cases where no
such Looper exists.

PiperOrigin-RevId: 306403491
2020-04-15 17:42:18 +01:00
ibaker
af81238c92 Delete ExtractorAsserts.assertThrows
This doesn't seem to be used anywhere

PiperOrigin-RevId: 306391995
2020-04-15 17:42:18 +01:00
ibaker
2dafb8fd69 Disallow FakeTrackOutput.format() without sampleMetadata() in between
In general an extractor shouldn't be outputting multiple formats with
no samples in between.

PiperOrigin-RevId: 305674393
2020-04-09 16:44:31 +01:00
christosts
e7fd6a0e01 SimpleExoplayer Builder for testing
Create a Builder that creates SimpleExoPlayer instances with fake
components, suitable for testing.

Basically extracts the Builder from ExoPlayerTestRunner to a standalone
class that can be re-used.

PiperOrigin-RevId: 305458419
2020-04-08 21:48:08 +01:00
kimvde
c13f41af0d Remove deprecated members in DefaultTrackSelector
PiperOrigin-RevId: 304986313
2020-04-06 13:28:28 +01:00
olly
b6ebd48506 Remaining thread name cleanup
PiperOrigin-RevId: 303829900
2020-03-31 12:35:09 +01:00
gyumin
fd03949f85 Add DeviceComponent to Player interface
PiperOrigin-RevId: 303655497
2020-03-30 17:16:51 +01:00
tonihei
af05ceac61 Call onSeekProcessed immediately after seek command.
OnSeekProcessed is documented to be called as soon as all neccessary state changes
as a result of the seek have been made. As we now mask the state changes directly
when calling seekTo, we can also call this callback immediately without changing
the semantics of the method.

Our tests often use this callback as a way to wait for the internal player
to receive all pending commands and then report back. This is a special test
requirement for cases where we want to make sure no further updates happen as
a result of the player handling commands. To facilitate that, a new action is
added with a more descriptive name that achieves the same goal.

PiperOrigin-RevId: 303296210
2020-03-27 23:32:03 +00:00
andrewlewis
4454520e93 Add overlay FrameLayout to hosted tests
PiperOrigin-RevId: 303283147
2020-03-27 23:31:46 +00:00
olly
92c4088ac5 Remove dependency to self for testutils
PiperOrigin-RevId: 302446077
2020-03-25 13:03:20 +00:00
olly
dc33c0bdfb Improve logging II
- Show renderers with no tracks in EventLogger track logging
- Log renderer names in EventLogger track logging
- Add useful message to ExoPlaybackException instances (including
  renderer name for renderer errors)

PiperOrigin-RevId: 302421616
2020-03-25 13:03:12 +00:00
aquilescanta
aa9eb5abc9 Remove generics from DRM components
PiperOrigin-RevId: 301798563
2020-03-20 12:48:50 +00:00
tonihei
395a7031ac Add tests to cover two OOM scenarios.
We have two known scenarios where the app could create an OOM error and
we want to handle it gracefully:
 1. The app continues to allocate memory but doesn't make any progress
    in the buffered position. OOM should be prevented by the default
    load control and it should eventually throw an exception.
 2. An extractor tries to allocate a large amount of memory on the
    Loader thread based on information it read in faulty media files.
    In this case we should attempt to play remaining media and then
    throw an exception.

Both cases are already handled correctly, but we don't have any tests
ensuring that we don't introduce regressions.

PiperOrigin-RevId: 301585700
2020-03-19 00:50:31 +00:00
tonihei
71eec8ead1 Fix unrealistic FakeSampleStream.isReady
The FakeSampleStream is currently always ready even if it doesn't
have any samples to read. Fix that by checking for the conditions
under which read() will be successful.

PiperOrigin-RevId: 301371031
2020-03-19 00:49:18 +00:00
ibaker
cb414e8743 Change FakeRenderer to take a track type instead of a list of formats
The assertion about the expected formats doesn't really belong in a
fake, the assertions should be closer to the test method.

This gets in the way when I try and write a new test in
AnalyticsCollectorTest that doesn't use the expected, constant Format
(because i want to specify drmInitData) - but changing the expected
Format is tricky because it's hard-coded into the FakeVideoRenderer
inner class.

I replaced the assertion in FakeRenderer with assertions in test
methods that used to assert on the format count.

PiperOrigin-RevId: 301353072
2020-03-19 00:49:10 +00:00
olly
3acc85c2df Re-split ExoHostedTest.onTestFinished into logMetrics and assertPassed
This is a partial revert of <unknown commit>. The split and the order is important. For
example, as things are currently, if playback fails for a test that makes additional
assertions in onTestFinished, the visible reason the test failed is quite likely to
be one of the additional assertions, rather than the error that actually caused the
playback to fail. I think we probably also don't want to log metrics if playback
fails.

PiperOrigin-RevId: 300733109
2020-03-19 00:47:41 +00:00
bachinger
2028fdd756 add media item based playlist methods
After this change users of ExoPlayerImpl and SimpleExoPlayer can use the media item base playlist API which converts the media item to a media source.

It adds the media item based methods to the ExoPlayer instead of the Player interface. This avoids a big change in the CastPlayer which requires migrating the cast extension to the MediaItem of the core module (follow up CLs).

PiperOrigin-RevId: 300575567
2020-03-19 00:47:04 +00:00
bachinger
1e387601a6 update ExoPlayerTest to use get/setPlaybackSpeed
PiperOrigin-RevId: 300554337
2020-03-19 00:46:56 +00:00
ibaker
93e203f970 Tweak the assertions in MediaSourceTestRunner to give clearer failures
PiperOrigin-RevId: 300519989
2020-03-19 00:45:51 +00:00
tonihei
82599960c2 Add public API for pauseAtEndOfMediaItem
Also adds tests covering the internal implementation.

Issue:#5660
PiperOrigin-RevId: 300513548
2020-03-19 00:45:26 +00:00
bachinger
683cb0260e add get/setPlaybackSpeed and listener callback
This change deprecates the PlaybackParameters and remove the skipSilenceField from the PlaybackParameters. This implies that enabling and disabling skipping silences needs to be done on the Player.AudioComponent after this change.

After submission of the change, all Player API changes are done which are required to bring playbackSpeed and skipSilenceEnabled in the converged Player API state.

PiperOrigin-RevId: 300420843
2020-03-19 00:45:01 +00:00
aquilescanta
47b62e8c02 DataReader: replace InterruptedException with InterruptedIOException
PiperOrigin-RevId: 299092243
2020-03-10 10:19:45 +00:00
tonihei
b5976a55ff Upgrade Kotlin annotations and fix gradle warnings
The new version fixes some warnings in Gradle builds. Also
add missing indirect compileOnly dependencies to fix some more warnings

Issue:issue:#7007
PiperOrigin-RevId: 298855510
2020-03-10 10:19:19 +00:00
krocard
58f42e9f8b Annotate render's read source result
So that swich case has a warning if all case are not
covered.

PiperOrigin-RevId: 298574013
2020-03-10 10:17:48 +00:00
andrewlewis
9c1c74ecc4 Rename .unklen.dump -> .unknown_length.dump
PiperOrigin-RevId: 298334502
2020-03-10 10:16:54 +00:00
ibaker
2f4e88d5af Remove ByteBufferBackingArray suppression from metadata decoders
PiperOrigin-RevId: 298312222
2020-03-10 10:16:25 +00:00
tonihei
697165ce56 Enable window-period offset in tests by default.
This ensures all player interactions in tests automatically verify that
timestamps calculations are done correctly.

PiperOrigin-RevId: 297813324
2020-02-28 18:41:56 +00:00
andrewlewis
64feb97d62 Add codecs string to extractor dumps
PiperOrigin-RevId: 297806457
2020-02-28 18:41:13 +00:00
kimvde
56dbe83a4c Extractor tests: dump only non-default values for format
This removes noisy data from the dump files and allows updating less
dump files if a format field is added, removed or updated.

PiperOrigin-RevId: 297617138
2020-02-28 18:40:54 +00:00
aquilescanta
a114a0ed7f Rename SampleDataReader to DataReader and move to common
PiperOrigin-RevId: 297603312
2020-02-27 17:16:53 +00:00
olly
c6a6e0d6f3 Migrate various call sites to Format.Builder
PiperOrigin-RevId: 297562889
2020-02-27 17:15:34 +00:00
olly
31f0302505 Extractor tests: Output average and peak bitrates separately
Note: The dump files will need updating again when the extractors
are modified to only set the appropriate bitrate. Enhancing the
test first is nice, because it means that in subsequent CLs the
dump file updates can be used to quickly see what's changed in
the output.
PiperOrigin-RevId: 297188367
2020-02-27 17:14:47 +00:00
ibaker
113c418884 Explain how to overwrite golden data in extractor test failure message
This info is already in the javadoc of FakeExtractorOutput#assertOutput
but it's not super discoverable if you just see the test failure. I was
manually copying the dump results around before realising there was
a mechanism to auto-update.

PiperOrigin-RevId: 296204463
2020-02-25 21:22:27 +00:00
olly
47133f46cb Keep method signature together when overriding
Not important, but when overriding a method that can return null,
it seems preferable to put @Override first, followed by what it's
overriding (which includes the @Nullable).

Also remove explicit @NonNull use in the core library. @NonNull is
propagated by default, so this is redundant.

PiperOrigin-RevId: 296188379
2020-02-25 21:22:10 +00:00
olly
54283746be Fix lint errors
PiperOrigin-RevId: 295953956
2020-02-25 21:21:29 +00:00
krocard
f0c0f6eb8f Merge handleBuffer and handleEncodedBuffer
This was unnecessary complexity to avoid very few users
to be broken.

PiperOrigin-RevId: 295603082
2020-02-18 11:00:10 +00:00
aquilescanta
5c3c803460 Remove DRM management from Renderers
PiperOrigin-RevId: 295569075
2020-02-17 17:40:30 +00:00
tonihei
d3f806fdf4 Let FakeRenderer subclasses decide whether to render a sample.
This is closer to how our actual renderers look like and allows tests
to use a similar logic to show/suppress the first frame in follow-up changes.

PiperOrigin-RevId: 295557548
2020-02-17 17:40:30 +00:00