7867 Commits

Author SHA1 Message Date
olly
453bd39274 Fix typo in class name
PiperOrigin-RevId: 286225012
2019-12-19 14:43:09 +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
olly
8b0f5b0a86 Some nullness cleanup for extractor.ogg
PiperOrigin-RevId: 286203692
2019-12-18 18:54:36 +00:00
olly
e8068f0fcb Add omitted release note for 2.11
PiperOrigin-RevId: 286201458
2019-12-18 18:54:28 +00:00
ibaker
65e84811ff Add 'Us' suffix to WebvttCueInfo.{start,end}Time
Clarify that the units used here are microseconds

PiperOrigin-RevId: 286200583
2019-12-18 18:54:20 +00:00
ibaker
8cf4042ddd Move WebvttCueInfo.Builder inside WebvttCueParser
This class is only used to hold temporary data while we parse the
settings and text, so we don't need it outside the Parser class.

Also remove all state from WebvttCueParser - this increases
the number of allocations, but there are already many
and  subtitles generally aren't very frequent (compared to
e.g. video frames).

PiperOrigin-RevId: 286200002
2019-12-18 18:54:11 +00:00
olly
a8d39c1180 Read arrays directly from Parcel
PiperOrigin-RevId: 286197990
2019-12-18 18:54:04 +00:00
olly
821d4fb13a Add NonNull at package level for extractor.mp4
PiperOrigin-RevId: 286191078
2019-12-18 18:53:56 +00:00
olly
7a03e8edc0 Add NonNull to testutil.truth
PiperOrigin-RevId: 286185549
2019-12-18 18:53:48 +00:00
christosts
fde59ccd1a Formatting fixes on MediaCodecAdapter
Fixes JavaDoc on MediaCodecAdapter and AsynchronousMediaCodecAdapter
and a field declaration on MediaCodecRenderer.

PiperOrigin-RevId: 286157106
2019-12-18 18:53:40 +00:00
andrewlewis
6c9357ba2f Fix keep rule for VideoDecoderOutputBuffer
PiperOrigin-RevId: 286156361
2019-12-18 18:53:32 +00:00
olly
7219e5a314 Fix nullness annotation on equals methods
PiperOrigin-RevId: 286154938
2019-12-18 18:53:24 +00:00
andrewlewis
9d8a1635c2 Ensure raw resources are kept
R8 does constant folding, so we need to keep buildRawResourceUri
to ensure that resources passed to it are kept.

PiperOrigin-RevId: 286153875
2019-12-18 18:53:16 +00:00
krocard
c111138ac2 Parse MP3 header to retrieve the nb of sample per frames
Add support for MP3 as an encoding format for passthrough.

This change does not change the observable
behavior of Exoplayer.

Also name the magics.

#exo-offload

PiperOrigin-RevId: 286146539
2019-12-18 18:53:08 +00:00
olly
3c56b113e4 Rollback of d48dc4c159
*** Original commit ***

Move getting-stuck-prevention into DefaultLoadControl.

We recently added code that prevents getting stuck if the buffer is low and
the LoadControl refuses to continue loading (b84bde0252).

Move this logic into DefaultLoadControl to keep the workaround, and also apply the
maximum buffer size check in bytes if enabled. ExoPlayerImplInternal will now
throw if a LoadControl lets playback get stuck. This includes the case where
DefaultLoadControl reaches its maximum buffer size and not even a mim...

***

PiperOrigin-RevId: 286071115
2019-12-18 18:52:59 +00:00
bachinger
36fa9d5a43 add top-level playlist API
Design doc: https://docs.google.com/document/d/11h0S91KI5TB3NNZUtsCzg0S7r6nyTnF_tDZZAtmY93g/edit

Issue: #6161, #5155
PiperOrigin-RevId: 286020313
2019-12-18 18:52:51 +00:00
christosts
43bbc172a4 DefaultRenderersFactory can set MediaCodecOperation
Add experimental method on DefaultRenderersFactory to set the
MediaCodecOperationMode on MediaCodecRenderer instances.

PiperOrigin-RevId: 286004667
2019-12-18 18:52:43 +00:00
ibaker
863bf45341 Suppress ProGuard warnings about javax.annotation
These annotations are compile-only - so we don't mind they're not
accessible at runtime.

PiperOrigin-RevId: 285993063
2019-12-18 18:52:35 +00:00
olly
7a4b35b59f Retain AV1 constructor for DefaultRenderersFactory
Issue: #6773
PiperOrigin-RevId: 285990377
2019-12-18 18:52:27 +00:00
tonihei
d48dc4c159 Move getting-stuck-prevention into DefaultLoadControl.
We recently added code that prevents getting stuck if the buffer is low and
the LoadControl refuses to continue loading (b84bde0252).

