713 Commits

Author SHA1 Message Date
ibaker
2a93eff25a Attach resource info to exceptions thrown in DataSourceContractTest
Before this we added the resource info to Truth assertions, but the
same info is missing if an exception bubbles out of the SUT.

PiperOrigin-RevId: 346757960
2020-12-14 10:16:53 +00:00
christosts
1ff0965a10 Do not advance SystemClock manually in tests
Changes MetadataRetriever and Transformer so that their
respective tests don't need to manually control the SystemClock
in order to execute taks posted with delay from Loader.

PiperOrigin-RevId: 345024140
2020-12-03 17:10:19 +00:00
krocard
538445572d Move FormatSupport in common
#player-to-common

PiperOrigin-RevId: 344558028
2020-11-30 09:33:11 +00:00
tonihei
e66f0032aa Remove stopTest workaround in ExoHostedTest
The workaround to post a message was needed to ensure we
receive any final onIsPlayingChanged event before the test
is finished (to record the correct playing time).

Using onEvents allows us to do this synchronously as the
callback guarantees that there is no other pending event.

#exofixit

PiperOrigin-RevId: 344436180
2020-11-27 11:08:49 +00:00
ibaker
3aa17bfb9b Switch extractor tests to single-parameter parameterized syntax
This is simpler than instantiating a single-element string array for
every parameter.

#exofixit

PiperOrigin-RevId: 344237475
2020-11-27 11:06:51 +00:00
tonihei
87e141d376 Remove boilerplate setting up FakeTimeline and FakeMediaSource.
In many cases it doesn't matter for the test itself how many windows
a timeline has, or even how the timeline of a MediaSource looks like.

And since we introduced the MediaItem-based APIs, single-window
Timelines are the only fully supported Timelines. Thus there is no
point in specifiying this explicitly.

Using these assumptions, we can remove some boilerplate when setting
up standard FakeTimelines or FakeMediaSources with a standard
FakeTimeline.

#exofixit

PiperOrigin-RevId: 344210395
2020-11-27 11:06:27 +00:00
kimvde
7a7d3d1b07 Add FMP4 extractor test with sideloaded track
#exofixit

PiperOrigin-RevId: 344052500
2020-11-24 16:03:46 +00:00
ibaker
6d7997e747 Move DataSourceContractTest to the testutil package
PiperOrigin-RevId: 343096974
2020-11-18 18:40:36 +00:00
tonihei
44009ea686 Rollback of fa6e01312b
*** Original commit ***

Suppress warnings in preparation for Checker Framework 3.7.1 upgrade.

***

PiperOrigin-RevId: 343085407
2020-11-18 18:40:22 +00:00
olly
755f5b7d76 Suppress warnings in preparation for Checker Framework 3.7.1 upgrade.
PiperOrigin-RevId: 342999709
2020-11-18 18:40:10 +00:00
ibaker
4936c730c3 Add a contract testing abstract class for DataSource implementations
This only has a couple of simple tests for now. We'll add more tests
after we've written some concrete sub-class tests for various
DataSource implementations.

I've included a concrete FileDataSourceContractTest as a demonstration.

PiperOrigin-RevId: 342851187
2020-11-18 18:30:58 +00:00
ibaker
41d0c0f882 Add @deprecated javadoc to StubExoPlayer#getPlaybackError
This should be inherited from Player#getPlaybackError, but lint still
complains and this seems like the easiest fix.

PiperOrigin-RevId: 342598368
2020-11-16 16:50:23 +00:00
olly
c47e62209d Report reasons for not being able to reuse decoders
PiperOrigin-RevId: 342344090
2020-11-16 16:49:48 +00:00
ibaker
1e776a864b Fix some typos
PiperOrigin-RevId: 341573964
2020-11-11 09:50:30 +00:00
andrewlewis
764e5e8141 Expose the ads identifier in the Timeline period
Issue: #3750
PiperOrigin-RevId: 341021084
2020-11-06 16:35:06 +00:00
tonihei
ae17e6d6f8 Forward Timeline and period id to TrackSelection.Factory
This information is already available in the MappingTrackSelector,
but not currently forwarded to the TrackSelection.Factory.

