124 Commits

Author SHA1 Message Date
olly
a0703cb716 Add encoding constant for AAC ER BSAC
PiperOrigin-RevId: 320601157
2020-07-13 14:03:45 +01:00
olly
e8596428c0 Pass correct formats to AudioSink
The renderers are currently constructing formats that consist of their
input format with added PCM encoding. Such formats are not self-consistent,
and this only works because DefaultAudioSink ignores the rest of the
format if the format has a PCM encoding. It would not work if the sink
implementation checked the MIME type, for example, which wouldn't be a
strange or incorrect thing for it to do.

The more correct approach is to construct a new format that properly
represents the PCM that will be provided to the sink.

This change also renames supportsOutput to supportsFormat, because
AudioSink itself has both an input and an output side, and this method
is actually evaluating support on the input side of the sink.

PiperOrigin-RevId: 320396089
2020-07-10 09:09:02 +01:00
ibaker
fa594489d9 Completely separate MediaSource & DrmSession EventDispatchers
PiperOrigin-RevId: 319989989
2020-07-08 13:55:38 +01:00
kimvde
c06fa144e1 Remove some sanity occurrences in Java files
Remove occurrences in comments and private fields.

ISSUE: #7565
PiperOrigin-RevId: 319828820
2020-07-08 13:54:51 +01:00
aquilescanta
afbeb4267a Add UnsupportedMediaCrypto
ExoMediaCrypto with the sole purpose of being unsupported. So all
renderers checking whether the type is supported will report
encrypted content as unsupported, unless the source producing
the format replaces it with a valid value.

PiperOrigin-RevId: 319824703
2020-07-08 13:54:43 +01:00
olly
93b5b947db Support decode-only metadata buffers
PiperOrigin-RevId: 319798613
2020-07-08 13:54:24 +01:00
tonihei
113a2df775 Add some missing nullness assertions.
They are all for Context.getSystemService that is allowed to return
null. In most cases where we need to service, we make an assertion that
it is available.

PiperOrigin-RevId: 319503557
2020-07-03 15:31:30 +01:00
tonihei
e4e743a35f Fix remaining common module nullness issues.
PiperOrigin-RevId: 319183621
2020-07-03 09:01:20 +01:00
bachinger
20820800f3 Prevent parallel timeline access in MaskingMediaSource
The list of MediaSourceHolder in ExoPlayerImpl is only maintained to be able to create a PlaylistTimeline for masking. By keeping only the id and a snapshot of the timeline of the MediaSourceHolder in ExoPlayerImpl, parallel access is prevented and we still have sufficient information to create the masking timeline.

PiperOrigin-RevId: 319003837
2020-07-03 09:00:19 +01:00
olly
159c77919a Bump release to 2.11.7
PiperOrigin-RevId: 318790917
2020-06-29 13:33:18 +01:00
krocard
78825a41dc Store encodings in Format instead of just pcm encodings
Previously only pcm encoding were stored in Format,
this was an issue as for audio passthrough and offload
lots of code needs to pass complex format informations
(encoding, sample rate, channel count, gapless metadata)
but could not use Format and each function was taking
each as different parameter.

By allowing Format to contain any encoding, and not only
pcmEncoding, it allows to pass a Format everywhere in ExoPlayer
code that needs a Format.

This patch does not have any functional change. It is only an internal refactor.

PiperOrigin-RevId: 318789444
2020-06-29 13:33:09 +01:00
olly
73546231d2 Bump ExoPlayerLibraryInfo versions to 2.11.6
PiperOrigin-RevId: 317921368
2020-06-26 11:13:10 +01:00
gyumin
3eac5b4328 Move AudioAttributes to common module
PiperOrigin-RevId: 317864048
2020-06-26 11:12:53 +01:00
samrobinson
836babd5d6 Replace usages of Charset.forName with Guava Charsets.
PiperOrigin-RevId: 317672619
2020-06-23 11:07:43 +01:00
tonihei
c5c4c87728 Restrict some Handler to current Looper only.
They currently fall back to the main Looper if the current thread
doesn't have a Looper. All the changed Handlers are guaranteed to
be created on a thread with a Looper (mostly the ExoPlayer playback
Looper) and thus can make this stricter assumption. This makes it
easier to reason about the code as there are no ambiguities as to which
thread the Handler is running on.

PiperOrigin-RevId: 317334503
2020-06-23 11:06:31 +01:00
tonihei
7d66865d20 Rollback of 63ae4cc54b
*** Original commit ***

Rollback of 6ae472243f

*** Original commit ***

PiperOrigin-RevId: 317331407
2020-06-23 11:06:22 +01:00
olly
63ae4cc54b Rollback of 6ae472243f
*** Original commit ***

Rename Util methods to clarify which Looper is used.

The method name didn't clarify that either the main or current
Looper is used.

***

PiperOrigin-RevId: 317283606
2020-06-23 11:05:56 +01:00
tonihei
6ae472243f Rename Util methods to clarify which Looper is used.
The method name didn't clarify that either the main or current
Looper is used.

PiperOrigin-RevId: 317276561
2020-06-23 11:05:46 +01:00
olly
816a364a51 Clean up MimeTypes Javadoc
PiperOrigin-RevId: 317148010
2020-06-23 11:05:29 +01:00
olly
88883ffd67 Generalize MimeTypes.isWebm to MimeTypes.isMatroska
It seems more natural given we always end up instantiating a Matroska extractor,
not one that's specific to the WebM subset of Matroska. There's also no reason
not to support Matroska MIME types in DASH.

PiperOrigin-RevId: 316975451
2020-06-23 11:04:56 +01:00
olly
f85098a88f Update deprecation JavaDoc for ExoPlayer DataSpec
constructor to note that the builder does NOT
infer the http method from the existence of the
post body.

PiperOrigin-RevId: 316765677
2020-06-17 14:31:59 +01:00
olly
c808db9935 Add MIME types for which every sample is known to be a sync sample.
- Leaving the TODO, since there are still MIME types we're unsure about.
- Removing AAC because xHE-AAC does not have this property. We may re-add
  it with an additional profile check to exclude xHE-AAC in the future.

PiperOrigin-RevId: 316715147
2020-06-17 14:31:43 +01:00
aquilescanta
e7da26368a Add MediaParser-based implementation of ChunkExtractor
PiperOrigin-RevId: 315720712
2020-06-11 10:11:20 +01:00
krocard
0caada8b8c Fix formating in javadoc
PiperOrigin-RevId: 315516836
2020-06-11 10:10:27 +01:00
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
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