5074 Commits

Author SHA1 Message Date
ibaker
b972fd1f27 Remove WebvttCue from null-checking blacklist
PiperOrigin-RevId: 277910909
2019-11-05 16:15:45 +00:00
kimvde
ab2bfcc1b9 Fix typo in WavHeader class
PiperOrigin-RevId: 277910360
2019-11-05 16:15:37 +00:00
andrewlewis
656556b828 Clean up naming for GLSurfaceViews
PiperOrigin-RevId: 277896757
2019-11-05 16:15:29 +00:00
kimvde
242a0053c9 Add method to read more than 32 bits in ParsableBitArray
PiperOrigin-RevId: 277766372
2019-11-05 16:15:22 +00:00
kimvde
32dcd80b4a Improve ParsableBitArray unit tests
PiperOrigin-RevId: 277744735
2019-11-05 16:15:14 +00:00
olly
f55083ab48 Minor DRM documentation tweaks
PiperOrigin-RevId: 277729887
2019-11-05 16:14:59 +00:00
ibaker
f554dc4ea4 Increase 2 timeouts to reduce test flakiness
PiperOrigin-RevId: 277710160
2019-11-05 16:14:51 +00:00
olly
d596fcd9ba Remove unnecessary warning suppressions
PiperOrigin-RevId: 277709114
2019-11-05 16:14:39 +00:00
ibaker
a7b242998a Fix subtitle parsing regex suggestions
Suggested by Android Studio's Inspect Code

SO seems to think there's a performance difference for the | change:
https://stackoverflow.com/questions/22132450/why-is-a-character-class-faster-than-alternation

PiperOrigin-RevId: 277707341
2019-11-05 16:14:30 +00:00
tonihei
f960f8a575 Forward suppression state to new playback stats sessions.
The value is stateful and new sessions need to be informed of the current state

PiperOrigin-RevId: 277701955
2019-11-05 16:14:11 +00:00
bachinger
01a4cf98d5 add default methods isSingleWindow and getInitialTimeline to MediaSource interface
PiperOrigin-RevId: 277695826
2019-11-05 16:14:03 +00:00
aquilescanta
df251ad1be Add tests for SampleQueue isReady
PiperOrigin-RevId: 277691935
2019-11-05 16:13:56 +00:00
aquilescanta
2d530478ee Make FormatHolder be entirely populated by SampleMetadataQueue
This should not introduce any functional changes.

PiperOrigin-RevId: 277691550
2019-11-05 16:13:48 +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
ibaker
f5377d9b11 Encode WebVTT size computation in WebvttCue.java
Relevant part of the spec:
https://www.w3.org/TR/webvtt1/#processing-cue-settings

PiperOrigin-RevId: 277523694
2019-11-05 16:13:25 +00:00
ibaker
d29d452617 Switch (Mp4)WebvttDecoderTest to use Truth's Expect
This means multiple failures are all logged, instead of the test
stopping when the first assertion fails. Makes tests like this with
lots of independent assertions much easier to work with.

I limited the expect to a single assertCues() call, otherwise
the error message gets very long and is hard to read, but I
still think this is an improvement.

PiperOrigin-RevId: 277523300
2019-11-05 16:13:18 +00:00
ibaker
b3f94e3768 Update WebvttCue to use defaults from the spec
Cue's UNSET and null values should be used when the source data
doesn't specify *and* the spec doesn't provide a clear default.
In the WebVTT case, the defaults are clear, so we use them
explicitly.

PiperOrigin-RevId: 277522899
2019-11-05 16:13:10 +00:00
tonihei
0c63362258 Add @Documented and JavaDoc to HlsMetadataType.
PiperOrigin-RevId: 277519718
2019-11-05 16:13:02 +00:00
aquilescanta
18e1c3eb1c Rename the option allowPlaceholderSessions to preferSecureDecoders
PiperOrigin-RevId: 277477784
2019-11-05 16:12:46 +00:00
andrewlewis
aeefb79a86 Fix MediaCodecUtil nullability annotations
PiperOrigin-RevId: 277462799
2019-11-05 16:12:38 +00:00
andrewlewis
d3933e5cac Recreate Opus decoder for stream change
The framework opus decoder discards some samples after a call to
flush(). Because we flush a decoder that is being retained across an
input format change, this means that the start of audio gets truncated
when transitioning to a new opus stream. See also
https://android.googlesource.com/platform/frameworks/av/+/refs/heads/android10-release/media/libstagefright/codecs/opus/dec/SoftOpus.cpp.

Avoid this by recreating opus decoders instead of flushing them. It
seems fine to do this for all opus decoders as reinitialization should
be cheap, OEM-provided implementations may also discard samples and
playback shouldn't be interrupted on reinitialization due to the
downstream AudioTrack buffer.

PiperOrigin-RevId: 277458759
2019-10-30 08:52:05 +00:00
ibaker
e922f83401 Change nested ternary to switch in SubtitlePainter
The nested ternary is quite hard to read imo, and I believe this is a
no-op change that captures the intent more clearly.

PiperOrigin-RevId: 277320461
2019-10-30 08:51:57 +00:00
aquilescanta
8138424d92 Replace usages of SampleQueue.hasNextSample with isReady
PiperOrigin-RevId: 277259448
2019-10-30 08:51:42 +00:00
aquilescanta
81b8396b3e Move peek result constants into SampleMetadataQueue
PiperOrigin-RevId: 277253308
2019-10-30 08:51:27 +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
9eb93a35c0 Fix a bunch of typos
PiperOrigin-RevId: 277056574
2019-10-30 08:50:57 +00:00
ibaker
7277df3547 Remove @NonNull where it's implied by @NonNullApi
Also remove it from all tests, these aren't covered by the null-checker

