691 Commits

Author SHA1 Message Date
olly
775a17c498 Split SampleQueue.advanceTo for advance & seek use cases
This method has two use cases:

1. Seeking. Calls are immediately preceded by a call to rewind(), and
   the returned value isn't important unless it's ADVANCED_FAILED (i.e.
   the caller is only interested in success and failure).
2. Advancing. The return value is important unless it's ADVANCED_FAILED,
   in which case the caller wants to treat it as 0.

This change creates separate methods for each use case. The new seekTo
methods automatically rewind and return a boolean. The updated advanceTo
method returns 0 directly in cases where ADVANCED_FAILED was returned.
Arguments that were always hard-coded to true by callers have also been
removed.

This change is a step toward one possible solution for #6155. How we'll
solve that issue is still up for discussion, but this change seems like
one we should make regardless!

Issue: #6155
PiperOrigin-RevId: 290053743
2020-01-16 20:35:04 +00:00
olly
a225e887fa Move @MonotonicNonNull annotations to their correct positions
PiperOrigin-RevId: 289823804
2020-01-16 13:51:09 +00:00
aquilescanta
7f7632a38f Split HlsSampleStreamWrapper.init into two methods
As a result, onMediaChunkLoadStarted gets invoked on the loading thread, and
init on the playback thread, matching the thread access comments.

Issue:#6321
PiperOrigin-RevId: 289167981
2020-01-13 19:57:19 +00:00
ibaker
ed1de000e5 Unwrap all nested IntDef values
This seems to work with R8 but interact badly with ProGuard.

issue:#6771
PiperOrigin-RevId: 286215262
2019-12-18 18:54:44 +00:00
tonihei
021291b38f Add server-client time offset to Window.
This offset allows to improve the calculated live offset because it
can take known client-server time offsets into account.

PiperOrigin-RevId: 285970738
2019-12-18 18:52:11 +00:00
aquilescanta
61c43c30ac Make DownloadHelper pass DrmSessionManager to MediaSources
PiperOrigin-RevId: 283795201
2019-12-05 10:20:32 +00:00
Steve Mayhew
6ef5dc08b7 Remove unused methods, comment cleanup. 2019-12-04 11:16:42 -08:00
Steve Mayhew
a8755b5c25 Update to save all sample queue write indexes
Finailzed logic to update the `SampleQueue` write positions (first index) to push these into `HlsMediaChunk` when the track is initially created (from the Extractor output) and as each new chunk is queued to load (`init()` callback).

Add lots of debuging prints that can come out for the final merge.

Code is very close to a clone of `ChunkSampleStream`.
2019-12-04 11:16:42 -08:00
Steve Mayhew
57d5160161 add support SequenceableLoader.reevaluateBuffer() for HLS
DASH implements this feature, extend the feature for HLS as well.  First change just drops video samples.
For demuxed audio the audio samples will continue to play out to match the
dropped video, so need to keep indexes in all the sample queues related to a chunk and discard them all.
2019-12-04 10:58:13 -08:00
olly
14cfb8039f Use peak rather than average bitrate for HLS
This is a minor change ahead of merging a full variant of
https://github.com/google/ExoPlayer/pull/6706, to make
re-buffers less likely.

Also remove variable substitution when parsing
AVERAGE-BANDWIDTH (it's not required for integer attributes)

PiperOrigin-RevId: 283554106
2019-12-04 10:00:17 +00:00
tonihei
65c4a58825 Use Util method to create Handler instead of using deprecated method.
Calls to new Handler() without arguments are deprecated as of the latest Android
version. Replace them by a Util.createHandler call similar to the ones we
already have.

PiperOrigin-RevId: 283532891
2019-12-04 09:59:44 +00:00
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