85 Commits

Author SHA1 Message Date
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
ibaker
2f4e88d5af Remove ByteBufferBackingArray suppression from metadata decoders
PiperOrigin-RevId: 298312222
2020-03-10 10:16:25 +00:00
andrewlewis
0b946ac317 Move max encoded audio rates to format utils
PiperOrigin-RevId: 298290511
2020-03-10 10:16:00 +00:00
andrewlewis
2ca363316c Fix typo
PiperOrigin-RevId: 298288236
2020-03-10 10:15:52 +00:00
olly
a6d0caaa3c Drop prefix test- from test methods under v2/library
This is one step toward following the google3's test naming convention.
See go/java-testing/getting_started#basic-test-template for details
why prefix test isn't necessary.

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/' {}

and then manually modified following tests where test method names conflict with test target.
- VorbisUtilTest
- VorbisReaderTest
- UtilTest
- DownloadManagerDashTest
- DefaultOggSeekerTest
- OggPageHeaderTest
- HlsMasterPlaylistParserTest

PiperOrigin-RevId: 298074653
2020-03-10 10:15:43 +00:00
olly
67b29bbe39 Format.Builder: Finish migration
Issue: #5978
PiperOrigin-RevId: 297876336
2020-02-28 18:43:04 +00:00
olly
3730639c95 Don't set decoded bitrate on audio/flac format
PiperOrigin-RevId: 297864386
2020-02-28 18:42:39 +00:00
andrewlewis
1ca9a061b1 Split AAC utils out of CodecSpecificDataUtil
PiperOrigin-RevId: 297823929
2020-02-28 18:42:30 +00:00
kimvde
56dbe83a4c Extractor tests: dump only non-default values for format
This removes noisy data from the dump files and allows updating less
dump files if a format field is added, removed or updated.

PiperOrigin-RevId: 297617138
2020-02-28 18:40:54 +00:00
aquilescanta
a114a0ed7f Rename SampleDataReader to DataReader and move to common
PiperOrigin-RevId: 297603312
2020-02-27 17:16:53 +00:00
samrobinson
88e356f214 Add WifiLock management to SimpleExoPlayer.
Issue:#6914
PiperOrigin-RevId: 297598910
2020-02-27 17:16:29 +00:00
andrewlewis
7c2889c620 Add ENCODING_ constants for AAC
PiperOrigin-RevId: 297579793
2020-02-27 17:16:02 +00:00
kim-vde
6946170d3e Merge pull request #6922 from phhusson:feature/ait
PiperOrigin-RevId: 297579733
2020-02-27 17:15:52 +00:00
andrewlewis
bd8ee155af Construct codecs string for AAC in MP4/TS/FLV
PiperOrigin-RevId: 297578984
2020-02-27 17:15:42 +00:00
olly
6fc5e6b905 Migrate HLS to Format.Builder
Issue: #2863
PiperOrigin-RevId: 296482726
2020-02-25 21:23:53 +00:00