Move this logic into DefaultLoadControl to keep the workaround, and also apply the
maximum buffer size check in bytes if enabled. ExoPlayerImplInternal will now
throw if a LoadControl lets playback get stuck. This includes the case where
DefaultLoadControl reaches its maximum buffer size and not even a mimimal buffer
duration.

PiperOrigin-RevId: 285979989
2019-12-18 18:52:19 +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
ibaker
a035c2e20a Reformat some javadoc on Cue
PiperOrigin-RevId: 285964228
2019-12-18 18:52:03 +00:00
olly
dfc15733d2 Add NonNull annotations to the most extractor packages
PiperOrigin-RevId: 285961788
2019-12-18 18:51:55 +00:00
ibaker
f10bc37831 Migrate usages of Cue's bitmap constructor to Cue.Builder
PiperOrigin-RevId: 285956436
2019-12-18 18:51:47 +00:00
ibaker
04b1782a53 Add a Cue.Builder
I want to add fields related to vertical text support, and neither
adding another constructor nor updating all call-sites of existing
constructors seemed like attractive propositions.

PiperOrigin-RevId: 285956024
2019-12-18 18:51:39 +00:00
olly
fdfbfc0b8e Cleanup codec state reset methods in MediaCodecRenderer
- Remove duplicated null assignments
- Move mediaCryptoRequiresSecureDecoder reset to be with all the
  other mediaCrypto stuff.

PiperOrigin-RevId: 285955134
2019-12-18 18:51:31 +00:00
christosts
bf6e9c6144 Add MultiLockAsyncMediaCodecAdapter
MultiLockAsyncMediaCodecAdapter is an implementation of the
MediaCodecAdapter that uses multiple locks to synchronize access to its
data compared to the single-lock approach used in
DedicatedThreadAsyncMediaCodecAdapter.

PiperOrigin-RevId: 285944702
2019-12-18 18:51:23 +00:00
kimvde
fcfc4eb5b6 Add FlacExtractorSeekTest
PiperOrigin-RevId: 285823771
2019-12-18 18:51:15 +00:00
kimvde
21e00ffe73 Fix FlacExtractor construction
Fix the FlacExtractor constructor for the case where seek(0,0) is not called before reading.

PiperOrigin-RevId: 285811161
2019-12-18 18:51:07 +00:00
kimvde
3e4baa101c Implement seeking from seektable in FLAC extractor
PiperOrigin-RevId: 285799995
2019-12-18 18:51:00 +00:00
olly
2fe3e188a9 FakeTrackOutput: Throw if sample size exceeds maxInputSize
This indicates the extractor has output a Format with a specified
maxInputSize that's too small. Failing in FakeTrackOutput ensures
this doesn't happen during Extractor tests.

PiperOrigin-RevId: 285776069
2019-12-18 18:50:52 +00:00
olly
4eb06373b1 Manual rollback of b3f485d7d9
It's technically possible to output a seekable SeekMap with unknown duration. This can occur if the media defines seek points but doesn't define either the overall duration or the duration of the media from the last seek point to the end.

PiperOrigin-RevId: 285769121
2019-12-18 18:50:44 +00:00
olly
214c62c35e Clean up WavExtractor PCM output
- Make extractor output samples that are uniformly distributed
  with respect to time, with a target of ~10 samples per second.
  The old approach could in theory put every frame into its own
  sample, which would be very inefficient downstream because we'd
  need to pass them individually to MediaCodec. It could also put
  data corresponding to a long duration of time into a single
  sample (e.g. if the sample rate of the content is low), which
  is bad downstream because we decide whether to set the decodeOnly
  flag on a per sample basis. More generally, the new approach
  is more predictable :).

- Stop using the WavSeekMap to get sample timestamps, and instead
  calculate them directly from the number of frames output. It's
  more obviously correct, particularly for data formats like IMA
  ADPCM where we'll need to adjust the data prior to output.

PiperOrigin-RevId: 285750010
2019-12-18 18:50:36 +00:00
olly
53ec532a0e Add more SeekMap assertions, and "fix" MatroskaExtractor
In MatroskaExtractor, if the last cue time exceeds the duration
specified in the header, then we end up generating a negative
duration chunk as the last item in the SeekMap. We should probably
not do this, so drop it instead.

Note: Matroska does have a CueDuration element, but it's not used
in the one problematic file I've found.
PiperOrigin-RevId: 285738418
2019-12-18 18:50:28 +00:00
tonihei
6512e320fb Simplfify codec state reset methods in MediaCodecRenderer
Currently, resetting the internal state related to the codec in done in 4 places
in MediaCodecRenderer:
 1. In the constructor to set some sensible initial default.
 2. In flushOrReleaseCodec to reset state after flushing
 3. In releaseCodec to reset state to default values for a released codec.
 4. In initCodec to reset state to defaul values for a new codec.

