624 Commits

Author SHA1 Message Date
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
tonihei
d625af67db Add load cancelation support to DASH and SS
Issue: #7244 added this feature to HLS. This change is the exact copy
in ChunkSampleStream to add the same support to the other adaptive
formats.

Note that ChunkSampleStream doesn't support slicing, so we can't cancel
a read-from chunk, and we need to prevent reading into an already
canceled chunk load so that the chunk can be automatically discarded
after the cancelation.

Issue: #2848
PiperOrigin-RevId: 324179972
2020-08-01 12:56:39 +01:00
christosts
ce0f814b77 Migrate ExoPlayerTest.playEmptyTimeline to TestExoPlayer
PiperOrigin-RevId: 323544694
2020-08-01 12:54:33 +01:00
olly
1ed5d8b563 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: 323447253
2020-07-28 00:00:36 +01:00
ibaker
fda3b3d8ec Use static imports for methods that make sense without their class name
PiperOrigin-RevId: 323349585
2020-07-27 23:59:52 +01:00
ibaker
478f59fd08 Replace ExoPlayer's functional types with Guava alternatives
This removes Supplier, Function and Predicate. Consumer is kept because
Guava doesn't have an equivalent (Java 8 does, but we can't use that
yet).

#exofixit

PiperOrigin-RevId: 323324392
2020-07-27 23:59:25 +01:00
olly
6d92eebe51 Revert Format back to only containing audio encoding for PCM
PiperOrigin-RevId: 322683545
2020-07-24 10:46:37 +01:00
olly
92029ed0ad Un-deprecate Format.pcmEncoding and switch tests back to it.
This change precedes one that will remove Format.encoding.

PiperOrigin-RevId: 322619495
2020-07-24 10:46:28 +01:00
bachinger
f81a353bf8 Remove onMediaPeriodCreated/Released/ReadingStarted
These callbacks were only necessary to track the queue in AnalyticsCollector and there is no other known benefit of having them.

PiperOrigin-RevId: 322535274
2020-07-24 10:44:48 +01:00
christosts
6ace2c9460 DefaultDownloaderFactory: upgrade deprecated call
Replace the use of Downloader deprecrated constructor calls.

PiperOrigin-RevId: 322357118
2020-07-24 10:43:53 +01:00
olly
576ef82191 Remove explicit use of Robolectric PAUSED looper mode
It's now the default everywhere, so there's no need to specify it
explicitly.

PiperOrigin-RevId: 322153319
2020-07-24 10:41:00 +01:00
aquilescanta
ecc834d704 Make DrmSessionManager.getExoMediaCryptoType cover placeholder sessions
getExoMediaCryptoType will only return null for drmInitData == null and
track types for which placeholder sessions are not used. This change
will allow renderers to abstract themselves from format.drmInitData.

PiperOrigin-RevId: 322131219
2020-07-24 10:39:57 +01:00
christosts
b249480060 Offline: store MIME type and keySetId
Replace `type` with (optional) `mimeType` and add `keySetId` in
DownloadRequest. The DownloadHelper infers the downloading method (DASH,
HLS, SmoothStreaming or Progressive) from the content's MIME type and
URI.

PiperOrigin-RevId: 322117384
2020-07-24 10:39:30 +01:00
olly
21f5914e56 Re-add rawtypes suppression
PiperOrigin-RevId: 322008577
2020-07-24 10:38:35 +01:00
olly
a6640ae377 Stop merging methods through AnalyticsCollector/AnalyticsListener
PiperOrigin-RevId: 321595514
2020-07-24 10:37:59 +01:00
tonihei
3b26c218e1 Deduplicate clear playlist code for stop(true) calls.
The logic to clear the playlist is currently duplicated in various
reset methods so that calls to player.stop(true) can clear the playlist.

This can be deduplicated by clearing the playlist as a seperate
operation that reuses the existing code.

PiperOrigin-RevId: 321578759
2020-07-24 10:37:50 +01:00
ibaker
f55526f7bc Replace overrides of deprecated AnalyticsListener#onPlayerStateChanged
Also remove some duplicate logging from ExoHostedTest - EventLogger
logs the same info already.

PiperOrigin-RevId: 321366052
2020-07-24 10:35:42 +01:00