2644 Commits

Author SHA1 Message Date
olly
1f85cd9afe Remove WavExtractor from the nullness blacklist
PiperOrigin-RevId: 288292488
2020-01-17 13:54:33 +00:00
tonihei
d609c3b666 Support 5G in network type detection
PiperOrigin-RevId: 288280500
2020-01-17 13:54:27 +00:00
ibaker
63eaf1144c Fix MatroskaExtractor to use blockDurationUs not durationUs
This typo was introduced in ddb70d96ad
when migrating a static method with parameter `durationUs` to an
instance method where the correct field to use was `blockDurationUs`
(but `durationUs` also exists).

The test that catches this was only added in 45013ece1e (and
therefore configured with the wrong expected output data).

issue:#6833
PiperOrigin-RevId: 288274197
2020-01-17 13:53:43 +00:00
kimvde
1b764c2d30 Add unit tests to FLAC extractor related classes
PiperOrigin-RevId: 287973192
2020-01-17 13:52:54 +00:00
olly
97be06529c Use MIME types rather than PCM encodings for ALAW and MLAW
PiperOrigin-RevId: 287999703
2020-01-17 13:52:47 +00:00
olly
90a67b59c5 Add support for IMA ADPCM in WAV
PiperOrigin-RevId: 287854701
2020-01-17 13:52:33 +00:00
olly
ef0066f08a Support twos codec in MP4
Issue: #5789
PiperOrigin-RevId: 287828559
2020-01-17 13:52:29 +00:00
andrewlewis
7fd0b1d872 Fix handling of E-AC-3 streams with AC-3 frames
Issue: #6602
PiperOrigin-RevId: 287816831
2020-01-17 13:52:16 +00:00
olly
1edcc6c4f7 Don't use WavHeader.averageBytesPerSecond
It's unreliable for at least one IMA ADPCM file I've found.
Calculating the blockIndex to seek to using exact properties
also seems more robust.

Note this doesn't change anything for the existing PCM test,
since averageBytesPerSecond is set correctly. It does make
a difference for an upcoming IMA ADPCM test though.

PiperOrigin-RevId: 287814947
2020-01-17 13:52:11 +00:00
andrewlewis
3cf88bb48b Fix typos
PiperOrigin-RevId: 287810018
2020-01-17 13:52:06 +00:00
olly
3bce2138c1 Fix handling of network transitions in RequirementsWatcher
Issue: #6733
PiperOrigin-RevId: 286621715
2020-01-17 13:51:34 +00:00
olly
355b3afabd Read arrays directly from Parcel
PiperOrigin-RevId: 286197990
2020-01-17 13:50:52 +00:00
krocard
54f6f4823a 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
2020-01-17 13:50:43 +00:00
kimvde
37e65ec0f2 Add FlacExtractorSeekTest
PiperOrigin-RevId: 285823771
2020-01-17 13:50:12 +00:00
kimvde
fcac5af82d Fix FlacExtractor construction
Fix the FlacExtractor constructor for the case where seek(0,0) is not called before reading.

PiperOrigin-RevId: 285811161
2020-01-17 13:50:04 +00:00
kimvde
bf9f49a91b Implement seeking from seektable in FLAC extractor
PiperOrigin-RevId: 285799995
2020-01-17 13:50:01 +00:00
olly
7bd912f895 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
2020-01-17 13:49:57 +00:00
andrewlewis
27b06e9ad9 Fix ParameterName warnings in core tests
PiperOrigin-RevId: 285716982
2020-01-17 13:49:29 +00:00
olly
052550e90e Rename getPhysicalDisplaySize to getCurrentDisplayModeSize
PiperOrigin-RevId: 285405910
2020-01-17 13:49:05 +00:00
ibaker
18cdd8ece2 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
2020-01-17 13:46:57 +00:00
tonihei
5737815ee8 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
2020-01-17 13:43:30 +00:00
kimvde
c832896247 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
2020-01-17 13:43:16 +00:00
olly
4ea913fc78 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
2020-01-17 13:43:12 +00:00
olly
d62dc9dcfb 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
2020-01-17 13:43:07 +00:00
olly
1144926380 Add WavHeader.samplesPerBlock (currently always == 1)
PiperOrigin-RevId: 284961417
2020-01-17 13:42:34 +00:00
kimvde
fe61cfee2c Remove duplicated logic in FlacReader
PiperOrigin-RevId: 284952647
2020-01-17 13:42:30 +00:00
kimvde
910bd8bdc5 Implement binary search seeking for FLAC extractor
PiperOrigin-RevId: 284814594
2020-01-17 13:42:07 +00:00
ibaker
4ed512d611 Fix javadoc warnings exposed by -Xdoclint
PiperOrigin-RevId: 284776943
2020-01-17 13:40:49 +00:00
kimvde
ff1efd4ec2 Add peek() method to ExtractorInput
PiperOrigin-RevId: 284537150
2020-01-17 13:39:27 +00:00
kimvde
24afcdc36b 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
2020-01-17 13:39:18 +00:00
kimvde
54413c26d4 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
2020-01-17 13:37:58 +00:00
olly
a5ee17ec26 Fix casting to not need warning suppression
Also remove getRendererCapabilities arg that's now always null.