Covered by the following package-info.java files:
- j/c/g/a/exoplayer2/ext/mediasession/package-info.java
- j/c/g/a/exoplayer2/package-info.java
- j/c/g/a/exoplayer2/offline/package-info.java
- j/c/g/a/exoplayer2/video/package-info.java
- j/c/g/a/exoplayer2/ui/package-info.java

PiperOrigin-RevId: 277038916
2019-10-30 08:50:42 +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
samrobinson
e025371429 Fix memory leak and calling listener when disabled in AudioBecomingNoisyManager.
PiperOrigin-RevId: 277030401
2019-10-30 08:50:26 +00:00
samrobinson
ff82a13279 Add player release check to enabling audio focus & audio becoming noisy handling.
PiperOrigin-RevId: 276679790
2019-10-30 08:50:18 +00:00
ibaker
719a704dee Rollback of 665627c384
*** Original commit ***

Rollback of bf01ff0f60

*** Original commit ***

Use Float.NaN for Cue#DIMEN_UNSET

Float.MIN_VALUE is very close to zero:
"A constant holding the smallest positive nonzero value of type float"
https://developer.android.com/reference/java/lang/Float.html#MIN_VALUE

Float.NaN more clearly conveys this is an invalid number,
and will also more clearly carry over if we do maths on it a...

***

PiperOrigin-RevId: 276674142
2019-10-30 08:50:10 +00:00
samrobinson
ea77defd38 Clarify naming & comments for distinction between Format and MediaFormat.
PiperOrigin-RevId: 276673410
2019-10-30 08:50:03 +00:00
ibaker
ac722a7a68 Remove HlsPlaylistParser from null-checking blacklist
PiperOrigin-RevId: 276671167
2019-10-30 08:49:55 +00:00
aquilescanta
620b9110bf Document error handling in the Extractor interface
PiperOrigin-RevId: 276660235
2019-10-30 08:49:47 +00:00
samrobinson
bcf46431dd Verify application thread when setting handle audio becoming noisy.
PiperOrigin-RevId: 276491102
2019-10-30 08:49:32 +00:00
ibaker
d898122ec5 Mark WebvttCue constructors private
Everyone should use the Builder.

PiperOrigin-RevId: 276468354
2019-10-30 08:49:24 +00:00
samrobinson
b99203dada Post AudioFocusManager.onAudioFocusChange events to eventHandler.
PiperOrigin-RevId: 276452333
2019-10-30 08:49:09 +00:00
ibaker
3a84b787b1 Add missing IntDef annotations in WebvttDecoderTest
Also change the type of endTime to long to match startTime

PiperOrigin-RevId: 276448131
2019-10-30 08:49:01 +00:00
tonihei
881fcf829a Add some missing @Nullable to Format
PiperOrigin-RevId: 276366002
2019-10-30 08:48:53 +00:00
olly
665627c384 Rollback of bf01ff0f60
*** Original commit ***

Use Float.NaN for Cue#DIMEN_UNSET

Float.MIN_VALUE is very close to zero:
"A constant holding the smallest positive nonzero value of type float"
https://developer.android.com/reference/java/lang/Float.html#MIN_VALUE

Float.NaN more clearly conveys this is an invalid number,
and will also more clearly carry over if we do maths on it accidentally.

***

PiperOrigin-RevId: 276315786
2019-10-30 08:48:45 +00:00
ibaker
bf01ff0f60 Use Float.NaN for Cue#DIMEN_UNSET
Float.MIN_VALUE is very close to zero:
"A constant holding the smallest positive nonzero value of type float"
https://developer.android.com/reference/java/lang/Float.html#MIN_VALUE

Float.NaN more clearly conveys this is an invalid number,
and will also more clearly carry over if we do maths on it accidentally.

PiperOrigin-RevId: 276277784
2019-10-30 08:48:38 +00:00
samrobinson
2cf98ecffe Posts AudioBecomingNoisyManager listener events to eventHandler.
PiperOrigin-RevId: 276084113
2019-10-30 08:48:30 +00:00
ibaker
dbbbcab6cb Add assertWithMessage calls to WebvttDecoderTest
With lots of int comparisons close together, this makes the error
messages much clearer and saves having to manually match up line
numbers.

Also make every @Test just throw Exception

PiperOrigin-RevId: 276079806
2019-10-30 08:48:23 +00:00
samrobinson
82d3e1e8ab Rename format to mediaFormat for clarity.
PiperOrigin-RevId: 276036585
2019-10-30 08:48:15 +00:00
ibaker
62e3ac3e9e Update parseStbl to handle edit lists & gapless info
Without this, a subtitle track empty edit list used to offset the start of
subtitles is ignored.

Also the current code seems to depend on the order in which
we parse the tracks (audio first means we have gapless info when we parse
video track, while video first we wouldn't).

It's not clear why we can't handle both edit lists & gapless info

PiperOrigin-RevId: 276029744
2019-10-30 08:48:00 +00:00
andrewlewis
51e4f7b260 Fix supplemental data handling with dropped frames
PiperOrigin-RevId: 276024935
2019-10-30 08:47:52 +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
olly
c139281119 Update translations
PiperOrigin-RevId: 275869409
2019-10-30 08:47:36 +00:00
olly
dbfc101e04 Remove no-op enabling of multi-session
PiperOrigin-RevId: 275856697
2019-10-30 08:47:21 +00:00