3505 Commits

Author SHA1 Message Date
olly
8386d617bf Fix OOM-is-prevented test OOM-ing :)
This test is intended to check that DefaultLoadControl will cause
playback to fail as "stuck buffering" rather than OOM-ing, in the
case that its target buffer size is reached and playback still
hasn't started.

Unfortunately, the target buffer size is ~130MB, and when running
on some setups an OOM actually ends up happening before this much
memory is allocated.

This change makes the target buffer size much smaller to avoid the
problem.

PiperOrigin-RevId: 331748208
2020-09-16 13:37:26 +01:00
bachinger
4f982763cf Add getMediaItemCount() and getMediaItemAt(int)
PiperOrigin-RevId: 331211708
2020-09-11 23:21:08 +01:00
olly
9fb2902dad Exclude Guava transitive annotation dependencies
PiperOrigin-RevId: 331148067
2020-09-11 16:02:37 +01:00
olly
ea25729a09 Make BatchBufferTest allocate less memory
Setting to 2x BATCH_SIZE_BYTES

PiperOrigin-RevId: 331124129
2020-09-11 13:30:33 +01:00
olly
5bd61116a2 Fix incorrect type when creating ExoPlaybackException
PiperOrigin-RevId: 331027732
2020-09-11 13:30:15 +01:00
bachinger
862cf26534 fix typo
PiperOrigin-RevId: 331025924
2020-09-11 13:30:06 +01:00
tonihei
4648a41962 Don't keep 100MB static buffer in test.
This may remove available memory from other tests running in the same
process. Instead, create the huge buffer when needed so it can be GCed
immediately.

PiperOrigin-RevId: 330960844
2020-09-11 13:29:57 +01:00
tonihei
c75077cb9e Release player in e2e playback tests.
Not releasing the player means the playback thread keeps running
and also keeps its entire allocated playback buffer.

PiperOrigin-RevId: 330958821
2020-09-11 13:29:48 +01:00
krocard
52a1c791f7 Introduce audio offload scheduling tests
PiperOrigin-RevId: 330918396
2020-09-11 13:29:29 +01:00
tonihei
4d2a2384d6 Add convenience constructor methods.
When passing in ExtractorFactory instances to SimpleExoPlayer.Builder or
DefaultMediaSourceFactory, we currently need to pass in one other
instance (RenderersFactory or DataSource.Factory), that developers will
often set to its default. To avoid specifying these defaults, these new
convience methods allow to just set the ExtractorsFactory if required.

PiperOrigin-RevId: 330908002
2020-09-11 13:29:02 +01:00
andrewlewis
fdb9bbb619 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:28:25 +01:00
olly
268ad81a98 Fix Javadoc for DefaultDataSourceFactory constructors
PiperOrigin-RevId: 330736458
2020-09-11 13:27:53 +01:00
olly
49699d398d Make User-Agent optional
PiperOrigin-RevId: 330593247
2020-09-09 09:45:48 +01:00
tonihei
6290d093c1 Support ExtractorFactory in DefaultMediaSourceFactory.
This allows to customize extractor flags more easily when setting up the player.

In addition, we need to provide a way to pass in the ExtractorFactory through
the constructor chain starting in SimpleExoPlayer so that removing the
DefaultExtractorsFactory is possible for R8.

PiperOrigin-RevId: 330472935
2020-09-09 09:45:42 +01:00
Oliver Woodman
6c7884436a Remove unfinished FfmpegVideoRenderer from release 2020-09-07 20:48:28 +01:00
olly
6cce608f32 Simplify DefaultMediaSourceFactory ad configuration
- Use a setter, which is consistent with how other optional
  components are passed.
- Remove nesting where a provider provides another provider.
  Since AdSupportProvider then only provides one thing, it
  can be renamed to AdsLoaderProvider, which more clearly
  expresses what it provides.

PiperOrigin-RevId: 330396334
2020-09-07 20:46:57 +01:00
olly
45dc66ef2f Clear CodecInfos on InputFormat if codec is null
In maybeInitCodecWithFallback, it caches availableCodecInfos with mediaCryptoRequiresSecureDecoder and inputFormat as inputs, and won't clear it if shouldInitCodec is false, resulting in a case where availableCodecInfos is not null and codec is null.
When we have a new format, it's reasonable to clear availableCodecInfos if codec is null. Otherwise we might not be able to properly initialize a new codec.

PiperOrigin-RevId: 329971796
2020-09-07 20:43:00 +01:00
christosts
8dcab1d20a Remove fragile tests
PiperOrigin-RevId: 329894431
2020-09-07 20:42:42 +01:00
olly
fe2fc8b73f Add useful DownloadRequest to MediaItem conversion method
PiperOrigin-RevId: 329722775
2020-09-07 20:42:14 +01:00
olly
8e5336c59e Dev guide: Start updating the download page
PiperOrigin-RevId: 329719402
2020-09-07 20:41:55 +01:00
christosts
29f2a31af7 Re-enable ignored unit tests
PiperOrigin-RevId: 329675833
2020-09-07 20:41:36 +01:00
gyumin
d155416c54 Add Util.postOrRun
To avoid repetition, it adds Util.postOrRun and replaces existing
instances with the util method.

