501 Commits

Author SHA1 Message Date
aquilescanta
a11f7b8cdd Document DataSource.getResponseHeaders case-insensitivity
PiperOrigin-RevId: 315480048
2020-06-09 16:05:33 +01:00
kimvde
b1e56304a1 Add support for inferring file format from MIME type
PiperOrigin-RevId: 315283926
2020-06-08 17:41:16 +01:00
ibaker
ee0c6224af Respect 33-bit wraparound when calculating WebVTT timestamps in HLS
Issue: #7462
PiperOrigin-RevId: 314919210
2020-06-05 14:48:13 +01:00
olly
b874b1d563 Bump version to 2.11.5
PiperOrigin-RevId: 314903986
2020-06-05 13:05:57 +01:00
kimvde
12a9351781 Miscellaneous renamings in FilenameUtils
PiperOrigin-RevId: 314723830
2020-06-05 13:05:20 +01:00
kimvde
7c33e2570a Update getFormatFromExtension to take a URI
This allows to handle the last segment retrieval and process the case
where the filename is null in the method.

PiperOrigin-RevId: 314512974
2020-06-04 14:15:55 +01:00
kimvde
1f80cf1558 Add API to get the format from the file extension
This will allow to use the file extension in DefaultExtractorsFactory.

PiperOrigin-RevId: 314296640
2020-06-02 23:51:24 +01:00
Ian Baker
8b89a5ed6d Merge pull request #6861 from chrisfillmore:feature/responseBodyForInvalidResponseCodeException_6853
PiperOrigin-RevId: 314105612
2020-06-01 15:00:08 +01:00
ibaker
20ace93706 Add a TODO to enforce ParsableByteArray.limit
I was trying to understand why this isn't always checked and didn't
realise there was already a bug tracking this - this way a future
confused reader knows something isn't working quite as intended.

PiperOrigin-RevId: 313765935
2020-05-29 18:34:28 +01:00
ibaker
2397e7f67a Replace TestUtil.joinByteArrays() with Guava's Bytes.concat()
PiperOrigin-RevId: 312481058
2020-05-21 17:09:22 +01:00
ibaker
02e74d6c94 Fix Guava deps from compileOnly to implementation
PiperOrigin-RevId: 312479354
2020-05-21 17:09:03 +01:00
ibaker
b9157a9e23 Add Guava dependency to ExoPlayer
Guava is heavily optimized for Android and the impact on binary size
is minimal (and outweighed by the organic growth of the ExoPlayer
library).

This change also replaces Util.toArray() with Guava's Ints.toArray()
in order to introduce a Guava usage into a range of modules.

PiperOrigin-RevId: 312449093
2020-05-21 17:08:33 +01:00
olly
be098401e9 Cache: Improve documentation and terminology
PiperOrigin-RevId: 312130813
2020-05-18 22:39:35 +01:00
andrewlewis
ef615754db Fix handling of fetch errors for post-rolls
The ad break time in seconds from IMA was "-1" for postrolls, but this didn't
match C.TIME_END_OF_SOURCE in the ad group times array.

Handle an ad break time of -1 directly by mapping it onto the last ad group,
instead of trying to look it up in the array.

PiperOrigin-RevId: 312064886
2020-05-18 16:14:19 +01:00
ibaker
a39233d2fd Limit CEA-608 captions to 32 chars per line
ANSI/CTA-608-E R-2014 spec defines exactly 32 columns on the screen,
and limits all lines to this length.

See 3.2.2 definition of 'Column'.

issue:#7341
PiperOrigin-RevId: 311549881
2020-05-14 22:24:49 +01:00
bachinger
66fd81401b Add forceDefaultLicenseUri to MediaItem.DrmConfiguration
ISSUE: #7114
PiperOrigin-RevId: 311115835
2020-05-14 22:21:58 +01:00
olly
ea08bfd33d Move isCausedByPositionOutOfRange to DataSourceException
PiperOrigin-RevId: 311002702
2020-05-14 22:21:13 +01:00
olly
6bf89bb49a Fix nullness checker warnings
PiperOrigin-RevId: 310997932
2020-05-14 22:21:04 +01:00
olly
0d22d02df5 FFmpeg extension: Correctly pad input buffers
FFmpeg requires input buffers to be sized larger than the size
of the data they contain. This is to allow optimized decoder
implementations that read data in fixed size chunks, without
the risk of such decoders reading beyond the end of the buffer.

