6358 Commits

Author SHA1 Message Date
olly
6eb706002a Migrate to Robolectric PAUSED looper mode: AudioFocusManagerTest
PiperOrigin-RevId: 322154193
2020-07-24 10:41:09 +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
olly
302b5f2ba4 Remove unnecessary use of Robolectric LEGACY looper mode
CacheDataSourceTest2 works fine in PAUSED mode as well.

PiperOrigin-RevId: 322150471
2020-07-24 10:40:51 +01:00
bachinger
7c995a3cfa Fix javaDoc of onMediaItemTransition
PiperOrigin-RevId: 322145517
2020-07-24 10:40:42 +01:00
olly
0cd15d9158 Proactively check listener arguments are non-null
PiperOrigin-RevId: 322143359
2020-07-24 10:40:24 +01:00
tonihei
953db7898e Make dependency on AndroidX appcompat optional for dialog builder.
The dependency is only used to create a dialog in
TrackSelectionDialogBuilder that is compatible with newer styling
options.

This dependendy adds over 500Kb to the apk (even if unused) and we
shoudn't force this on an app. Instead make the dependency optional by
automatically falling back to the platform version if the AndroidX one
doesn't exist.

Issue: #7357
PiperOrigin-RevId: 322143005
2020-07-24 10:40:15 +01:00
kimvde
ee222f7027 Remove AtomParsers from extractors nullness exclusion list
PiperOrigin-RevId: 322131697
2020-07-24 10:40:06 +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
b7b3f4ea45 Remove unused MEDIA_ITEM_TRANSITION_REASON_SKIP
PiperOrigin-RevId: 322120882
2020-07-24 10:39:39 +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
christosts
63b965d3f0 Non-null MIME types infer to other content type
PiperOrigin-RevId: 322114754
2020-07-24 10:39:12 +01:00
olly
9185b5177a Temporarily remove OPUS from sync samples optimization.
This is currently causing frames to be dropped when we seek.

PiperOrigin-RevId: 322009748
2020-07-24 10:38:44 +01:00
olly
21f5914e56 Re-add rawtypes suppression
PiperOrigin-RevId: 322008577
2020-07-24 10:38:35 +01:00
olly
12559bbc8d DefaultAudioSink: Make PCM vs non-PCM code paths clearer
This change replaces a lot of individual isInputPcm branching with a single,
larger branch.

PiperOrigin-RevId: 321763040
2020-07-24 10:38:17 +01:00
insun
bcf218da60 Import translated strings
PiperOrigin-RevId: 321762840
2020-07-24 10:38:08 +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
161dea661f Assorted deprecation fixes/migrations/suppressions
These were missed on the first pass

PiperOrigin-RevId: 321553847
2020-07-24 10:37:41 +01:00
bachinger
c0204bfdc4 Throw when window uid changes for unexpected reasons
PiperOrigin-RevId: 321553397
2020-07-24 10:37:23 +01:00
ibaker
ab95e3f388 Migrate usages of deprecated SimpleCache constructors
I duplicated some methods in SimpleCacheTest to ensure we keep testing
the deprecated code paths for now.

PiperOrigin-RevId: 321548802
2020-07-24 10:37:14 +01:00
olly
363a2a3b45 DefaultRenderersFactory: Add setting to enable float output
This also renders https://github.com/google/ExoPlayer/pull/7625 redundant.

PiperOrigin-RevId: 321544195
2020-07-24 10:37:05 +01:00
olly
26db5be49a DefaultAudioSink: Misc cleanup
- Move output channel workaround to a block that's only executed for PCM
- Remove redundant variable

PiperOrigin-RevId: 321460898
2020-07-24 10:36:47 +01:00
olly
6b4abf2643 Audio event consistency cleanup
PiperOrigin-RevId: 321440594
2020-07-24 10:36:38 +01:00
bachinger
cfef1378a7 Fix JavaDoc
PiperOrigin-RevId: 321436812
2020-07-24 10:36:29 +01:00
tonihei
bb787d662d Ensure onAdPlaybackStarted is only called after the session is created
We currently try to call onAdPlaybackStarted even if the ad session
is not created yet and if not, we never call the callback afterwards.

Make sure to update and create the current session before trying to
send onAdPlaybackStarted.

As a result, we can merge updateSessions into the existing
handleTimelineChanged and handleDiscontinuity calls as they always
need to be called together.

PiperOrigin-RevId: 321383860
2020-07-24 10:36:20 +01:00
tonihei
8cc3cc4e14 Assume renderer errors are thrown for reading period.
This fixes a bug that renderer errors are currently falsely associated
with the playing period.

PiperOrigin-RevId: 321381705
2020-07-24 10:36:11 +01:00
ibaker
e682f53b3c Migrate overrides of deprecated onPlaybackParametersChanged
This method has been replaced by onPlaybackSpeedChanged

PiperOrigin-RevId: 321369921
2020-07-24 10:36:02 +01:00
kimvde
6927239a73 Remove some occurrences of gendered pronouns
ISSUE: #7565
PiperOrigin-RevId: 321367089
2020-07-24 10:35:53 +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
krocard
422f451cf9 Name [-1,1] the "nominal" range of float samples
Float values are allowed to be > 0dbfs,
it is just not nominal as it will might
distort the signal when played without
attenuation.

