2526 Commits

Author SHA1 Message Date
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
olly
63f7b99836 Bump to 2.11.1
PiperOrigin-RevId: 286368964
2019-12-19 14:47:43 +00:00
ibaker
5d2ca02c5a Unwrap all nested IntDef values
This seems to work with R8 but interact badly with ProGuard.

issue:#6771
PiperOrigin-RevId: 286215262
2019-12-18 20:06:03 +00:00
andrewlewis
b4873e55e1 Fix keep rule for VideoDecoderOutputBuffer
PiperOrigin-RevId: 286156361
2019-12-18 19:30:22 +00:00
andrewlewis
c9109f437c 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 19:30:08 +00:00
ibaker
166e389c56 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 19:29:35 +00:00
olly
0a701abafe Retain AV1 constructor for DefaultRenderersFactory
Issue: #6773
PiperOrigin-RevId: 285990377
2019-12-18 19:29:18 +00:00
olly
250a5deab5 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 19:27:27 +00:00
ibaker
4653592d0e 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-18 19:25:57 +00:00
samrobinson
03b02f98df 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:48:42 +00:00
olly
1de7ec2c70 Fix bug removing entries from CacheFileMetadataIndex
Issue: #6621
PiperOrigin-RevId: 284743414
2019-12-10 12:39:30 +00:00
olly
914a8df0ad 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 17:58:23 +00:00
olly
0065f63f48 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 17:57:10 +00:00
olly
567f2a6575 Fix Javadoc issues
PiperOrigin-RevId: 284509437
2019-12-09 16:47:18 +00:00
olly
7e93c5c0b6 Enable physical display size hacks for API level 29
For AOSP TV devices that might not pass manual verification.

PiperOrigin-RevId: 284154763
2019-12-06 23:28:05 +00:00
olly
22f25c57bb MatroskaExtractor naming cleanup II
- Remove "lacing" from member variables. They're used even if
  there is no lacing (and the fact that lacing is the way of
  getting multiple samples into a block isn't important).

Issue: #3026
PiperOrigin-RevId: 284152447
2019-12-06 23:27:58 +00:00
olly
5973b76481 MatroskaExtractor naming cleanup
- Change sampleHasReferenceBlock to a block reading variable, which is
  what it is (the distinction didn't matter previously, but will do so
  when we add lacing support in full blocks because there wont be a 1:1
  relationship any more.
- Move sampleRead to be a reading state variable.
- Stop abbreviating "additional"

Issue: #3026
PiperOrigin-RevId: 284000937
2019-12-06 23:27:52 +00:00
andrewlewis
4f363b1492 Fix mdta handling on I/O error
An I/O error could occur while handling the start of an mdta box, in
which case retrying would cause another ContainerAtom to be added. Fix
this by skipping the mdta header before updating container atoms.

PiperOrigin-RevId: 284000715
2019-12-06 23:27:43 +00:00
tonihei
1e609e245b Add format and renderer support to renderer exceptions.
This makes the exception easier to interpret and helps with debugging of
externally reported issues.

PiperOrigin-RevId: 283965317
2019-12-06 23:27:11 +00:00