3904 Commits

Author SHA1 Message Date
olly
106294158a Fix SimpleExoPlayer documentation
I've removed the "by default" statements, since this now depends on how
the builder was configured.

PiperOrigin-RevId: 366249995
2021-04-12 14:12:12 +01:00
ibaker
e8742b33dd Use outputStreamEnded for MetadataRenderer#isEnded
Issue: #8710
PiperOrigin-RevId: 366051836
2021-04-12 14:12:07 +01:00
marcbaechinger
6d0a04dd87 Release all PlaybackStatsListener session when timeline becomes empty.
Currently they are only released when the timeline becomes non-empty
again or the player is released.

Issue: #8778
PiperOrigin-RevId: 366041625
2021-04-12 14:09:26 +01:00
Oliver Woodman
1fd62c685a Merge pull request #8720 from dlafayet:tts-shear-block
PiperOrigin-RevId: 365998615
2021-04-09 17:27:31 +01:00
ibaker
14711d1fb2 Treat Dolby Vision as H264 in MCVR#getCodecMaxInputSize()
Issue: #8705
PiperOrigin-RevId: 364821429
2021-04-09 17:11:03 +01:00
Ian Baker
65ab00859f Merge pull request #8653 from dlafayet:textemphasis
PiperOrigin-RevId: 364363882
2021-04-09 17:07:08 +01:00
aquilescanta
ca9af38420 Add 'once' to list of devices that need SetOutputSurfaceWorkaround
Issue: #8718
PiperOrigin-RevId: 363869093
2021-04-09 17:05:13 +01:00
ibaker
06e6391866 Fix CEA-708 priority
According to the spec (section 8.4.2), high numeric values represent low
priorities, so we need to flip this sort.

Issue: #8704
#minor-release
PiperOrigin-RevId: 362558370
2021-04-09 16:57:26 +01:00
andrewlewis
3bdfb76c0c Don't update the ad group count when releasing ImaAdsLoader
`ImaAdsLoader` clears its `AdPlaybackState` when it's released but this could
cause `AdsMediaSource` to look up information in the ad playback state that is
no longer in bounds.

Issue: #8693

PiperOrigin-RevId: 362556286
2021-04-09 16:56:54 +01:00
ibaker
3dae045487 Deflake ClippedPlaybackTest
PiperOrigin-RevId: 362298115
2021-04-09 16:49:00 +01:00
ibaker
39e6f665a7 Pass the end position of a stream to TextRenderer when marking it final
In a period transition we pass the start time of the next period, for
the final period we pass the duration of the period or timeline, if
known.

This means sideloaded subtitles now respect the end point of
ClippingMediaSource and ensures that content subtitles aren't
incorrectly displayed over mid-roll ads.

When transitioning back into the subtitled content the subtitles still
appear slightly before the video transitions, meaning the first subtitle
of the content is shown with the last few frames of the ad. Resolving
this in a way that doesn't break anything else requires a deeper
investigation.

Issue: #5317
Issue: #8456
#minor-release
PiperOrigin-RevId: 361797118
2021-04-09 16:13:10 +01:00
Ian Baker
fbdc1bbfd7 Merge pull request #8654 from abeljim:dev-v2-8435-bolditalic
PiperOrigin-RevId: 361767801
2021-04-09 16:11:47 +01:00
tonihei
37d5947b9e Use correct period-window offset for initial prepare position.
MaskingMediaSource needs to resolve the prepare position set for a MaskingPeriod
while the source was still unprepared to the first actual prepare position.

It currently assumes that the period-window offset and the default position is
zero. This assumption is correct when a PlaceholderTimeline is used, but it
may not be true if the real timeline is already known (e.g. when re-preparing
a live stream after a playback error).

Fix this by using the known timeline at the time of the preparation.
Also:
 - Update a test that should have caught this to use lazy re-preparation.
 - Change the demo app code to use the recommended way to restart playback
   after a BehindLiveWindowException.