PiperOrigin-RevId: 329472769
2020-09-07 20:40:04 +01:00
olly
17b370d00c Allow upstream discards from the SampleQueue by time.
Add a SampleQueue method to discard from the write side of the queue by timestamp

PiperOrigin-RevId: 329303714
2020-09-07 20:39:46 +01:00
olly
440fd1cf62 Some minor tweaks
1. Add EventLogger right away in PlayerActivity, else it doesn't log
   playWhenReady being initially set to true.
2. Remove EventLogger logging for the audio position advancing. It's
   redundant with isPlaying logging unless you're very specifically
   interested in the timing difference.
3. Remove unnecessary comment in Player.
4. Fix Timeline Javadoc.

PiperOrigin-RevId: 328983944
2020-09-07 20:39:36 +01:00
olly
e163fe6949 Optimize AAC seeking except for xHE-AAC
In 2.11.2 to 2.11.5, we considered all AAC streams as consisting
only of sync samples. In 2.11.6+, we considered no AAC streams as
consisting of sync samples, because the property is not guaranteed
specifically for xHE-AAC. This will have caused a small regression
is seek speed for some types of media.

This change brings back the optimization for AAC, specifically
excluding only xHE-AAC (and cases where we don't know what type of
AAC we're dealing with).

PiperOrigin-RevId: 328950697
2020-09-07 20:39:27 +01:00
christosts
3dbb4c4da9 Migrate test repeatModeChanges() to TestExoPlayer
PiperOrigin-RevId: 328918314
2020-09-07 20:39:18 +01:00
aquilescanta
91b3aad063 Make ExoPlayer.getPlaybackLooper never return null
Issue: #7807
PiperOrigin-RevId: 328726966
2020-08-27 14:41:42 +00: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
Oliver Woodman
8b3422ba54 Merge pull request #7800 from TakuSemba:apply-output-surface-workaround
PiperOrigin-RevId: 328696935
2020-08-27 12:06:30 +01:00
bachinger
feb4cce2b2 Enable nullness test for CachedContent/CachedContentIndex
PiperOrigin-RevId: 328551668
2020-08-27 12:06:20 +01:00
claincly
20def699ad Fix test failure due to recent change to ShadowAudioTrack
<unknown commit> used a new API provided in API29+, changing this test's config to
use the newer SDK version.

TAP:https://test.corp.google.com/ui#d=targetZoomout&flags=CAMQAlhg&t=//third_party/java_src/android_libs/exoplayer/v2/library/core/src/test:test_com/google/android/exoplayer2/audio/MediaCodecAudioRendererTest
PiperOrigin-RevId: 328344926
2020-08-26 16:40:02 +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
tonihei
a6ee778cfe Remove unnecessary ID suffix.
PiperOrigin-RevId: 328154018
2020-08-26 16:39:39 +01:00
tonihei
996e58973d Make renderer flush when setting pause-at-end more targeted.
We currently always reset everything if playingPeriod != readingPeriod.
However, this is only needed when the pausing is actually required, i.e.,
if the feature is enabled and we are in the last period of the window.

PiperOrigin-RevId: 328141242
2020-08-26 16:39:29 +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
takusemba
3f5c584574 apply output surface workaround for F02H, F03H 2020-08-25 14:53:57 +09:00
bachinger
e55b345595 Make all media source factories create a drm session
PiperOrigin-RevId: 327691347
2020-08-21 12:55:14 +01:00
andrewlewis
e2fc5c2190 Fix EventLogger audio underrun logging
PiperOrigin-RevId: 327610950
2020-08-21 12:51:23 +01:00
aquilescanta
79a846eb5e Fix check in placeholder session acquisition
PiperOrigin-RevId: 327223824
2020-08-21 12:49:16 +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
olly
7588c26b60 Remove support for cbc1 and cens encryptions schemes
PiperOrigin-RevId: 327199833
2020-08-21 12:48:39 +01:00
insun
b853978a91 Fix bug to show 'play' button at the end of stream
PiperOrigin-RevId: 327158791
2020-08-18 08:11:54 +01:00
olly
513b301e77 ExoPlaybackException: Align some method naming
PiperOrigin-RevId: 327003695
2020-08-17 16:14:39 +01:00
olly
7ef31e2208 Tweak DefaultMediaSourceFactory documentation
PiperOrigin-RevId: 327000958
2020-08-17 16:14:30 +01:00
olly
02ed809a18 Tweak offload disable Javadoc
PiperOrigin-RevId: 326998407
2020-08-17 16:14:21 +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
olly
94b66f4c24 Specify which function is triggering a TimeoutException
PiperOrigin-RevId: 326666629
2020-08-17 16:13:16 +01:00
andrewlewis
977f0d1ed0 Scale AudioTrack buffer size for AudioTrack speed adjustment
PiperOrigin-RevId: 326642908
2020-08-17 16:13:07 +01:00
samrobinson
eabc486b58 Keep AudioTrack on seek - experimental.
PiperOrigin-RevId: 326622573
2020-08-17 16:12:58 +01:00
andrewlewis
61abe5951a Use consistent naming for 'offload scheduling enabled'
PiperOrigin-RevId: 326413842
2020-08-17 16:11:35 +01:00