32 Commits

Author SHA1 Message Date
olly
7dffb2dc4d Migrate to Player.Listener
PiperOrigin-RevId: 390124675
2021-08-11 17:32:55 +01:00
ibaker
0df0df9aee Remove @DoNotInstrument from test classes
This isn't needed now we've updated to Robolectric 4.6

PiperOrigin-RevId: 383109343
2021-07-09 08:58:38 +01:00
ibaker
227ac89eff Change TestPlayerRunHelper to fail-fast on playback error
If a test expects an error they can use runUntilError()

PiperOrigin-RevId: 382765060
2021-07-09 08:55:22 +01:00
krocard
5e2197d82e Remove extra test checks intended to debug flaky test.
Those test are no longer flaky since the test clock
was made deterministic.

The removed assertions were introduced in a4ad351fb1.

PiperOrigin-RevId: 380793961
2021-06-30 13:15:21 +01:00
aquilescanta
fc1d3dd192 Make onPlayerError take a PlaybackException
PiperOrigin-RevId: 380174672
2021-06-21 22:15:01 +01:00
aquilescanta
4c8532bd74 Make runUntilError take an ExoPlayer instance
PiperOrigin-RevId: 377267159
2021-06-03 13:54:45 +01:00
kimvde
fc47c2fe86 Add missing @DoNotInstrument annotations
PiperOrigin-RevId: 377006047
2021-06-02 18:13:19 +01:00
krocard
3dc6cf6bec Deprecate EventListener in favor of Listener
#minor-release

PiperOrigin-RevId: 371348520
2021-04-30 18:56:35 +01:00
krocard
ffe31be08b Deprecate component listener in favor of player
All `add*Listener` and `add*Output` methods are
deprecated in favor of `addListener`.

As for the class themselves `VideoListener` and
`AudioListener` are not used internaly by ExoPlayer,
`VideoRendererEventListener`
and `AudioRendererEventListener` are use in their
place.
As a result `VideoListener` and `AudioListener`
can be deprecated in favor `Listener`.

On the other hand `TextOutput` and `MedataOutput`
are used both in the player interface and internally in
renderers.
This means that those class can't be deprecated.
There usage in the public interface are indirectly
deprecated as their is no way to use them without
using the deprecated `add*Output`.
Thus it's not an issue that the class themselves are
not deprecated.

#minor-release

PiperOrigin-RevId: 371318268
2021-04-30 18:55:06 +01:00
ibaker
056ef5c914 Use Metadata.Entry.toString in PlaybackOutput test logging if possible
Add an allowlist of Metadata.Entry implementations with stable toString
overrides.

PiperOrigin-RevId: 366037505
2021-04-01 16:05:44 +01:00
bachinger
dc4148d576 Add positions and new reasons to onPositionDiscontinuity
PiperOrigin-RevId: 364861539
2021-03-24 19:56:25 +00:00
krocard
3f4f2f90b5 Move offload events to their own listener
Move offload events from Player.EventListener to
ExoPlayer.AudioOffloadListener.

PiperOrigin-RevId: 362472462
2021-03-12 10:44:50 +00:00
krocard
a4ad351fb1 Enable offload tests
Add additional assertions to try to figure out why
the tests are flaky when run in the test harness.

Failure could not be reproduced locally even after 4000 run.

PiperOrigin-RevId: 362282251
2021-03-12 10:43:16 +00:00
tonihei
2e52c0b8d8 Make FakeClock fully deterministic.
This is achieved by only triggering one message at a time. After
triggering a message we send another to ourselves to know when the
following message can be triggered.

Other required changes:
 - The messages need to be sorted correctly (by time and creation order)
 - To prevent deadlocks when one thread is waiting for another,
   we need to add new method to Clock to indicate that the current
   thread is about to wait. This then allows us to trigger messages
   from other threads in FakeClock.
 - AnalyticsCollectorTest needed some adjustments:
   - onTimelineChanged now deterministically arrives after the initial
     timline is already known, so some of the period information changes
     from window only to full period info.
   - The playlistOperations test suffers from a bug that the first frame
     is rendered too early and that's why we now get additional events.

PiperOrigin-RevId: 353877832
2021-01-26 17:13:35 +00:00
ibaker
f69e4be40e Add @RequiresApi(29) to RandomizedMp3Decoder
This is needed for the MediaFormat#getInteger calls in onConfigured().

The end-to-end playback tests this is used for have to run on API 29
anyway (because of ShadowMediaCodec and ShadowMediaCodecList
functionality).

#minor-release

PiperOrigin-RevId: 353858622
2021-01-26 15:59:24 +00:00
tonihei
4cbd4e2e2a Use Clock to create Handler for delivering messages.
This ensures the message devilery is governed by the clock.

Also replace setting a Handler with a Looper to facilititate this
change.

PiperOrigin-RevId: 353019729
2021-01-22 16:21:44 +00:00
tonihei
737630740c Add WAV playback tests.
The output dumps are intentionally empty because the playback
is using bypass modes.

Still adding a AUDIO_RAW decoder to the ShadowMediaCodecConfig to
ensure that we would output samples if bypass mode were disabled.