Issue: #8675
PiperOrigin-RevId: 361604191
2021-04-09 16:10:26 +01:00
Ian Baker
db60db70fc Merge pull request #8662 from joakimzhang:dev-v2
PiperOrigin-RevId: 361029604
2021-04-09 16:07:55 +01:00
bachinger
01d4adad6d Reset playback speed when live speed control becomes unused
Issue: #8664
#minor-release
PiperOrigin-RevId: 360877086
2021-04-09 16:06:56 +01:00
kimvde
1a190ff90e Link to callback in Player getters' Javadoc
PiperOrigin-RevId: 360398175
2021-04-09 16:04:54 +01:00
andrewlewis
bcd0a91ed6 Fall back from DTS HD to DTS
#minor-release

PiperOrigin-RevId: 360384540
2021-04-09 14:10:21 +01:00
ibaker
e4d5e07fd3 Make SsaDecoder robust against absent Format items
Suggested in a comment on PR Issue: #8615

PiperOrigin-RevId: 359522217
2021-04-09 14:01:23 +01:00
Ian Baker
4364b9150f Disable flaky test in ExoPlayerTest
targetLiveOffsetInMedia_unknownWindowStartTime_doesNotAdjustLiveOffset
is flaky on the release branch. It's not flaky on the dev-v2 branch
due to recent changes to FakeClock's behaviour which aren't yet present
on release-v2.
2021-02-25 16:29:37 +00:00
marcbaechinger
e21b99a671 Merge pull request #8615 from szaboa:dev-v2-8435-ssa-font-size
PiperOrigin-RevId: 359244236
2021-02-24 18:35:59 +00:00
kimvde
3f8f7ba97f Fix conditions to enable UI actions
- Ensure consistency between (Styled)PlayerControlView,
  PlayerNotificationManager, TimelineQueueNavigator and
  DefaultControlDispatcher.
- Handle the case where a live stream has ended when enabling previous
  and next actions (window.isLive() is true and window.isDynamic is
  false in that case)

PiperOrigin-RevId: 359063793
2021-02-24 18:32:11 +00:00
olly
46995b3c24 Remove unused mocking in CacheWriterTest
#minor-release

PiperOrigin-RevId: 358998449
2021-02-23 13:55:35 +00:00
olly
18a94aa717 SilenceSampleStream.readData: Handle flags-only buffers
The SampleStream.readData contract is that when reading a sample
with a flags-only buffer, the buffer timestamp and flags should
be set and the read position should not be advanced.

#minor-release

PiperOrigin-RevId: 357842130
2021-02-22 15:04:08 +00:00
olly
5be7d4da9e Don't clear audioSessionId when audio disabled
Issue: #8585
PiperOrigin-RevId: 357553237
2021-02-22 14:52:37 +00:00
tonihei
0ab9a219f7 Clarify/correct restrictions of AdsMediaSource.
The source can be used in compositions (in fact, every source is
automatically used in an internal composition when constructing the
playlist), and there is not really a concept of top-level media source
any more since the Player supports playlists.

The actual restriction is that the content media source needs to have
exactly one period to be able to create a SinglePeriodAdTimeline.

#minor-release

PiperOrigin-RevId: 357544191
2021-02-22 14:46:35 +00:00
olly
5807d2e0be Fix RequiresApi annotation
#minor-release

PiperOrigin-RevId: 357273184
2021-02-12 22:55:02 +00:00
ibaker
295e8bacb3 Check if keepalive is enabled before releasing sessions in DDSM.release
If keepalive is disabled the existing code over-eagerly releases
DrmSession instances. This is arguably OK since a (Default)DrmSession
should be released before its (Default)Manager is released
(since the underlying MediaDrm instance might be released when the
manager is released). And if all sessions are released before the
manager is released then `sessions` is empty, so the loop is a no-op.

Issue: #8576
PiperOrigin-RevId: 356955308
2021-02-12 17:19:19 +00:00
ibaker
d48d59bda1 Propagate DRM config when creating ad media sources
The `DrmConfiguration.sessionForClearTypes` property is often used
to ensure a secure decoder is used for clear ads played in encrypted
content. This is because some devices show black frames when switching
decoders.

