5260 Commits

Author SHA1 Message Date
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
ibaker
412db2008b Propagate HTTP request headers through CacheDataSource
This has been broken since
c3d6be3afd
and broken for ICY (where I noticed the problem) since
5695bae9d8.
ICY symptom is that we see no repeated metadata, because the
Icy-MetaData:1 header doesn't make it to the server so we never get back
icy-metaint.

PiperOrigin-RevId: 285379234
2019-12-13 15:21:34 +00:00
tonihei
a39e6790c9 Fix bug where C.TIME_UNSET was used for calcutations.
The presentationTimeOffsetMs may be C.TIME_UNSET for VOD content
and shouldn't be used in calculations for the windowStartTime.

PiperOrigin-RevId: 285363095
2019-12-13 15:15:47 +00:00
kimvde
b9c9775745 Refactor sample number computation in FLAC seeking
Retrieve the sample number in the extractor instead of passing a holder
to FlacBinarySearchSeeker. This change makes the code easier to
understand and is required to implement the seeking from the seek table.

PiperOrigin-RevId: 285241862
2019-12-13 15:15:38 +00:00
olly
ae2449915d Create WavExtractor.OutputWriter to handle different data formats
- Create PcmOutputWriter for PCM.
- In a future change an ImaAdPcmOutputWriter will be introduced
  for IMA ADPCM support.

PiperOrigin-RevId: 285238246
2019-12-13 15:15:29 +00:00
olly
227b2242ed Remove assumption that WAV files only contain PCM encoded data
- WavHeader is now immutable and contains only values parsed out
  of the WAVE FMT chunk. It no longer contains a C.PcmEncoding
  encoding, or mutable data bounds.
- WavHeaderReader now parses the WAVE header chunks without any
  additional logic (e.g. validating the block alignment value,
  which is format type dependent).
- The SeekMap part of WavHeader is split out into WavSeekMap.

PiperOrigin-RevId: 285232498
2019-12-13 15:15:20 +00:00
tonihei
4faf303ca5 Add Player.getCurrentLiveOffset convenience method.
This returns the current offset to the live edge. The calculation is
non-intuitive enough to provide this convenience method.

PiperOrigin-RevId: 285171090
2019-12-13 15:15:11 +00:00
olly
0e1e4ad737 Remove MediaCodec.stop() call before MediaCodec.release()
This was verified as a no-op change in a prod experiment.

PiperOrigin-RevId: 285167972
2019-12-13 15:15:02 +00:00
ibaker
e8fa9a55a5 Make Cue final and change 2 subclasses to delegate-pattern
This avoids needing to jump through type paremeter hoops to create a
sub-classable Cue.Builder.

Cue should have a standard set of fields, because it will be
consumed by renderers that don't know what type it is. The
existing subclass fields are only used inside their respective
packages, so can be part of a wrapper object instead.

This lays the groundwork for converting Cue's multiple constructors
into a Builder pattern.

PiperOrigin-RevId: 284992135
2019-12-13 15:14:53 +00:00
olly
59083c9f1c Suppress rawtypes warning when instantiating generic array
Change FakeAdaptiveMediaPeriod back to this style for consistency.

PiperOrigin-RevId: 284967667
2019-12-11 13:46:39 +00:00
ibaker
a00e7dfed2 Remove nullness suppression that's no longer required
PiperOrigin-RevId: 284965120
2019-12-11 13:46:31 +00:00
olly
a97b09d799 Add WavHeader.samplesPerBlock (currently always == 1)
PiperOrigin-RevId: 284961417
2019-12-11 13:46:23 +00:00
kimvde
039ce8a95b Remove duplicated logic in FlacReader
PiperOrigin-RevId: 284952647
2019-12-11 13:46:15 +00:00
kimvde
a95c28a929 Implement binary search seeking for FLAC extractor
PiperOrigin-RevId: 284814594
2019-12-11 13:45:43 +00:00
samrobinson
65adcdaeb9 Fix an issue where a keyframe was not skipped.
Keyframe was rendered rather than skipped when performing
an exact seek to a non-zero position close to the start of
the stream.

