458 Commits

Author SHA1 Message Date
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
christosts
0a612ce34a Video processing offset in AnalyticsListener
PiperOrigin-RevId: 295146481
2020-02-17 17:13:09 +00:00
bachinger
68398b708e remove pitch field from PlaybackParameters
PiperOrigin-RevId: 294936851
2020-02-17 17:12:19 +00:00
olly
e606893ff8 Create a SampleDataReader interface for TrackOutput.sampleData().
Modify TrackOutput.sampleData() to accept SampleDataReader instead of ExtractorInput. SampleDataReader supports only read and skip calls, which all sampleData() implementations already restrict themselves to.

PiperOrigin-RevId: 294905155
2020-02-13 15:46:13 +00:00
krocard
ebce903aaf Allow writing multiple frame in a buffer
Currently only one access unit can be written per
buffer write. This has been found to be power
inefficient in an offload situation.

#exo-offload

PiperOrigin-RevId: 294886188
2020-02-13 15:45:56 +00:00
kimvde
5949cbecc3 Remove unused test methods
PiperOrigin-RevId: 294883290
2020-02-13 15:45:48 +00:00
christosts
9c58e57127 Video frame processing offset in DecoderCounters
Add fields in DecoderCounters for computing the average video frame
processing offset.

The MediaCodecVideoRenderer reports the video frame processing offset
and the demo app presents it on the debug information.

PiperOrigin-RevId: 294677878
2020-02-13 15:45:22 +00:00
kimvde
7a8ab7ce68 FakeTrackOutput: test all the formats sent
PiperOrigin-RevId: 294621946
2020-02-13 15:44:47 +00:00
kimvde
1c232b1bdf Add possibility to write extractor dump files to device
PiperOrigin-RevId: 294613898
2020-02-13 15:44:20 +00:00
olly
1cbe3f72e6 DataSpec: Deprecate most constructors
Keeping (Uri) and (Uri, position, length) to avoid needing
Builder for the trivial case.

PiperOrigin-RevId: 294530226
2020-02-13 15:43:54 +00:00
kimvde
58bc460ba3 Write extractor dumps to testdata
PiperOrigin-RevId: 294465827
2020-02-11 22:10:08 +00:00
bachinger
0eb0267131 deprecate and rename onLoadingChanged
PiperOrigin-RevId: 294222083
2020-02-11 17:11:58 +00:00
kimvde
7c85ca08cf Fix ExtractorAsserts Javadoc
PiperOrigin-RevId: 294184891
2020-02-11 17:11:26 +00:00
bachinger
c02933ac0a rename getPlaybackError
PiperOrigin-RevId: 294074348
2020-02-11 17:10:41 +00:00
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