417 Commits

Author SHA1 Message Date
ibaker
9ec2d2fb36 Remove HlsMediaSource from null-checking blacklist
PiperOrigin-RevId: 275233915
2019-10-18 17:41:54 +01:00
ibaker
0d5b3c0fa4 Remove HlsMasterPlaylist from null-checking blacklist
PiperOrigin-RevId: 275052534
2019-10-17 11:52:34 +01:00
ibaker
e63d3b4b61 Add HlsSampleStreamWrapper#assertPreparationComplete
This gives a clear way to ensure all the preparation-related @MonotonicNonNull
fields have been set to something.

PiperOrigin-RevId: 274988280
2019-10-16 14:02:03 +01:00
ibaker
fc95d07a94 Remove HlsChunkSource from null-checking blacklist
PiperOrigin-RevId: 274789337
2019-10-15 23:08:00 +01:00
ibaker
0ba91811d1 Break the inheritance of FullSegmentEncryptionKeyCache
Use composition instead.

This makes the null-handling more explicit & complete (previous implementation
tried to prevent null values, but didn't override all mutation methods
e.g. replace(), putIfAbsent() etc.)

PiperOrigin-RevId: 274778513
2019-10-15 23:07:53 +01:00
ibaker
3eea797069 Rollback of fdfe631850
*** Original commit ***

Remove null-ness of muxedCaptionFormats list

Pre-work for removing HlsMasterPlaylist and HlsPlaylistParser from null-checking
blacklist.

***

PiperOrigin-RevId: 274591502
2019-10-15 23:07:23 +01:00
ibaker
fdfe631850 Remove null-ness of muxedCaptionFormats list
Pre-work for removing HlsMasterPlaylist and HlsPlaylistParser from null-checking
blacklist.

PiperOrigin-RevId: 274585117
2019-10-15 23:07:15 +01:00
ibaker
e670b1d0f6 Remove HlsMediaChunk from null-checking blacklist
PiperOrigin-RevId: 274566133
2019-10-14 14:35:42 +01:00
ibaker
eb677eb4b9 Add a Util.nullSafeArrayAppend and use it in HlsSampleStreamWrapper
I could do this with nullSafeArrayConcat but this saves allocating a throw-away
single-element array.

PiperOrigin-RevId: 274545815
2019-10-14 13:58:04 +01:00
ibaker
498a23e328 Add null-checker annotations to HlsSampleStreamWrapper
PiperOrigin-RevId: 274545728
2019-10-14 13:57:56 +01:00
ibaker
6ebcac3883 Remove DefaultHlsExtractorFactory from null-checking blacklist
PiperOrigin-RevId: 274537528
2019-10-14 13:57:48 +01:00
ibaker
a81dea6a47 In-line 2 method reference runnables in HlsSampleStreamWrapper
PiperOrigin-RevId: 274148614
2019-10-13 12:41:16 +01:00
ibaker
60566721d4 Enable ID3-in-EMSG for HLS streams
This supports both chunkless & traditional preparation

PiperOrigin-RevId: 273938344
2019-10-10 14:46:07 +01:00
tonihei
4f640bc62e Add SequencableLoader.isLoading
This method allows the player to figure out whether we still have an ongoing
load even if LoadControl.shouldContinueLoading returns false.

PiperOrigin-RevId: 272445577
2019-10-02 21:30:07 +01:00
tonihei
dd4f9bcaae Add Timeline.Window.isLive
This flag is currently merged into Window.isDynamic, which isn't always true
because
1. A window can be dynamic for other reasons (e.g. when the duration is still
missing).
2. A live stream can be become non-dynamic when it ends.

Issue:#2668
Issue:#5973
PiperOrigin-RevId: 271999378
2019-10-02 21:28:43 +01:00
ibaker
f0723a27b7 Move HLS mapped track picking into a separate method
This helps reduce the amount of nesting in HlsSampleStreamWrapper.track()

PiperOrigin-RevId: 271983779
2019-10-02 21:28:20 +01:00
ibaker
f0b9889ef6 Remove duplicated tracksEnded check in HlsSampleStreamWrapper
PiperOrigin-RevId: 271364512
2019-10-02 21:27:12 +01:00
ibaker
b57c356fbf Reshuffle {audio,video}SampleQueue{Index,MappingDone} into fields mapped by type
PiperOrigin-RevId: 271364200
2019-10-02 21:27:04 +01:00
aquilescanta
18b9304f25 Call prepare and release from MediaSources
Issue:#4721
PiperOrigin-RevId: 270342454
2019-09-22 00:16:07 +01:00
olly
0a854d6b84 Rollback of dd7223df10
*** Original commit ***

