380 Commits

Author SHA1 Message Date
ibaker
79b7af656b Rollback of <unknown commit>
*** Original commit ***

Disable test coverage again

https://issuetracker.google.com/issues/37019591 causes local variables can't be found while debugging.

***

PiperOrigin-RevId: 280666758
2019-11-17 00:33:26 +00:00
andrewlewis
fbea71b0fe Fix detection of Dolby Atmos in HLS
E-AC3 with JOC is signaled using the CHANNELS attribute for HLS:
https://developer.apple.com/documentation/http_live_streaming/hls_authoring_specification_for_apple_devices/hls_authoring_specification_for_apple_devices_appendices

PiperOrigin-RevId: 277680300
2019-11-05 16:13:41 +00:00
tonihei
0c63362258 Add @Documented and JavaDoc to HlsMetadataType.
PiperOrigin-RevId: 277519718
2019-11-05 16:13:02 +00:00
ibaker
817772fcbd Add uncontroversial HLS nullness annotations
This helps get HlsMediaPeriod off the blacklist.

PiperOrigin-RevId: 277076633
2019-10-30 08:51:20 +00:00
ibaker
87c30c0ba8 Change HlsPlaylistParser.LineIterator#next()
Update it to throw if hasNext() is false, to match Java's Iterator
interface.

This also simplifies the null-checking annotations required

PiperOrigin-RevId: 277059766
2019-10-30 08:51:12 +00:00
aquilescanta
b68a698806 Make SampleQueue populate FormatHolder.drmSession
Also add unit tests for SampleQueue read for samples with
DRM requirements.

PiperOrigin-RevId: 277037826
2019-10-30 08:50:34 +00:00
ibaker
ac722a7a68 Remove HlsPlaylistParser from null-checking blacklist
PiperOrigin-RevId: 276671167
2019-10-30 08:49:55 +00:00
ibaker
3e6fe45885 Add test for FullSegmentEncryptionKeyCache
Pull it into a top-level package private class at the same time

As suggested in 0ba91811d1

PiperOrigin-RevId: 275870515
2019-10-30 08:47:44 +00:00
ibaker
3101a5df58 Tweak null-handling of trackGroupToSampleQueueIndex in HlsSampleStreamWrapper
PiperOrigin-RevId: 275814023
2019-10-30 08:46:58 +00:00
ibaker
e43658af1f Switch back from method ref to Runnable in HlsSampleStreamWrapper
This reverts a81dea6a47 and adds in the necessary nullness annotations

After a discussion that this:: method references allocate on every call:
https://dzone.com/articles/passing-thismethod-reference-within-a-loop-affects

PiperOrigin-RevId: 275813989
2019-10-30 08:46:50 +00:00
ibaker
b7f335c715 Remove HlsSampleStreamWrapper from the null checking blacklist
PiperOrigin-RevId: 275440589
2019-10-18 17:43:13 +01:00
ibaker
1317851535 Remove HLS WebVttExtractor from null-checking blacklist
The null-checker wasn't clever enough to understand the while-loop was safe
so I switched it to a for.

PiperOrigin-RevId: 275440464
2019-10-18 17:43:06 +01:00
tonihei
16a6946f3e Replace @MonotonicNonNull with @Nullable for final variables.
@MonotonicNonNull is not useful if the variable is final, because it's only
assigned once and guaranteed to keep it's current nullability in the same
way as @MonotonicNonNull ensures it's kept non-null after checking.

This way, the workarounds can also be removed.

PiperOrigin-RevId: 275428656
2019-10-18 17:42:43 +01:00
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