Before this change the DRM config isn't propagated down when
constructing the ad media source, meaning
`DrmSessionManager.DRM_UNSUPPORTED` is always used, which will
cause playback to switch from secure to clear decoder when transitioning
to an ad break (ignoring the MediaItem `sessionForClearTypes` option.

Issue: #8568

PiperOrigin-RevId: 356951124
2021-02-12 17:19:03 +00:00
andrewlewis
ed3d1c6283 Don't set playback parameters when using tunneling
Issue: #4803

PiperOrigin-RevId: 356923345
2021-02-12 17:18:34 +00:00
ibaker
19ab087c61 Cache the last DrmSessionManager instance inside the default provider
Without this a new manager is instantiated for every item in a playlist,
meaning the impact of caching improvements to DefaultDrmSessionManager
are reduced (since the cache doesn't persist across playlist items).

With this change, playlists of items with identical DRM config will use
the same manager instance (and thus share existing sessions).

Issue: #8523
PiperOrigin-RevId: 356690852
2021-02-12 17:17:58 +00:00
tonihei
5211f06dc2 Don't apply speed adjustment if windowStartTime is unknown.
This may happen for HLS live streams without program date time
information.

Issue: #8560

PiperOrigin-RevId: 356227729
2021-02-12 17:17:11 +00:00
kimvde
045048f6f5 Fall back to AVC/HEVC for Dolby Vision levels 10-13
Before, the level was set to null in this case.
MediaCodecUtil.getCodecProfileAndLevel() was therefore returning null
and the fallback to AVC/HEVC was not enabled in MediaCodecVideoRenderer.

Issue:#8530
PiperOrigin-RevId: 355574499
2021-02-04 16:19:46 +00:00
olly
b419d0ac1d Improve EventLogger static metadata formatting
#minor-release

PiperOrigin-RevId: 355203044
2021-02-03 15:49:04 +00:00
ibaker
b4a9c756b8 Document that DrmSessionManagerProvider doesn't call DSM#prepare()
#minor-release

PiperOrigin-RevId: 355159635
2021-02-03 15:48:53 +00:00
ibaker
03b9fa303d Log a warning when SingleSampleMediaPeriod turns a load error into EOS
Without this no error is currently logged or propagated to EventLogger.
The propagation doesn't happen because
MergingMediaSource.ForwardingEventListener only propagates events
originating from the "main" source in the merge:
<unknown commit>

#minor-release

PiperOrigin-RevId: 354902467
2021-02-01 22:56:19 +00:00
olly
6f80181905 Make Cronet extension depend only on common
This also moves DefaultHttpDataSource to common, which seems
sensible, else non-player components that need a DataSource
don't have any useful concrete implementations. We should
think about moving some of the other concrete implementations
to common as well.

PiperOrigin-RevId: 354738925
2021-02-01 22:56:05 +00:00
olly
07a3ba1b7e Fix nullness issues in DefaultHttpDataSource
This is needed to move it to common, since we don't want to start
adding any nullness exemptions for the common module.

PiperOrigin-RevId: 354734715
2021-02-01 22:56:00 +00:00
Oliver Woodman
07e8860084 Merge pull request #8490 from szaboa:dev-2-8435-ssa-color
PiperOrigin-RevId: 354293679
2021-02-01 22:55:38 +00:00
christosts
9b95b46286 BandwidthMeter minor javadoc fix
PiperOrigin-RevId: 353858581
2021-02-01 22:54:20 +00:00
Ian Baker
afcd741447 Remove FfmpegVideoRenderer from 2.13.0 release
This component isn't ready to be released yet.
2021-01-26 14:51:09 +00:00
andrewlewis
e696a7c6e2 Use maximum supported channel count for Atmos from API 29
#minor-release

PiperOrigin-RevId: 353649545
2021-01-25 17:38:46 +00:00
olly
3fcc14b3c2 OkHttp/Rtmp extensions: Remove dependency on core
They only require common. This allows their use for non-playback networking
without requiring the user to depend on the whole of core. I will also make
the same change for Cronet, although this needs a little more work.

PiperOrigin-RevId: 353649388
2021-01-25 17:38:36 +00:00
olly
a1f06987eb Replace non-inclusively named constant
Issue: #7565
PiperOrigin-RevId: 353649187
2021-01-25 17:38:26 +00:00
krocard
b0258e7192 Move Player in common
This is the last CL to move Player in common.

#player-to-common

PiperOrigin-RevId: 353642347
2021-01-25 15:37:48 +00:00
krocard
ec43735054 Split mutations method out of TrackSelection
`TrackSelection` had mutation methods which were to be called only
internally by ExoPlayer components but were exposed in the
public `Player` interface.

The mutation methods have been moved out of `TrackSelection`
to a new class `ExoTrackSelection`.

Current track related read-only method have also been moved out,
because they are actually something quite unclear.
Even for a single item playlist, it's the track being buffered rather
than the track being played, which is unclear.
But when you have a playlist it starts to get really confusing,
because if the next item is being buffered, then it's actually
the last track to be buffered in the currently playing item.
As a final aside, the implementations don't do proper thread synchronization
to ensure visibility of updated state by the calling thread.

Exposing those mutable methods in the public `Player` interface
was problematic because they leaking internal concepts of `ExoPlayer`.
This is also required to minimize the `Player` interface for long term
stability.

`ExoTrackSelection` is a subclass of `TrackSelection`.
This is not ideal as an `TrackSelection` implementation could
break the current immutability.
This was done in order for this refactor to be simpler.
A future patch will fully split the two classes.

All `MediaPeriod` and `Sources` had to be updated to use the new
`TrackSelection` dynamic aspect class name.
An alternative would have been to break ExoPlayer's public API, keeping
`TrackSelection` as the dynamic aspect name, and calling the public static
aspect class `TrackSelectionState` or similar.
Nevertheless, while it would have impacted less files, it would have
many more small apps and casual users of ExoPlayer.

#player-to-common

PiperOrigin-RevId: 353637924
2021-01-25 15:37:38 +00:00
olly
b069a567ea Rename DUMMY_MEDIA_ID and related cleanup
Issue: #7565
PiperOrigin-RevId: 353616594
2021-01-25 15:37:28 +00:00
olly
dc7fde1ff7 Some more language fixes
Issue: #7565
PiperOrigin-RevId: 353613493
2021-01-25 15:36:59 +00:00
andrewlewis
c37f757854 Allow playback for ads buffered to end
`ImaAdsLoader` only loads ad media URLs once playback of the preceding ad (if
any) has started, and this behavior is likely to be similar for other ad loader
implementations due to limits on how long before an ad plays it is meant to be
loaded. This is problematic for very short ads followed by an ad because the ad
will load to the end but load control may not allow playback to start due to
the total buffered duration being low.

Fix this by allowing playback to start regardless of load control if we are
waiting for an ad media period to prepare.

An alternative fix would be to fake the ad progress in the `ImaAdsLoader` to
trigger loading the next ad, but this would only allow one ad to load ahead (so
the problem would remain for two short ads in a row followed by another ad).

Issue: #8492
PiperOrigin-RevId: 353600088
2021-01-25 15:36:39 +00:00
krocard
6a900ab11b LoadControler no longer uses TrackSelectionArray
Instead it uses a TrackSelection[].

#player-to-common

PiperOrigin-RevId: 353584567
2021-01-25 15:36:29 +00:00
krocard
bf3816bd41 Remove non Player use of TrackSelectionArray, use TrackSelection[]
This is necessary for the child cl that `TrackSelection`
in two distinct class. It avoids to split the array
version of such class too.

TrackSelectionArray exist to have an immutable array of TrackSelection.
Internal users are trusted to not mutate the array.

One drawback of this approach is that a `TrackSelectionArray`
has to be allocated on the boundary of the `Player` interface.
This should not be a performance issue as this only happens
on trackSelection changes, when the user calls
`Player.getCurrentTrackSelections` and on
`updateLoadControlTrackSelection`.

#player-to-common

PiperOrigin-RevId: 353582654
2021-01-25 15:36:20 +00:00