Refactor HlsSampleStreamWrapper#track() to clarify the return paths

I found the original implementation quite hard to follow, and I believe this is functionally identical.

***

PiperOrigin-RevId: 270263186
2019-09-20 17:21:01 +01:00
aquilescanta
e5f9a858d3 When the HLS container format is not packed audio, reset timestmap offset
Issue:#6444
PiperOrigin-RevId: 270252126
2019-09-20 17:21:01 +01:00
ibaker
6cd530520d Refactor HlsSampleStreamWrapper#track() to clarify the return paths
I found the original implementation quite hard to follow, and I believe this is functionally identical.

PiperOrigin-RevId: 270237641
2019-09-20 17:21:01 +01:00
aquilescanta
9863cd33fa Avoid retrying fatal errors
Also clear fatal errors on seek operations

PiperOrigin-RevId: 269780886
2019-09-18 23:23:21 +01:00
aquilescanta
0aba89b60e Make live HLS default start position at least 2*target duration from live edge
Issue:#6360
PiperOrigin-RevId: 267615050
2019-09-10 10:27:38 +01:00
olly
2d0b10a73a Use constant to define androidx annotation version
PiperOrigin-RevId: 266801762
2019-09-05 10:45:08 +01:00
olly
a02237de20 Fix imports
PiperOrigin-RevId: 266676413
2019-09-01 22:03:52 +01:00
tonihei
6a1331f125 Gracefully handle chunkful preparation without chunks.
This situation happens if the first chunk to load is already behind the end
of the stream. In this case, the preparation never completes because
HlsSampleStreamWrapper gets stuck in a prepared=false and loadingFinished=true
state.

Gracefully handle this situation by attempting to load the last chunk if still
unprepared to ensure that track information is obtained as far as possible.
Otherwise, it wouldn't be possible to play anything even when seeking back.

Issue:#6314
PiperOrigin-RevId: 264599465
2019-08-23 17:02:10 +01:00
aquilescanta
f3a1b099e6 Fix propagation of HlsMetadataEntry's in HLS chunkless preparation
PiperOrigin-RevId: 263356275
2019-08-15 14:41:52 +01:00
aquilescanta
a572fb3f22 Add a metadata argument to Format factory methods used in HLS
Required for propagation of HlsMetadataEntry's in chunkless preparation.

PiperOrigin-RevId: 263324345
2019-08-15 14:41:51 +01:00
tonihei
389eca6e07 Merge robolectric_testutils into testutils.
We no longer need two modules as AndroidX-Test takes care of the system
abstraction and we no longer have Robolectric Handler/Looper workarounds.

PiperOrigin-RevId: 262363201
2019-08-09 18:36:32 +01:00
tonihei
58d4fd93dd Fix HLS module API nullability issues and add package-level non-null-by-default
PiperOrigin-RevId: 262124441
2019-08-09 18:34:18 +01:00
tonihei
17a9030e1d Update stale TrackSelections in chunk sources when keeping the streams.
If we keep streams in chunk sources after selecting new tracks, we also keep
a reference to a stale disabled TrackSelection object. Fix this by updating
the TrackSelection object when keeping the stream. The static part of the
selection (i.e. the subset of selected tracks) stays the same in all cases.

Issue:#6256
PiperOrigin-RevId: 261696082
2019-08-05 20:27:24 +01:00
olly
fb0481c520 Bump annotations dependency + update release notes
PiperOrigin-RevId: 261353271
2019-08-02 19:04:56 +01:00
olly
d77d661e52 Default viewport constraints to match primary display
PiperOrigin-RevId: 260479923
2019-07-29 21:27:46 +01:00
aquilescanta
2a8cf2f5ef Plumb DrmSessionManager into HlsMediaSource
PiperOrigin-RevId: 259520431
2019-07-23 23:16:33 +01:00
aquilescanta
3a53543a9a Move HLS DrmInitData adjustment to the writing side
+ Emulates what's done for ID3 stripping.
+ Also avoid a copy if fields will not change because of the
  copy.

