2466 Commits

Author SHA1 Message Date
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
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
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
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
olly
dbfc101e04 Remove no-op enabling of multi-session
PiperOrigin-RevId: 275856697
2019-10-30 08:47:21 +00:00
bachinger
3bb97f4bbf deliver player messages only once when at start position
ISSUE: #6550
PiperOrigin-RevId: 275842161
2019-10-30 08:47:13 +00:00
bachinger
e6e2dcc58d Rollback of 36f8bd78f7
*** Original commit ***

Rollback of 4ad4e3e4fc

*** Original commit ***

Rollback of 3b22db33ba

*** Original commit ***

add top-level playlist API to ExoPlayer

Public design doc:
https://docs.google.com/document/d/11...

***

PiperOrigin-RevId: 275813737
2019-10-30 08:46:42 +00:00
ibaker
93f2dd8deb Switch test usages of ConditionVariable#block(timeout) to CountDownLatch
ConditionVariable.block(timeout) doesn't work in Robolectric, because it
relies on the system clock which doesn't advance.

PiperOrigin-RevId: 275798281
2019-10-30 08:46:33 +00:00
samrobinson
694ccf424b Added an ICY header workaround for unseekable MP3 streams.
Issue:#6537
PiperOrigin-RevId: 275477266
2019-10-18 17:43:21 +01:00
andrewlewis
39d5f14343 Don't propagate empty supplemental data
PiperOrigin-RevId: 275425267
2019-10-18 17:42:35 +01:00
olly
701b013cdd Rollback of 9f0fd870e7
*** Original commit ***

Port Exo v1 work around for frame synchronization issue in KitKat to Exo v2.

***

PiperOrigin-RevId: 275372272
2019-10-18 17:42:27 +01:00
bachinger
0c0a67bb93 Fail at preparation when trying to download live content.
PiperOrigin-RevId: 275293735
2019-10-18 17:42:11 +01:00
bachinger
36f8bd78f7 Rollback of 4ad4e3e4fc
*** Original commit ***

Rollback of 3b22db33ba

*** Original commit ***

add top-level playlist API to ExoPlayer

Public design doc:
https://docs.google.com/document/d/11h0S91KI5TB3NNZUtsCzg0S7r6nyTnF_tDZZAtmY93g

Issue: #6161

***

***

PiperOrigin-RevId: 275276158
2019-10-18 17:42:03 +01:00
olly
d874656e8a Round impossible H264 resolutions up to valid values for capabilities check
If an odd resolution is impossible in the specification itself, then we know
that the caller is passing invalid data. Round up on the assumption it's a
rounding error so that playback can proceed.

Issue: #6551
PiperOrigin-RevId: 275226813
2019-10-17 11:52:50 +01:00
Oliver Woodman
23f545a0a4 Merge pull request #6528 from julioz:log-param
PiperOrigin-RevId: 275014741
2019-10-16 14:02:21 +01:00
samrobinson
841b3a8bc7 Add AUDIO_BECOMING_NOISY handling to SimpleExoPlayer.
Feature enabled through the SimpleExoPlayer.setHandleAudioBecomingNoisy.

PiperOrigin-RevId: 274988924
2019-10-16 14:02:11 +01:00
tonihei
03e3ceaedb Align PlaybackSuppressionReason java doc with method doc.
Same change as done in c49388aca2.

PiperOrigin-RevId: 274894288
2019-10-15 23:08:45 +01:00
ibaker
fc95d07a94 Remove HlsChunkSource from null-checking blacklist
PiperOrigin-RevId: 274789337
2019-10-15 23:08:00 +01:00
kimvde
a10fea30c9 Enable setOutputSurfaceWorkaround for some devices
The corresponding devices are Wiko FEVER l5460 and Huawei Honor 8X.

Issue:#6503
PiperOrigin-RevId: 274753710
2019-10-15 23:07:30 +01:00
olly
d36abf966e Fix broken Javadoc
PiperOrigin-RevId: 274564800
2019-10-14 14:18:49 +01:00
olly
c49388aca2 Clean up playback suppression
PiperOrigin-RevId: 274561876
2019-10-14 13:58:11 +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
olly
b71b9f7c58 Bump version to 2.10.6
PiperOrigin-RevId: 274534626
2019-10-14 13:57:41 +01:00
andrewlewis
d52f06e611 Clean up surface on setting renderer
If a surface was previously passed to the player then an output buffer
renderer was set, we would remove surface callbacks but not clear the
surface on renderers that accept MSG_SET_SURFACE.

PiperOrigin-RevId: 274532266
2019-10-14 13:57:33 +01:00
olly
ce01c79e01 Add a javadoc explanation for ProgressiveDownloader that explains that it tries to skip downloading already cached bytes.
download calls through to CacheUtil#cache, which handles skipping already downloaded bytes.

It is useful for callers to know that ProgressiveDownloader has this behavior - otherwise, they might reimplement the logic themselves.

I hope this behavior is something that can be part of the public API :)

PiperOrigin-RevId: 274202995
2019-10-13 12:41:55 +01:00
andrewlewis
1c66010b4a Add MediaFormat on video frame metadata listener
This is useful for apps that want to access HDR metadata that MediaCodec puts
in its output format.

PiperOrigin-RevId: 274169985
2019-10-13 12:41:47 +01:00
olly
4ae79105de Make FileDataSourceFactory an inner class
This is a proof of concept for cleanup we should do for all of
our DataSource implementations as we move toward stabilizing
parts of the API.

- Move all XDataSourceFactory classes to be inner classes.
- Remove chained constructors for XDataSourceFactory classes. Keep
  required args going through constructors. Use setters for the
  rest.
- Not applicable in this case, but we probably want to deprecate
  all but the no-arg method for instantiating eac XDataSource
  instance (with the all-arg method kept but with the intention
  of making it package private).

PiperOrigin-RevId: 274162076
2019-10-13 12:41:39 +01:00
olly
a268e1b63f Test audio focus denial
- Verifies that playWhenReady doesn't become true if audio focus
  is denied.
- Also verifies there's no suppression reason in this case, because
  the denial is permanent rather than temporary.

PiperOrigin-RevId: 274141099
2019-10-13 12:41:00 +01:00