This makes it more complicated (or impossible) to depend on period
or manifest information in the track selection (for example to only
select tracks which are cached for the current format).

PiperOrigin-RevId: 340605886
2020-11-06 16:32:57 +00:00
ibaker
c71f1b04e9 Add time units to playing time failure message in ExoHostedTest
PiperOrigin-RevId: 339864290
2020-11-02 23:00:10 +00:00
tonihei
ae6907e1f5 Don't rely on events after player release in ExoHostedTest
ExoHostedTest was calculating the total play time by solely listening
to onIsPlayingChanged. The last update to false (when playback ends) was relying
on a callback that was always called after the player has already been released.
This happened because of a now fixed bug where callbacks were still issued if
player.release() is called from within another callback (as in ExoHostedTest).

Fix the currently broken test by posting the release call so that all pending
events are still delivered first.

PiperOrigin-RevId: 339438863
2020-11-02 22:58:15 +00:00
krocard
e589d7238a Add a getter for sleeping for offload
This allows wakelock releases to be state based
instead of transition based.

#exo-offload

PiperOrigin-RevId: 337286501
2020-10-17 01:35:20 +01:00
christosts
c4b346e49d Integrate playback speed control in ExoPlayerImplInternal
Issue: #4904
PiperOrigin-RevId: 337048010
2020-10-17 01:33:37 +01:00
christosts
f00584b02a Improve FakeClock and AutoAdvancingFakeClock
Issue: #4904
PiperOrigin-RevId: 337047518
2020-10-17 01:33:28 +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
ca3b420cf6 Split TestExoPlayer into Builder and RunHelper classes
TestExoPlayerBuilder can be used from both emulator and robolectric
tests, TestPlayerRunHelper uses Robolectric Looper behaviour, meaning
it can be moved to the robolectricutils module in a follow-up change.

PiperOrigin-RevId: 336634225
2020-10-13 16:27:39 +01:00
kimvde
c898e71908 Read until the track formats are available in TestUtil.extractSeekMap()
Otherwise, some extractor tests are seeking without making sure that the
extractor has retrieved the formats.

This is needed for PR Issue: #7378.

PiperOrigin-RevId: 335934326
2020-10-13 16:26:51 +01:00
samrobinson
a552e35f6a Add getter and callbacks for static metadata retrieval.
Issue:#7266
PiperOrigin-RevId: 335416280
2020-10-06 14:31:32 +01:00
andrewlewis
3e8dacc284 Move DataSource reading methods into Util
This will be used to read ads responses out of data: URLs in a subsequent
change.

PiperOrigin-RevId: 334778780
2020-10-06 14:30:56 +01:00
krocard
f37d79a4dd Callback when sleeping for offload and existing from it
#exo-offload