PiperOrigin-RevId: 259369101
2019-07-23 23:15:54 +01:00
tonihei
c779e84cbb Switch language normalization to 2-letter language codes.
2-letter codes (ISO 639-1) are the standard Android normalization and thus we
should prefer them to 3-letter codes (although both are technically allowed
according the BCP47).

This helps in two ways:
 1. It simplifies app interaction with our normalized language codes as the
    Locale class makes it easy to convert a 2-letter to a 3-letter code but
    not the other way round.
 2. It better normalizes codes on API<21 where we previously had issues with
    language+country codes (see tests).
 3. It allows us to normalize both ISO 639-2/T and ISO 639-2/B codes to the same
    language.

PiperOrigin-RevId: 258729728
2019-07-18 14:15:50 +01:00
aquilescanta
bbcd46e98a Change HlsSampleStreamWrapper.prepareWithMasterPlaylistInfo to take a TrackGroup[]
Non-functional change. Makes it easier to add the ExoMediaCrypto type information
to the formats.

PiperOrigin-RevId: 257598282
2019-07-14 16:23:00 +01:00
bachinger
49a2e5a5cb add manifest to Timeline.Window
- Remove manifest argument from callbacks of Player.EventListener and
  SourceInfoRefreshListener. Instead make it accessible through
  Player.getCurrentManifest() and Timeline.Window.manifest.
- Fix all MediaSource implementation to include the manifest in the
  Timeline instead of passing it to the SourceInfoRefreshListener.
- Refactor ExoPlayerTestRunner, FakeTimeline, FakeMediaSource to
  reflect these changes and make tests pass.

PiperOrigin-RevId: 257359662
2019-07-14 16:20:45 +01:00
tonihei
2a765f6b5a Visibility clean-up: Don't extend visibility of protected methods in overrides.
PiperOrigin-RevId: 255412493
2019-07-02 17:46:30 +01:00
olly
b47f37fbcd Add HlsTrackMetadataEntry.toString
It's printed out by EventLogger, and currently looks pretty ugly

PiperOrigin-RevId: 250772010
2019-06-03 19:15:23 +01:00
eguven
00b26a51df Modify DashDownloaderTest to test if content length is stored
PiperOrigin-RevId: 250655481
2019-05-30 15:26:32 +01:00
olly
94d668567c Migrate org.mockito.Matchers#any* to org.mockito.ArgumentMatchers
The former is deprecated and replaced by the latter in Mockito 2. However, there is a
functional difference: ArgumentMatchers will reject `null` and check the type
if the matcher specified a type (e.g. `any(Class)` or `anyInt()`). `any()` will
remain to accept anything.

PiperOrigin-RevId: 250458607
2019-05-30 15:25:28 +01:00
aquilescanta
04f3888550 Add allowOnlyClearBuffers to SampleQueue#read
Removes the need for duplicate calls to SampleQueue#read when
implementing DecryptionResources acquisition in the MediaSources.

PiperOrigin-RevId: 250298175
2019-05-30 15:25:28 +01:00
olly
3afdd7ac5a Put @Nullable annotation in the right place
PiperOrigin-RevId: 249828748
2019-05-30 15:10:55 +01:00
olly
11c0c6d266 Reset upstream format when empty track selection happens
PiperOrigin-RevId: 249819080
2019-05-30 15:10:40 +01:00
tonihei
33c677846a Use versioned manifest in all Robolectric tests.
We are currently defaulting to targetSdk=1 as no targetSdk is specified. Only
tests which explicitly ask for another SDK use another test SDK. With the
versioned manifest, all tests run using the targetSDK by default.

PiperOrigin-RevId: 249060796
2019-05-21 13:51:43 +01:00
eguven
4ca670bed3 Use MediaSourceFactory interface to simplify DownloadHelper
PiperOrigin-RevId: 248367983
2019-05-15 20:13:59 +01:00
aquilescanta
cf389268b0 Add links to the developer guide in some READMEs
PiperOrigin-RevId: 248221982
2019-05-15 18:14:07 +01:00
tonihei
34dd4b1441 Fix NPE in HLS deriveAudioFormat.
Issue:#5868
PiperOrigin-RevId: 247613811
2019-05-15 18:10:07 +01:00