Issue: #2159
PiperOrigin-RevId: 310946866
2020-05-14 22:20:55 +01:00
insun
c7f2df0fd9 Add Player#getTrackSelector()
PiperOrigin-RevId: 310242733
2020-05-14 22:17:51 +01:00
krocard
535e14cb4d Implement format to encoding for AAC
PiperOrigin-RevId: 310199693
2020-05-06 20:58:11 +01:00
olly
f946606643 Map R-prerelease to SDK_INT=30
PiperOrigin-RevId: 309411490
2020-05-01 19:50:56 +01:00
bachinger
b22783f895 Rename sourceUri to uri
PiperOrigin-RevId: 308918151
2020-05-01 19:46:04 +01:00
aquilescanta
053a8ac425 Add some mime type constants to MimeTypes
PiperOrigin-RevId: 308846313
2020-05-01 19:45:46 +01:00
bachinger
1323dd63d5 Remove Sample from SampleChooserActivity
Unmarshal from json to MediaItem instead of Sample. Further the playlist
of MediaItems is converted to Intent extras which are read by the
PlayerActivity.

PiperOrigin-RevId: 308141231
2020-04-27 10:41:33 +01:00
krocard
7c3b461b64 Make DefaultAudioSink.getFramesPerEncodedSample endianness independent
While most ExoPlayer code parsing ByteBuffers is called with buffers in big
endian, in certain situation, buffers in little endian are used too.

