3349 Commits

Author SHA1 Message Date
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
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
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
ibaker
f024045638 Migrate uses of Uri-based ProgressiveDownloader() to MediaItem-based
The constructor that takes a Uri is deprecated

PiperOrigin-RevId: 321148326
2020-07-24 10:32:06 +01:00
ibaker
f83d478cc3 Migrate uses of prepare(MediaSource) to setMediaSource() & prepare()
PiperOrigin-RevId: 321147910
2020-07-24 10:31:57 +01:00
ibaker
425d48b67a Migrate usages of Cue constructors to Cue.Builder
All the public Cue constructors are deprecated

PiperOrigin-RevId: 321122512
2020-07-24 10:31:49 +01:00
ibaker
ff4516086c Migrate usages of deprecated InvalidResponseCodeException constructor
PiperOrigin-RevId: 321121988
2020-07-24 10:31:40 +01:00
ibaker
e9a8335381 Migrate callers to pass MediaItem to createMediaSource()
createMediaSource(Uri) is deprecated.

PiperOrigin-RevId: 321121383
2020-07-24 10:31:22 +01:00
ibaker
23d680a4b4 Suppress deprecation warnings in deprecated places
PiperOrigin-RevId: 320970814
2020-07-24 10:30:53 +01:00
olly
f205539616 Use lambdas where possible
PiperOrigin-RevId: 320960833
2020-07-13 17:00:44 +01:00
tonihei
29b12e2f8d Split SampleQueue.advanceTo into two operations.
The method currently advances the read position and returns the number
of skipped samples. This prevents checking how many samples are skipped
before the operation is executed.

Instead, we have a new method that returns the number of to be skipped
samples and a skip method that executes the skipping.

PiperOrigin-RevId: 320953439
2020-07-13 17:00:33 +01:00
olly
5c9c0e2073 Improve handling of floating point audio
- DefaultAudioSink always supports floating point input. Make it
  advertise this fact.
- Remove the ability to enable/disable floating point output in
  FfmpegAudioRenderer, since this ability is now also provided on
  DefaultAudioSink.
- Let FfmpegAudioRenderer query the sink to determine whether it
  will output floating point PCM directly or resample it to 16-bit
  PCM.

PiperOrigin-RevId: 320945360
2020-07-13 17:00:10 +01:00
olly
21e56f571d Misc analysis fixes
PiperOrigin-RevId: 320921457
2020-07-13 14:04:29 +01:00
kimvde
702568c3b6 Remove some occurrences of dummy in core library
Remove occurrences in comments and private fields.

ISSUE: #7565
PiperOrigin-RevId: 320606558
2020-07-13 14:03:54 +01:00
krocard
33cf96cfdf Fix more DecoderCounter increase in batching mode
The counter was increased by one for each batch
instead of each frame.

Additionally fix a null check.

PiperOrigin-RevId: 320592873
2020-07-13 14:03:36 +01:00
ibaker
9290b468d0 Stop sharing a Handler between EPI and EPII
Sharing the Handler has led to it being accidentally used for purposes
beyond the original intention.

Instead for EPII -> EPI communication: Call methods directly on
ExoPlayerImpl that then post from the playback thread to the
application thread.

And for the MediaSourceList and Queue initialization, create a dedicated
Handler based on the same applicationLooper.

PiperOrigin-RevId: 320590527
2020-07-13 14:03:27 +01:00
olly
09e97cf279 Fix some Javadoc issues
PiperOrigin-RevId: 320581002
2020-07-13 14:03:19 +01:00
ibaker
6624c7cb9a Check referenceCount > 0 in DefaultDrmSession#release()
Also flip DefaultDrmSessionManager#prepare()/release() into guard
clauses.

Suggestions from review comments on:
316f8a88cd

PiperOrigin-RevId: 320572462
2020-07-13 14:03:01 +01:00
andrewlewis
3214851fbb Migrate off deprecated IMA SDK APIs
AdDisplayContainer now takes the video ad player at construction time,
and obstructions are registered/unregistered via a new method. Also
'content complete' is now notified via ad callbacks rather than the
AdsLoader.

PiperOrigin-RevId: 320567666
2020-07-13 14:02:52 +01:00
andrewlewis
bcbe310681 Use MediaPeriodId for ad preparation errors
PiperOrigin-RevId: 320565543
2020-07-13 14:02:43 +01:00
olly
fd3e10ed76 Fix VPFO counter reporting
DecoderCounters are reset in onEnabled, but the way the local
counters in MediaCodecVideoRenderers were reset assumed the
DecoderCounters were reset in onStarted.

PiperOrigin-RevId: 320440991
2020-07-10 09:09:30 +01:00
olly
351b54e97f Pass correct Format to AudioSink.configure
Building on the Format that was provided on the input side of the
decoder creates a format that's a mixture of the formats on the
input and output sides of the decoder. This change instead builds
a PCM format from scratch.

PiperOrigin-RevId: 320405656
2020-07-10 09:09:21 +01:00
krocard
945471452f Update skippedOutputBufferCount correctly in batching mode
The counter was increased by one for each batch
instead of each frame.

PiperOrigin-RevId: 320396903
2020-07-10 09:09:12 +01:00
olly
e8596428c0 Pass correct formats to AudioSink
The renderers are currently constructing formats that consist of their
input format with added PCM encoding. Such formats are not self-consistent,
and this only works because DefaultAudioSink ignores the rest of the
format if the format has a PCM encoding. It would not work if the sink
implementation checked the MIME type, for example, which wouldn't be a
strange or incorrect thing for it to do.

The more correct approach is to construct a new format that properly
represents the PCM that will be provided to the sink.

This change also renames supportsOutput to supportsFormat, because
AudioSink itself has both an input and an output side, and this method
is actually evaluating support on the input side of the sink.

PiperOrigin-RevId: 320396089
2020-07-10 09:09:02 +01:00
ibaker
b1e9257de1 Fix the type of message passed with MSG_PLAYBACK_INFO_CHANGED
The receiving code was updated in:
7b82a3c889
but this sending site was missed.

PiperOrigin-RevId: 320173033
2020-07-09 08:04:04 +00:00
ibaker
9b4918656f Move AnalyticsCollector setup from SimpleExoPlayer to ExoPlayerImpl
PiperOrigin-RevId: 320172040
2020-07-08 13:56:56 +01:00
olly
01249bf1cd BaseRenderer: Add getStartPositionUs
This is useful for subclasses to easily query the point up to which
they should only decode (but not render) content, rather than each
subclass having to have its own startPositionUs and update it in
onPositionReset.

PiperOrigin-RevId: 320163677
2020-07-08 13:56:47 +01:00
ibaker
61acd434f6 Rollback of 252bf43bf4
*** Original commit ***

Stop parsing unsupported WebVTT CSS properties

The spec lists an exhaustive list of CSS properties that should be
recognised, all others must be ignored:
https://www.w3.org/TR/webvtt1/#the-cue-pseudo-element

***

PiperOrigin-RevId: 320150427
2020-07-08 13:56:38 +01:00