PiperOrigin-RevId: 333497538
2020-09-25 16:32:09 +01:00
tonihei
ebfeb2f77a Guava-ify f2c51560c2
PiperOrigin-RevId: 333031301
2020-09-25 16:29:44 +01:00
tonihei
f2c51560c2 Don't assume FakeSampleStream is ended without end of stream signal
PiperOrigin-RevId: 333029935
2020-09-25 16:29:34 +01:00
kimvde
cc10657c09 Fix dump file write directory
PiperOrigin-RevId: 332254072
2020-09-21 22:57:37 +01:00
ibaker
be68d13ba5 Throw RuntimeException instead of Error from ExoHostedTest
Throwing Error forces a test to catch Throwable (e.g.
DashWidevineOfflineTest#widevineOfflineReleasedV22), which will also
catch AssertionError meaning the fail() call at the end of the try block
won't work.

The DashWidevineOfflineTest have been broken since
91185500a1

PiperOrigin-RevId: 331120894
2020-09-11 13:25:05 +01:00
krocard
19e6de778d Introduce audio offload scheduling tests
PiperOrigin-RevId: 330918396
2020-09-11 13:24:13 +01:00
andrewlewis
abc39088d0 Remove testutil dependency on Robolectric shadows
Move shadow-related utils for end-to-end tests into core test.

PiperOrigin-RevId: 330902696
2020-09-11 13:23:45 +01:00
olly
b2b08ade99 Make User-Agent optional
PiperOrigin-RevId: 330593247
2020-09-09 09:41:51 +01:00
christosts
3dbb4c4da9 Migrate test repeatModeChanges() to TestExoPlayer
PiperOrigin-RevId: 328918314
2020-09-07 20:39:18 +01:00
andrewlewis
74c493f51e Add back support for setting audio pitch
To play slow motion streams where the audio has been recorded at
slower speeds, it is necessary to be able to resample (rather than
time-stretch) the audio. This change undeprecates back the previously
deprecated PlaybackParameters class to allow apps to set pitch.

PiperOrigin-RevId: 328703116
2020-08-27 12:06:41 +01:00
ibaker
74f7ec729c Add playback tests for TS and MP4 samples that run on Robolectric
This commit introduces the infrastructure classes, and a couple of
illustrative usages.

PiperOrigin-RevId: 328301593
2020-08-26 16:39:49 +01:00
andrewlewis
4b0e39e4b9 Add an event for the audio position advancing
Currently the audio renderer can become ready before the AudioTrack
actually has enough data to play something, which means that the
player may transition to the ready state before audio starts
playing. This makes the player's current state transition not very
useful for detecting when audio actually starts playing.

This change adds a new event to notify apps when the audio position
is increasing after a pause or seek/flush/reset event, and includes
an estimate of the system time at which audio playout started.

Issue: #7577
PiperOrigin-RevId: 327810040
2020-08-26 16:39:18 +01:00
ibaker
b85ff574a9 Relax ExoHostedTest#MAX_PLAYING_TIME_DISCREPANCY_MS
PiperOrigin-RevId: 327391755
2020-08-21 12:50:38 +01:00
aquilescanta
41e6577dca Remove DrmSessionManager.acquirePlaceholderSession
In order to acquire a placeholder session, clients can call acquireSession
with a format with a null drmInitData.

PiperOrigin-RevId: 327220249
2020-08-21 12:49:06 +01:00
ibaker
54c92080bf Fix nullness warnings in testutil package
PiperOrigin-RevId: 327190676
2020-08-21 12:48:29 +01:00
ibaker
f0ae8afd80 Separate the dump files from the test assets
This allows us to more easily create different dumps derived from the
same assets.

This moves media/source files from `assets/` to `assets/media/` and
dump files from `assets/` to `assets/extractordumps/` and
`assets/audiosinkdumps/` as appropriate. I intend to add
`assets/playbackdumps/` in a future CL.

PiperOrigin-RevId: 326986283
2020-08-17 16:13:53 +01:00
andrewlewis
61abe5951a Use consistent naming for 'offload scheduling enabled'
PiperOrigin-RevId: 326413842
2020-08-17 16:11:35 +01:00
aquilescanta
fcb263a407 Make DrmSessionManager take a Format instead of DrmInitData
Skipping acquirePlaceholderSession which will be removed
in a following change.

PiperOrigin-RevId: 326402746
2020-08-17 16:11:17 +01:00
ibaker
da4d55635c Create a DumpFileAsserts from the dumpfile logic in FakeExtractorOutput
Also use it to replace the same logic in CapturingAudioSink

PiperOrigin-RevId: 325969455
2020-08-17 16:08:24 +01:00
samrobinson
b956f85b45 Change experimental method naming for enableOffloadScheduling.
PiperOrigin-RevId: 325784822
2020-08-17 16:06:34 +01:00
tonihei
eee9b312dc Change default value of throwWhenStuckBuffering to true.
This change caused no problems and can be enabled by default.

PiperOrigin-RevId: 325264859
2020-08-07 19:03:30 +01:00
ibaker
ea347a464a Rollback of 1ed5d8b563
*** Original commit ***

Rollback of bf5e6c7862

*** Original commit ***

Pass startPositionUs into Renderer.replaceStream

Plumb this down into BaseRenderer.onStreamChanged and use it when
deciding whether to render the first frame of a new period.

***

***

PiperOrigin-RevId: 325218588
2020-08-07 19:02:52 +01:00
olly
71fd335bcd Simplify output format propagation
PiperOrigin-RevId: 324805335
2020-08-07 19:00:28 +01:00
christosts
f4287ed070 Add a builder for DownloadRequest
PiperOrigin-RevId: 324616617
2020-08-07 18:59:30 +01:00