4178 Commits

Author SHA1 Message Date
ibaker
0b34cabca0 Document that DrmSessionManagerProvider doesn't call DSM#prepare()
#minor-release

PiperOrigin-RevId: 355159635
2021-02-03 15:02:32 +00:00
ibaker
ffc1b5bbef 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 18:11:56 +00:00
olly
35b99d634f 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 18:11:23 +00:00
olly
eb0d8e6f28 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 18:11:14 +00:00
Oliver Woodman
c9fce083f3 Merge pull request #8490 from szaboa:dev-2-8435-ssa-color
PiperOrigin-RevId: 354293679
2021-02-01 18:10:35 +00:00
Arnold Szabo
28a3921a6a Add color decoding tests to SsaDecoderTest, remove SubStation Alpha colors" from media.exolist.json. 2021-01-26 22:57:10 +01:00
Arnold Szabo
f8a47bc86d Modify the SsaColor to be more similar to the Optional class. 2021-01-26 21:37:01 +01:00
tonihei
9b3014dd79 Remove randomness from adaptive bitrate tests.
- The order of sample stream (and thus the order in which loads are
  triggered) currently depends on a Set and thus on the hash codes
  of the objects that change with every run. Changing to a List solves
  this problem.
- The FakeAdaptiveDataSet directly created a static Random (with random
  seed) to compute the variation of chunk sizes. Changing this to an
  injected Random object that can always be initialized with the same
  seed also removed this randomness from the tests.

PiperOrigin-RevId: 353878661
2021-01-26 17:13:46 +00:00
tonihei
2e52c0b8d8 Make FakeClock fully deterministic.
This is achieved by only triggering one message at a time. After
triggering a message we send another to ourselves to know when the
following message can be triggered.

Other required changes:
 - The messages need to be sorted correctly (by time and creation order)
 - To prevent deadlocks when one thread is waiting for another,
   we need to add new method to Clock to indicate that the current
   thread is about to wait. This then allows us to trigger messages
   from other threads in FakeClock.
 - AnalyticsCollectorTest needed some adjustments:
   - onTimelineChanged now deterministically arrives after the initial
     timline is already known, so some of the period information changes
     from window only to full period info.
   - The playlistOperations test suffers from a bug that the first frame
     is rendered too early and that's why we now get additional events.

PiperOrigin-RevId: 353877832
2021-01-26 17:13:35 +00:00
tonihei
89ea38d155 Handle all messages in FakeClock.
Currently only delayed messages are handled. Change this to handling
all messages so that we have more control over their execution order.

This requires adding a new wrapper type for the Message to support
the obtainMessage + sendToTarget use case.

PiperOrigin-RevId: 353876557
2021-01-26 17:13:15 +00:00
christosts
ccf031f9bb BandwidthMeter minor javadoc fix
PiperOrigin-RevId: 353858581
2021-01-26 15:59:15 +00:00
Arnold Szabo
2241320535 Remove unused static variable 2021-01-25 23:36:50 +01:00
Arnold Szabo
1364c01e09 Improve support of SSA (V4+) PrimaryColour style 2021-01-25 23:35:10 +01: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
ibaker
c5a8154970 Move factory mutations out of DefaultDataSourceFactory#createMediaSource
#minor-release

PiperOrigin-RevId: 353394376
2021-01-25 15:36:09 +00:00
ibaker
5b9fa7d7d9 Add MediaSourceFactory#setDrmSessionManagerProvider()
Deprecate other DRM config methods.

Issue: #8466
PiperOrigin-RevId: 353251452
2021-01-22 16:58:56 +00:00
olly
9825e5f9d7 Move some utility classes to common
These are used by the cast extension, so will need moving eventually!

PiperOrigin-RevId: 353219703
2021-01-22 16:22:18 +00:00
olly
4791900848 Move Player.getTrackSelector to ExoPlayer
PiperOrigin-RevId: 353212567
2021-01-22 16:22:09 +00:00
ibaker
ba803a2e79 Fix some local & comment references is DefaultDrmSessionManager
This field changed name during the code review, but these names and
references weren't updated to match.

Also use an ImmutableSet since the field is a Set.

PiperOrigin-RevId: 353021268
2021-01-22 16:22:00 +00:00
tonihei
20df512c74 Use Clock to create Handler in ExoPlayerImpl.
This is needed to ensure the Handler is goverened by the clock.