PiperOrigin-RevId: 284798460
2019-12-11 13:45:35 +00:00
olly
bb466adb18 Add NonNull annotations to source.ads
PiperOrigin-RevId: 284787807
2019-12-11 13:45:19 +00:00
ibaker
c1573106fa Fix javadoc warnings exposed by -Xdoclint
PiperOrigin-RevId: 284776943
2019-12-11 13:45:03 +00:00
ibaker
614a92b607 Fix javadoc errors exposed by -Xdoclint
PiperOrigin-RevId: 284776790
2019-12-11 13:44:56 +00:00
olly
5cee5cba30 Add NonNull annotations to upstream
PiperOrigin-RevId: 284771928
2019-12-11 13:44:47 +00:00
olly
006418ab38 Fix bug removing entries from CacheFileMetadataIndex
Issue: #6621
PiperOrigin-RevId: 284743414
2019-12-10 12:37:50 +00:00
ibaker
9ec524a7e2 Rollback of 355ed11a3c
*** Original commit ***

Suppress warnings emitted by Checker Framework version 2.11.1

More information:
https://docs.google.com/document/d/16tpK6aXqN68PvTyvt4siM-m7f0NXi_8xEeitLDzr8xY/edit?usp=sharing

Tested:
    TAP --sample ran all affected tests and none failed
    http://test/OCL:278915274:BASE:278884711:1573074344615:a6701677

***

PiperOrigin-RevId: 284741721
2019-12-10 12:37:42 +00:00
ibaker
3233995441 Rollback of 4fd881a551
*** Original commit ***

Suppress warnings emitted by Checker Framework version 3.0.0

More information:
https://docs.google.com/document/d/16tpK6aXqN68PvTyvt4siM-m7f0NXi_8xEeitLDzr8xY/edit?usp=sharing
Tested:
    TAP --sample ran all affected tests and none failed
    http://test/OCL:279845168:BASE:279870402:1573537714395:80ca701c

***

PiperOrigin-RevId: 284740695
2019-12-10 12:37:34 +00:00
ibaker
4c4cabdfac (partial) Rollback of 880b879e8c
*** Original commit ***

Suppress warnings emitted by Checker Framework version 2.11.1

More information:
https://docs.google.com/document/d/16tpK6aXqN68PvTyvt4siM-m7f0NXi_8xEeitLDzr8xY/edit?usp=sharing

Tested:
    TAP train for global presubmit queue
    http://test/OCL:278152710:BASE:278144052:1572760370662:22459c12

***

PiperOrigin-RevId: 284738438
2019-12-10 12:37:26 +00:00
olly
90329a14c3 Make DefaultTimeBar exclude itself for gestures
Issue: #6685
PiperOrigin-RevId: 284736041
2019-12-10 12:37:18 +00:00
andrewlewis
c027b4e71a Turn on nullness checker for playback stats
The nullness checker complains about Integers with @IntDef annotations
so replace pairs with custom pair types for the timed event records in
PlaybackStats.

PiperOrigin-RevId: 284731834
2019-12-10 12:37:10 +00:00
kimvde
70ba4b197c Add peek() method to ExtractorInput
PiperOrigin-RevId: 284586799
2019-12-10 12:37:02 +00:00
olly
539a1ac2e2 Partial nullness annotations for AtomParsers
PiperOrigin-RevId: 284558886
2019-12-10 12:36:45 +00:00
samrobinson
4b281cec3b Clean WakeLockManager.updateWakeLock logic.
PiperOrigin-RevId: 284552723
2019-12-09 16:31:58 +00:00
olly
c90c10c981 Add NonNull annotations to upstream.cache and upstream.crypto
PiperOrigin-RevId: 284548019
2019-12-09 16:31:51 +00:00
olly
0b7f93a5d4 MatroskaExtractor: Support lacing in full blocks
Caveats:

- Block additional data is ignored if the block is laced
  and contains multiple samples. Note that this is not
  a loss of functionality (SimpleBlock cannot have block
  additional data, and lacing was previously completely
  unsupported for Block)

- Subrip and ASS samples are dropped if they're in laced
  blocks with multiple samples (I don't think this is
  valid anyway)

Issue: #3026
PiperOrigin-RevId: 284545197
2019-12-09 16:31:43 +00:00
olly
002acc680b MatroskaExtractor: Constrain use of sample state member variables
This change constrains the use of sample state member variables to
writeSampleData, finishWriteSampleData and resetWriteSampleData.
Using them elsewhere gets increasingly confusing when considering
features like lacing in full blocks. For example sampleBytesWritten
cannot be used when calling commitSampleToOutput in this case
because we need to write the sample data for multiple samples
before we commit any of them.

Issue: #3026
PiperOrigin-RevId: 284541942
2019-12-09 16:31:35 +00:00
olly
a9b327d932 Rollback of 2462aeb443
*** Original commit ***

Add peek() method to ExtractorInput

***

PiperOrigin-RevId: 284539719
2019-12-09 16:31:27 +00:00
christosts
3156fbfc6e Move MediaCodecAdapter out of MediaCodecRenderer
Move MediaCodeAdapter and implementations to separate
files and add unit tests for AsynchronousMediaCodecAdapter.

PiperOrigin-RevId: 284537185
2019-12-09 16:31:20 +00:00
kimvde
2462aeb443 Add peek() method to ExtractorInput
PiperOrigin-RevId: 284537150
2019-12-09 16:31:12 +00:00
kimvde
87ca7961c2 Remove TODO for supporting streams in Java FLAC extractor
Flac streams exist but are not commonly used. Also, they are not
supported by the FLAC extension extractor.

PiperOrigin-RevId: 284514327
2019-12-09 16:31:04 +00:00
bachinger
74faa3aa9f rename setMediaItem to setMediaSource
PiperOrigin-RevId: 284514142
2019-12-09 16:30:56 +00:00
olly
8b3c3ffb91 Fix Javadoc issues
PiperOrigin-RevId: 284509437
2019-12-09 16:30:48 +00:00
olly
45013ece1e Add unit test for MatroskaExtractor full Block
The existing sample uses SimpleBlock

PiperOrigin-RevId: 284195590
2019-12-06 19:21:39 +00:00
olly
d73af0247b Suppress warnings emitted by Checker Framework version 3.0.1
More information:
https://docs.google.com/document/d/16tpK6aXqN68PvTyvt4siM-m7f0NXi_8xEeitLDzr8xY/edit?usp=sharing

Tested:
    TAP train for global presubmit queue
    http://test/OCL:284110051:BASE:284105515:1575631294184:2673a9f9
PiperOrigin-RevId: 284186732
2019-12-06 19:21:31 +00:00
bachinger
a705480b5d remove flakiness of testSeekTo_windowIndexIsReset
PiperOrigin-RevId: 284180332
2019-12-06 19:21:24 +00:00
kimvde
d0508b2bde Make metadata field nullable in FlacStreamMetadata
This makes the format metadata null (instead of an empty Metadata
object) when it is not provided, and is therefore consistent with the
other extractors behavior.

PiperOrigin-RevId: 284171148
2019-12-06 19:21:16 +00:00
andrewlewis
4ad6d9d85c Don't overwrite MP4 container fps using capture fps
The capture frame rate is currently available both via Format.metadata
and decoded in Format.frameRate. As the container Format.frameRate may
be useful to apps, only store the capture frame rate in metadata (apps
will need to decode it but can now access the container frame rate too).

PiperOrigin-RevId: 284165711
2019-12-06 19:21:08 +00:00