PiperOrigin-RevId: 352794959
2021-01-22 16:20:44 +00:00
claincly
421aa9df40 Added a test-only method to clear the clearDecoderInfosCache.
The cache, being static, is updated every time a new MimeType is encountered.
The static cache needs to be cleared between tests that register codecs through
ShadowMediaCodec, or the subsequent tests could possibly pick up a wrong codec.

PiperOrigin-RevId: 351576018
2021-01-15 10:54:45 +00:00
ibaker
466826e673 Remove data capturing logic from ShadowMediaCodecConfig
We're now using CapturingRenderersFactory everywhere

PiperOrigin-RevId: 348018988
2020-12-23 22:50:42 +00:00
ibaker
1a00da4c19 Add CapturingRenderersFactory and use it in Mp4PlaybackTest
I decided not to migrate all the tests in one CL to keep the diff
manageable. I'll make follow-up CLs to migrate the tests, and eventually
delete TeeCodec and all associated logic.

I couldn't completely remove the dump diff because
ShadowMediaCodec.getCodecInfo() (which would give me access to the MIME
type) doesn't seem to work properly - it returned video/avc when
name=exotest.audio.aac, and looking into the code it looks like there's
some native methods that are missing shadow implementations.
PiperOrigin-RevId: 347991956
2020-12-23 22:48:20 +00:00
kimvde
d148db5725 Transformer: add a setter for the looper
PiperOrigin-RevId: 346270250
2020-12-14 10:15:54 +00:00
ibaker
374ba12738 Disable subtitle output in the playback tests
This is currently flaky, so it's better to disable it than end up with
flaky tests.

PiperOrigin-RevId: 345436319
2020-12-03 17:12:25 +00:00
tonihei
a6b53d24af Add OGG playback tests
PiperOrigin-RevId: 343467276
2020-11-20 17:09:56 +00:00
christosts
c87f95e153 Add Robolectric playback tests for existing MKV assets
PiperOrigin-RevId: 342618706
2020-11-16 16:50:46 +00:00
ibaker
7ea1201bc2 Add playback tests for existing MP4 assets
Skip assets with >2 audio channels - this isn't
currently supported by ShadowAudioSystem. I'll add these when support is
available.

Also skip sample_ac4_protected.mp4 because DRM isn't supported in this
test environment either.

PiperOrigin-RevId: 338023738
2020-10-20 14:51:50 +01:00
ibaker
57e884b671 Add support for AC-3, AC-4, E-AC-3 and E-AC-3-JOC to playback tests
I added the TS playback tests for these assets without adding support
for the relevant MIME types to ShadowMediaCodec.

Also remove test assets with more than 2 audio channels - this isn't
currently supported by ShadowAudioSystem. I'll re-add these when support
is available.

PiperOrigin-RevId: 338023290
2020-10-20 14:51:41 +01:00
ibaker
d97dd8d5eb Add playback tests for existing FLAC assets
PiperOrigin-RevId: 337280116
2020-10-17 01:35:11 +01:00
ibaker
74ac915124 Add playback tests for existing MP3 assets
PiperOrigin-RevId: 337279583
2020-10-17 01:35:01 +01:00
ibaker
d700627ec2 Move Robolectric-related test utils methods to robolectricutils module
This moves TestUtil#runMainLooperUntil and
TestUtil#createRobolectricConditionVariable to a new RobolectricUtil
class.

Also move testutil classes that use Robolectric-related utils classes
(e.g. TestPlayerRunHelper, TestDownloadManagerListener).

PiperOrigin-RevId: 336864959
2020-10-13 16:29:50 +01:00
ibaker
7b8895d655 Use Mp4WebvttDecoder for WebVTT content in DASH MP4 containers
This was broken by 74a9d8f680
because DashManifestParser switched to setting Format.sampleMimeType to
text/vtt while SubtitleDecoderFactory was still expecting
application/x-mp4-vtt. This change teaches SubtitleDecoderFactory to
check both Format.containerMimeType and Format.sampleMimeType.

I'll investigate a follow-up change to remove
MimeTypes.APPLICATION_MP4VTT completely (it's currently still used in
AtomParsers).

Issue: #7985
PiperOrigin-RevId: 334771672
2020-10-06 14:30:29 +01:00
claincly
4d3a781ca4 End to end playback test for gapless playback
In the test, a real instance of SimpleExoplayer plays two identical Mp3 files.
The GaplessMp3Decoder will write randomized data to decoder output on receiving
input. The test compares the bytes written by the decoder with the bytes
received by the AudioTrack, to verify that the trimming of encoder delay/
padding is correctly carried out.

Test mp3 has delay 576 frames and padding 1404 frames. File generated from:
ffmpeg -f lavfi -i "sine=frequency=1000:duration=1" test.mp3

This change needs robolectric version 4.5, which is not currently released (2020 Sep 30).

PiperOrigin-RevId: 334648486
2020-10-06 14:30:19 +01:00
ibaker
8cee5c5f6b Create a robolectricutils module
This holds shared test infrastructure that needs to depend on
Robolectric.

PiperOrigin-RevId: 334604041
2020-10-06 14:30:10 +01:00