PiperOrigin-RevId: 353020654
2021-01-22 16:21:52 +00:00
tonihei
4cbd4e2e2a Use Clock to create Handler for delivering messages.
This ensures the message devilery is governed by the clock.

Also replace setting a Handler with a Looper to facilititate this
change.

PiperOrigin-RevId: 353019729
2021-01-22 16:21:44 +00:00
tonihei
d1faf713af Use Clock to create Handler in ListenerSet.
This ensures the Handler is governed by this clock.

PiperOrigin-RevId: 353011555
2021-01-22 16:21:27 +00:00
krocard
efcaee563a Move TrackGroup and TrackGroupArray in common
This is a dependency of TrackSelection and Player.

#player-to-common

PiperOrigin-RevId: 353004379
2021-01-22 16:21:10 +00:00
olly
b460124c33 Setup ShadowMediaCodecConfig for SilencePlaybackTest
Codecs are not used by this test because PCM uses codec bypass,
but performing the setup is still necessary to have the test
verify that this is indeed the case!

PiperOrigin-RevId: 352965739
2021-01-22 16:20:53 +00:00
tonihei
737630740c Add WAV playback tests.
The output dumps are intentionally empty because the playback
is using bypass modes.

Still adding a AUDIO_RAW decoder to the ShadowMediaCodecConfig to
ensure that we would output samples if bypass mode were disabled.

PiperOrigin-RevId: 352794959
2021-01-22 16:20:44 +00:00
kim-vde
26ea43d21f Merge pull request #8415 from TiVo:p-fix-cea708anchor
PiperOrigin-RevId: 352783091
2021-01-22 16:20:34 +00:00
aquilescanta
2d3e6d4dba Test SampleQueue.peek
PiperOrigin-RevId: 352781639
2021-01-22 16:20:24 +00:00
aquilescanta
4eaa6111c1 Add SampleQueue.peek
PiperOrigin-RevId: 352779870
2021-01-22 16:20:15 +00:00
Arnold Szabo
0ead2af22c Add support for SSA (V4+) PrimaryColour style 2021-01-21 22:45:07 +01:00
Oliver Woodman
c40d1c6620 Merge pull request #8462 from zeninsta:advertise-vp9-profile
PiperOrigin-RevId: 352611965
2021-01-19 19:24:16 +00:00
ibaker
b2a42ea157 Rename MediaSourceDrmHelper to DefaultDrmSessionManagerProvider
Also move it to the `drm` package, and extract a
`DrmSessionManagerProvider` interface.

I'll add `MediaSourceFactory.setDrmSessionProvider()` in a follow-up
change.

Issue: #8466
PiperOrigin-RevId: 352582559
2021-01-19 19:24:06 +00:00
ibaker
dd1b1c0837 Fix nullness warnings in DefaultDrmSessionManagerTest
These only show up in Android Studio, but still seem worth fixing.

PiperOrigin-RevId: 352570399
2021-01-19 19:23:48 +00:00
christosts
21f3fa9f7c Add contract test for DataSchemeDataSource
PiperOrigin-RevId: 352558063
2021-01-19 19:23:40 +00:00
christosts
c808751009 Add contract tests for OkHttpDataSource
PiperOrigin-RevId: 352554949
2021-01-19 19:23:31 +00:00
andrewlewis
60f000c8b1 Remove incorrect TODOs
PiperOrigin-RevId: 352552961
2021-01-19 19:23:23 +00:00
krocard
dc1842efb9 Convert back code to link
The code is no longer in common so can directly link to Player.

PiperOrigin-RevId: 352548323
2021-01-19 19:23:14 +00:00
christosts
0b2bc60b1a Add contract test for AssetDataSource
PiperOrigin-RevId: 352532853
2021-01-19 19:23:05 +00:00
christosts
f1506970aa Add contract test for ByteArrayDataSource
PiperOrigin-RevId: 352530806
2021-01-19 19:22:56 +00:00
Oliver Woodman
0c22810a7b Merge pull request #8459 from WonderzGmbH:fix/8253-cache-exception
PiperOrigin-RevId: 352450607
2021-01-18 22:00:46 +00:00
olly
4359016145 Fix disabling of bypass
PiperOrigin-RevId: 352403189
2021-01-18 22:00:28 +00:00
ibaker
4cfb3aff8f Drop responses in DefaultDrmSession if the session has been released
This prevents trying to post the response to possibly dead threads,
which causes an IllegalStateException to be logged.

Issue: #8328
PiperOrigin-RevId: 352388155
2021-01-18 22:00:03 +00:00