PiperOrigin-RevId: 283966795
2020-01-17 13:36:55 +00:00
andrewlewis
023e141be8 Verify metadata in extractor tests
PiperOrigin-RevId: 283960017
2020-01-17 13:36:40 +00:00
aquilescanta
0a0a478294 Add a test for SampleQueue capacity increases
Also remove redundant line

PiperOrigin-RevId: 283956203
2020-01-17 13:36:33 +00:00
aquilescanta
14897fb6df Invert the ownership scheme between SampleQueue and SampleMetadataQueue
Saves around 200 lines of code. High level overview:
- Rename SampleQueue to SampleDataQueue.
- Rename SampleMetadataQueue to SampleQueue.

This CL should not introduce behavior changes. The only significant
changes in synchronization should be:
+ Add synchronized keyword to isReady.
  - Seems to be necessary.
+ Add synchronized keyword to SampleQueue.sampleMetadata.
  - Before this change, SampleQueue.sampleMetadata could acquire the
    SampleMetadataQueue lock three times in a single method call.

Other miscellaneous improvements:
+ Put all private methods at the bottom.
+ Move release() to the right category.

PiperOrigin-RevId: 283795844
2020-01-17 13:36:09 +00:00
aquilescanta
9974670cc7 Make DownloadHelper pass DrmSessionManager to MediaSources
PiperOrigin-RevId: 283795201
2020-01-17 13:35:21 +00:00
andrewlewis
9c23888f1c Don't try to track buffersInCodec with tunneling
PiperOrigin-RevId: 283551324
2020-01-17 13:30:38 +00:00
kimvde
630992d05b Allow no output frame holder BinarySearchSeeker
PiperOrigin-RevId: 283544187
2020-01-17 13:29:44 +00:00
kimvde
f09f62da4f Expose metadata in FLAC extractor
PiperOrigin-RevId: 281538423
2020-01-17 13:20:54 +00:00
kimvde
a558501e38 Remove TODO around optimizing sample data outputs in FlacExtractor
Preliminary measurement showed that the results were similar to the non-optimized
version.

PiperOrigin-RevId: 281255476
2020-01-17 13:19:59 +00:00
kimvde
dcebf93ab4 Add Java FLAC extractor
Seeking, live streams support and exposure of vorbis and ID3 data
are not part of this commit.

Issue: #6406
PiperOrigin-RevId: 281083332
2020-01-17 13:17:53 +00:00
Oliver Woodman
27e4855830 Fix tests for 2.11.1 2019-12-20 22:18:52 +00:00
olly
f6dad5cee0 Enable blacklisting for HTTP 416
Where media segments are specified using byte ranges, it makes
sense that a server might return 416 (which we don't consider
for blacklisting) if the segment is unavailable, rather than
the 404 (which we do consider for blacklisting) that we expect
when media segments are only specified using a URL.

Issue: #6775
PiperOrigin-RevId: 286620698
2019-12-20 20:51:58 +00:00
tonihei
c299748132
Fix build by saving periodIndex to separate variable 2019-12-20 16:47:42 +00:00
tonihei
5d728abc41
Fix potentially wrong window index in onMediaPeriodCreated.
Issue:#6776
2019-12-20 16:38:34 +00:00
olly
c6036d5271 Add test case for mdat atom extending beyond the file length
Issue: #6774
PiperOrigin-RevId: 286576383
2019-12-20 16:08:25 +00:00
olly
87865a5cc4 DefaultDownloadIndex: Clear failure reason when removing download
The Download constructor considers it invalid to have a failure
reason if the download isn't in the failed state. Unfortunately,
calling DefaultDownloadIndex.removeAllDownloads when there's a
failed download will change the state without clearing the reason.
If the downloads are then read back from the DefaultDownloadIndex
we end up violating the Download constructor assertion.

This change clears the failed reason for any existing rows in the
invalid state, and also fixes the root cause that allows invalid
rows to enter the table in the first place.

Issue: #6785
PiperOrigin-RevId: 286576242
2019-12-20 16:07:43 +00:00
olly
406acfc38f Relax MP4 sniffing to allow an atom to extend beyond the file length
Issue: #6774
PiperOrigin-RevId: 286575797
2019-12-20 16:07:35 +00:00
olly
e8cb7b2370 Fix typo
Merge of https://github.com/google/ExoPlayer/pull/6793

PiperOrigin-RevId: 286556008
2019-12-20 16:07:26 +00:00
tonihei
b7bc1fee9f Add missing @Nullable to MediaCodecAudioRenderer.getMediaClock
Without this @Nullable, potential subclasses can't  override the
method to return null if they don't want to use the renderer as a
media clock.

Issue:#6792
PiperOrigin-RevId: 286545736
2019-12-20 16:07:11 +00:00