MediaCodec produced ByteBuffers are in little endian, while buffers
receive from the sources are in big endian (ByteBuffer's default).

As a result, some code called from AudioSink in passthrough parsed
bytebuffer in little endian. This is not correct because those
format are specified in BigEndian.

Changing the endianness of the ByteBuffer returned from MediaCodec
would impact a lot more code that can currently be tested in the
current COVID lockdown situation.

As a result, this patch instead make the parsing code independent
of the ByteBuffer.order() set. All the code that is called from
DefaultAudioSink now parses the buffer explicitly in Big Endian.

Additionally, the MPEG big endian header data of size 4 bytes was
retrieved with ByteBuffer.get, which only returns one byte.

PiperOrigin-RevId: 308116173
2020-04-27 10:41:33 +01:00
krocard
d01d0cfd4b Define a interface type for Aac object type.
PiperOrigin-RevId: 308115863
2020-04-27 10:41:33 +01:00
bachinger
8d0d31e15c Add key set id to MediaItem
PiperOrigin-RevId: 307390673
2020-04-27 10:18:20 +01:00
bachinger
8ea33e2315 Support ad tag with default media source
This is the missing attribute to support all features of the Sample with MediaItem. Hence PlayerActivity can use the setMediaItems() method directly without creating actual media sources in the app code.

PiperOrigin-RevId: 307102036
2020-04-20 13:28:56 +01:00
bachinger
d7280f096f Add custom cache key to media item
This is required to migrate the PlayerActivity away from Sample to MediaItem. It hence needs adding buildUpon to MediaItem to mix in the customCacheKey and streamKeys before playback.

PiperOrigin-RevId: 306710643
2020-04-17 10:44:16 +01:00
olly
6cff8a6ad0 Don't select trick-play tracks by default
Issue: #6054
Issue: #474
PiperOrigin-RevId: 306504362
2020-04-15 17:42:18 +01:00
aquilescanta
edc25ddc8d Fix javadoc typo
PiperOrigin-RevId: 306431216
2020-04-15 17:42:18 +01:00
christosts
e7fd6a0e01 SimpleExoplayer Builder for testing
Create a Builder that creates SimpleExoPlayer instances with fake
components, suitable for testing.

Basically extracts the Builder from ExoPlayerTestRunner to a standalone
class that can be re-used.

PiperOrigin-RevId: 305458419
2020-04-08 21:48:08 +01:00
bachinger
4e2a0f6032 simplify PlayerActivity towards using the media item only
PiperOrigin-RevId: 305300409
2020-04-08 21:47:48 +01:00
olly
74a9d8f680 Clean up manifest MIME type and codec parsing
PiperOrigin-RevId: 305258836
2020-04-07 17:07:10 +01:00
ibaker
8df6a4b301 Remove nullness warning suppressions from Matcher.group
These were introduced in c7164a30a0

In each case I checked that the groups are not optional,
so if they match they must be non-null.

PiperOrigin-RevId: 305213293
2020-04-07 13:39:13 +01:00
Oliver Woodman
2b44ff3c71 Merge pull request #7184 from TiVo:p-subtitle-format-from-codecs
PiperOrigin-RevId: 305137114
2020-04-07 13:38:53 +01:00
andrewlewis
dc813eca41 Fix stuck ad playbacks with DRM-protected content
When ClippingMediaPeriod first tried to read a buffer, if its end
position was before the end of the stream and it was buffered to its end
position, it would sometimes erroneously signal end-of-stream for
protected content because the sample queue might be waiting for DRM keys
at this point.

Work around the issue temporarily by signaling this specific case back
to ClippingMediaPeriod via the DecoderInputBuffer.

There will likely be a cleaner fix as a result of adding support for
dynamic clip end points in the future, at which point this can be
reverted.

issue:#7188
PiperOrigin-RevId: 305081757
2020-04-07 13:38:33 +01:00
bachinger
dc4118da7b add clearTrackTypes and playClearContentWithoutKey to DrmConfiguration
With these additional properties, we can declare the behaviour for clear tracks and clear content on a media item level.

PiperOrigin-RevId: 304351716
2020-04-06 13:26:29 +01:00
Steve Mayhew
232820d3e1 Add HLS support for "stpp.*" codec support for SMPTE-TT fmp4 subtitle tracks
ExoPlayer needs a codec to decide among WEBVTT and TTML decoder mimeType.
Apple describes IMSC1 in MP4 in
[RFC-8216 Section 3.6](https://tools.ietf.org/html/draft-pantos-hls-rfc8216bis-04#section-3.6).

The DASH manifest specifies the SMPTE-TT captions in the codecs in the manifest
(from W3C [TTML Profiles for Internet Media Subtitles and Captions 1.1](https://www.w3.org/TR/ttml-imsc1.1/#general-0).
DASH just doesn't require the rendition linking, but HLS does.

Apple implies the CODECS attribute of the variant needs to be do this.  That is
with SHOULD and MAY language to imply the codec to use for it in the
[Authoring Guidelines](https://developer.apple.com/documentation/http_live_streaming/hls_authoring_specification_for_apple_devices)

This change defaults to WebVTT if no codec is specifed (same as current behavior) otherwise it picks it from the variants
referencing the media.
2020-04-03 19:41:23 -07:00
olly
151b75d831 Bump version to 2.11.4
PiperOrigin-RevId: 303776645
2020-03-30 19:21:09 +01:00
ibaker
c7164a30a0 Suppress go/nullness warnings caused by Matcher#group(String) and Matcher#group(int)
This is required to align google3's stub (currently marked non-null) with Checker Framework's.

More information: go/matcher-nullness-lsc

Tested:
    TAP train for global presubmit queue
    http://test/OCL:303344687:BASE:303326748:1585344475427:29edc250
PiperOrigin-RevId: 303709053
2020-03-30 17:17:00 +01:00
olly
2555fb36b4 Resample float audio to 16-bit by default to enable audio processing
This is less confusing than having audio processing functionality (e.g., playback
speed adjustment) just "not work" for some pieces of media.

If this change is merged, I will update #6749 to also track making DefaultAudioSink
intelligently enable/disable float output depending on how the audio processors are
configured.

Issue: #7134
PiperOrigin-RevId: 302871568
2020-03-25 13:06:17 +00:00
krocard
1fa9dbc31e Conserve ByteOrder when growingDecoderInputBuffer
#exo-offload

PiperOrigin-RevId: 302403507
2020-03-25 13:02:53 +00:00
olly
429bdfb974 Improve logging
- Make sure logging of UnknownHostException indicates the failure reason
- Indent stack traces inside event blocks in EventLogger
- Don't log media URLs

PiperOrigin-RevId: 302007601
2020-03-20 12:49:20 +00:00
olly
c294e0cb89 Clarify DataSpec.httpRequestHeaders documentation
Issue: #7069
PiperOrigin-RevId: 300738492
2020-03-19 00:47:49 +00:00
olly
920117b081 Drop prefix test- from test methods under v2/library
This CL removes the prefixes to the tests added after a6d0caaa3c.

This CL is generated by following command
$ find -name '*Test.java' | xargs -I{} sed -i 's/^\ \ public\ void\ test\([A-Z]\)\(.*\)$/  public void \L\1\E\2/' {}

PiperOrigin-RevId: 300547504
2020-03-19 00:46:48 +00:00
ibaker
2bd4d61b9b Use a Multiset for reference counting in MediaSourceEventDispatcher
This avoids duplicate events being dispatched to object foo if
addListener(foo) is called more than once.

Part of issue:#6765

PiperOrigin-RevId: 300529733
2020-03-19 00:46:15 +00:00
aquilescanta
1f202f0aee Make DataSource extend DataReader and upcast uses
This means DataSource.read now may throw InterruptedException.

PiperOrigin-RevId: 300523430
2020-03-19 00:45:59 +00:00
aquilescanta
47b62e8c02 DataReader: replace InterruptedException with InterruptedIOException
PiperOrigin-RevId: 299092243
2020-03-10 10:19:45 +00:00