This is also consistent with
[AudioTrack.write(FloatBuffer)](https://developer.android.com/reference/android/media/AudioTrack#write(float[],%20int,%20int,%20int)) that explicitly
allows it up to 3dbfs.

PiperOrigin-RevId: 321345077
2020-07-24 10:35:33 +01:00
olly
890c4adbed Clip float point PCM to its allowed range before resampling
PiperOrigin-RevId: 321340777
2020-07-24 10:35:24 +01:00
bachinger
c4171d50cc Remove MediaSourceList.maybeThrowSourceInfoRefreshError
The method has been called from two call sites in EPII triggered by EPII.updatePeriods(). The first call site was calling it when the MediaSourceList is empty or not yet prepared. This can be removed because if empty or not prepared no source ever could have thrown yet.

The second call site was checking for potential source refresh exceptions when queue.getNextMediaPeriodInfo() returns null when trying to getting the next loading period. Looking into all reasons for why the method returns null, none of them is caused by an exception of a media source. The reasons are:

- if we are at the last period of the timeline
- if the defaultPosition of the next period in the timeline is null (if the window.durationUs == C.TIME_UNSET or defaultPositionProjectionUs is projected beyond the duration of the window)
- if we are waiting for an ad uri to arrive (period.isAdAvailable(...) == false)
- if we are waiting for the ad group count to be updated (adCountInCurrentAdGroup == C.LENGTH_UNSET)

The above reasons are not caused by a source error and may be resolved when doSomeWork is called the next time. Hence it is save to remove the calls to maybeThrowSourceInfoRefreshError().

Beside this, an actual sourceInfoRefreshError will be reported by maskingMediaSource.maybeThrowPrepareError(), which is called each time doSomeWork() is called and the playing period is not yet prepared (EPII:L836). So the player is notified by source errors that way, which confirms removing the above calls is fine.

PiperOrigin-RevId: 321331777
2020-07-24 10:35:15 +01:00
bachinger
e7b76354b9 Add Player.EventListener.onMediaItemTransition
PiperOrigin-RevId: 321218451
2020-07-24 10:34:57 +01:00
aquilescanta
e486dc602c Release Extractor resources in DASH
PiperOrigin-RevId: 321181453
2020-07-24 10:34:48 +01:00
ibaker
8cd4afcdee Remove the generic EventDispatcher from util directory
It's only used in BandwidthMeter so inline it there.

PiperOrigin-RevId: 321177126
2020-07-24 10:34:39 +01:00
ibaker
bf5e6c7862 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: 321175627
2020-07-24 10:34:30 +01:00
ibaker
5c4b8085a0 Migrate usages of DefaultDrmSessionManager constructor to Builder
PiperOrigin-RevId: 321174738
2020-07-24 10:34:21 +01:00
ibaker
8ae04bcfee Migrate usages of deprecated Window#tag
PiperOrigin-RevId: 321169585
2020-07-24 10:34:03 +01:00
ibaker
5a2e04ec39 Migrate usages of deprecated SinglePeriodTimeline constructor
PiperOrigin-RevId: 321168965
2020-07-24 10:33:54 +01:00
ibaker
8eb2354e5e Replace deprecated JUnit Assertions with Truth
PiperOrigin-RevId: 321168125
2020-07-24 10:33:45 +01:00
ibaker
437d1b6e9a Migrate usages of deprecated Player#set/getPlaybackParameters()
PiperOrigin-RevId: 321166822
2020-07-24 10:33:36 +01:00
kimvde
820970e767 Remove occurrence of sanity in AdaptiveTrackSelectionTest
PiperOrigin-RevId: 321163229
2020-07-24 10:33:27 +01:00
bachinger
d62688cfc0 Mask periodId and loadingPeriodId
This change masks playbackInfo.periodId and playbackInfo.loadingPeriodId for operations which change these periods (set/add/remove sources and seeks).

Because this masking is reflected in the playbackInfo object, player attributes can be retrieved without the maskingXyz variables in EPI. This has the advantage that the playbackInfo object always reflects the public state of the player even when operations are still pending. The maskingXyz variables in EPI are only required for the deprecated use case of an initial seek in an empty timeline.

PiperOrigin-RevId: 321160092
2020-07-24 10:33:18 +01:00
ibaker
683d630ec6 Migrate usage of deprecated OfflineLicenseHelper constructor
PiperOrigin-RevId: 321158149
2020-07-24 10:33:09 +01:00
ibaker
93c9e93a09 Migrate usages of renderer constants in C.java to the Renderer ones
PiperOrigin-RevId: 321157794
2020-07-24 10:33:00 +01:00
ibaker
49db15ef73 Migrate usages of DownloadHelper TrackSelector constants
PiperOrigin-RevId: 321157115
2020-07-24 10:32:51 +01:00
ibaker
7b69b47a5e Migrate usages of deprecated MediaSource#getTag() method
PiperOrigin-RevId: 321156463
2020-07-24 10:32:42 +01:00
kimvde
1d1762d30d Add Builder to Transformer
PiperOrigin-RevId: 321155415
2020-07-24 10:32:33 +01:00
gyumin
18d8db4e77 Move DeviceInfo from core to common
In order to use DeviceInfo class in media2, this CL moves the class to
common module. It didn't move the other file in the same package,
DeviceListener, as it's for DeviceComponent but media2 SessionPlayer
doesn't have components as it is already flattened. PlayerCallback will
have equivalent methods of DeviceListener.

PiperOrigin-RevId: 321154997
2020-07-24 10:32:24 +01:00
ibaker
e9482c7f0c Migrate uses of deprecated DefaultDownloadFactory constructor
PiperOrigin-RevId: 321153963
2020-07-24 10:32:15 +01:00