There are actuall only two types of state reset operations:
 1. Resetting state for a released codec, so that a new codec isn't influenced by
    previous codecs.
 2. Resetting state after flushing an existing codec. This is a subset of (1).

So to simplify the class, this change moves all state resets to two methods
corresponding to the two cases above.

PiperOrigin-RevId: 285731913
2019-12-18 18:50:20 +00:00
ibaker
23bb289237 Remove some direct test dependencies from core's build.gradle
These are transitively provided by testutil's build.gradle.

This makes the core module consistent with the others like ui, hls, dash

PiperOrigin-RevId: 285729566
2019-12-18 18:50:12 +00:00
ibaker
15bd622ba7 Remove unused version numbers from constants.gradle
These aren't used from any other Gradle files

PiperOrigin-RevId: 285723602
2019-12-18 18:50:04 +00:00
andrewlewis
91c86ecec1 Fix ParameterName warnings in core tests
PiperOrigin-RevId: 285716982
2019-12-18 18:49:56 +00:00
olly
8bafd6ff7d Fix FLAC seeking when the last seek point is a placeholder
PiperOrigin-RevId: 285449865
2019-12-18 18:49:48 +00:00
olly
b3f485d7d9 Add an additional sanity check to FakeExtractorOutput
PiperOrigin-RevId: 285422885
2019-12-18 18:49:41 +00:00
olly
b7b3a15855 Make it easier to update extractor test dump files
PiperOrigin-RevId: 285407744
2019-12-18 18:49:25 +00:00
olly
2c467f79bd Rename getPhysicalDisplaySize to getCurrentDisplayModeSize
PiperOrigin-RevId: 285405910
2019-12-18 18:49:17 +00:00
andrewlewis
d099db6957 Fix formatting in Player.java
This is in preparation for adding an internal-only change near these
lines.

PiperOrigin-RevId: 285403671
2019-12-18 18:49:09 +00:00
tonihei
71036a6973 Ignore throttled network requests in DefaultBandwidthMeter.
These are not useful for estimating the network speed and should be
ignored.

PiperOrigin-RevId: 285400948
2019-12-18 18:49:00 +00:00
christosts
2edf985797 Add DedicatedThreadAsyncMediaCodecAdapter
The DedicatedThreadAsyncMediaCodecAdapter is an
asynchronous MediaCodecAdapter that routes callback
to a separate Thread.

PiperOrigin-RevId: 285397368
2019-12-18 18:48:52 +00:00
tonihei
00eab44455 Add flag to DataSpec that allows to indicate throttled transfer speed.
This may happen for example when trying to load unfinished live media
chunks that can only be loaded at real-time playback speed.

The flag can be used by the sources to indicate that network transfer
will knowingly be throttled, such that transfer listeners like the
bandwidth meter can take this information into account.

PiperOrigin-RevId: 285397100
2019-12-18 18:48:43 +00:00
ibaker
cad3b1830e Add ISO-8859-1 awareness to IcyDecoder
Also change IcyInfo.rawMetatadata from String to byte[]

ICY doesn't specify the character encoding, and there are streams
not using UTF-8 (issue:#6753). It seems the default of at least one
server is ISO-8859-1 so let's support that as a fallback:
https://github.com/savonet/liquidsoap/issues/411#issuecomment-288759200

Also update IcyDecoder to skip strings it doesn't recognise at all
instead of decoding invalid characters.

The feed from issue:#6753 now decodes accents correctly:
EventLogger:   ICY: title="D Pai - Le temps de la rentrée", url="null"
PiperOrigin-RevId: 285388522
2019-12-13 15:22:39 +00:00
ibaker
38e9213a9d Use SpannedSubject in WebvttCueParserTest
This is a useful test to see if it works well in a real situation.

PiperOrigin-RevId: 285386471
2019-12-13 15:22:39 +00:00
tonihei
1ddac0c703 Remove API version dependency of Util.normalizeLanguageCode
We previously used Locale.fromLanguageTag and then toLanguageTag to automatically
filter out invalid tags and to replace deprecated tags. However, this only works
for API 21+.

This change does no longer rely on the platform methods and instead:
 1. Keeps invalid tags as they are. This may help if developers rely on
    non-spec-complaint language tags (for example, #6681).
 2. Adds a list of deprcated tags and their modern replacements to our code
 3. Normalizes some short codes that have been superseded by macrolanguage codes by
    their macrolanguage equivalent.

Issue:#6681
PiperOrigin-RevId: 285384841
2019-12-13 15:22:39 +00:00
ibaker
241a3426d3 Tighten the documentation of MetadataInputDecoder
Document that limit() is respected, but position() and arrayOffset()
are assumed to be zero.

PiperOrigin-RevId: 285384613
2019-12-13 15:22:39 +00:00