8751 Commits

Author SHA1 Message Date
andrewlewis
ceddc60296 Publish MediaCodec-based renderer tests
Switch to snapshot Robolectric to pick up the latest version of shadows
required by MediaCodecVideoRendererTest and MediaCodecAudioRendererTest.

PiperOrigin-RevId: 312030332
2020-05-18 16:13:34 +01:00
aquilescanta
f6d0e34cea Fix Extractor.read throws documentation
PiperOrigin-RevId: 311755157
2020-05-18 16:13:25 +01:00
andrewlewis
793f12da6d Add support for timing out ad preloading
Detect stuck buffering cases in ImaAdsLoader, and discard the ad group after
a timeout. This is intended to make the IMA extension more robust in the case
where an ad group unexpectedly doesn't load.

The timing out behavior is enabled by default but apps can choose to retain
the old behavior by setting an unset timeout on ImaAdsLoader.Builder.

PiperOrigin-RevId: 311729798
2020-05-18 16:13:15 +01:00
tonihei
f3d331c9f7 Extend EventTime with full current position info.
EventTime contains information about when an event happened and where
it belongs to. Both places can be fully described using timeline, window
index, media period id and position.

Right now, only the information for where the event belongs to is fully
contained in EventTime, whereas the time when the event happened only has
the position, and none of the other information (timeline, window, period).

This change adds the missing information, so that the EventTime can easily
be used without having access to the Player. This also ensures Event
metadata is self-contained and can be stored and reused later.

issue:#7332
PiperOrigin-RevId: 311727004
2020-05-18 16:13:06 +01:00
christosts
78c850a885 Remove set timeout on release() and setSurface()
Removes the experimental methods to set a timeout when
releasing the player and setting the surface.

PiperOrigin-RevId: 311703988
2020-05-18 16:12:57 +01:00
olly
b9abe2d0d6 Clean up samples list
- Add Widevine AV1 streams
- Remove SD and HD only Widevine streams (we don't need so many!)
- Simplify naming

PiperOrigin-RevId: 311697741
2020-05-15 10:59:07 +01:00
olly
f91cfb12e8 Attach ExoMediaCryptoType for progressive streams
PiperOrigin-RevId: 311628160
2020-05-15 10:58:58 +01:00
Oliver Woodman
932a8fcf3d Merge pull request #7367 from inv3rse:keep-paused-state-during-buffering
PiperOrigin-RevId: 311623784
2020-05-15 10:58:46 +01:00
ibaker
710374f83a Override WebViewSubtitleOutput.onLayout()
Some of the CSS font sizes are derived from the current view height, if
this calculation is done before the view has been measured then a zero
view height results in a zero px font size and no visible text.

This can happen when the view type is changed (and so the
WebViewSubtitleOutput has been recently added to the SubtitleView
ViewGroup).

PiperOrigin-RevId: 311552052
2020-05-14 22:24:58 +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
aquilescanta
758e99e3f1 Remove last references to old load error handling methods
PiperOrigin-RevId: 311531734
2020-05-14 22:24:40 +01:00
bachinger
9e35c6c28c Make all segment downloader use the media item
PiperOrigin-RevId: 311527440
2020-05-14 22:24:31 +01:00
bachinger
c1aa9b917b Make use of MediaItem in ProgressiveDownloader
PiperOrigin-RevId: 311513746
2020-05-14 22:24:21 +01:00
aquilescanta
6abec07a07 Update DefaultDrmSession load error handling
Issue:#7309
PiperOrigin-RevId: 311504497
2020-05-14 22:24:04 +01:00
tonihei
7b552d7786 Move common init steps into SimpleExoPlayer builder.
Some player setup steps that are likely to be only done once
should be moved into the Builder so that player setup can use
a consistent style (builder vs setters).

This also prevents some threading warning issues when the player
is built on a background thread (e.g. for dependency injection
frameworks) and setters can't be used due to threading restrictions.

PiperOrigin-RevId: 311487224
2020-05-14 22:23:55 +01:00
ibaker
ba5871dd0e Add support for CaptionStyle.edgeStyle to WebViewSubtitleOutput
This is the last piece to bring feature parity between
WebViewSubtitleOutput and CanvasSubtitleOutput.

PiperOrigin-RevId: 311325749
2020-05-14 22:23:46 +01:00
aquilescanta
025a2c2b62 Make MediaDrmCallback surface more error information
Issue:#7309
PiperOrigin-RevId: 311324242
2020-05-14 22:23:37 +01:00
ibaker
1c3c7c58ab Rename SubtitleTextView to CanvasSubtitleOutput
It displays images too, and in fact it's used exclusively to display
images in SubtitleWebView. It also doesn't use a TextView - so all round
a slightly confusing name.

Also rename SubtitleWebView to WebViewSubtitleOutput to match the same
pattern.

PiperOrigin-RevId: 311312758
2020-05-14 22:23:28 +01:00
olly
6e47819be4 Minor copybara fixes
- Remove proguard-rules.txt symlink
- Guard against classes annotated with @ClosedSource but not excluded

PiperOrigin-RevId: 311312671
2020-05-14 22:23:19 +01:00
olly
a5824f7325 Restrict Decoder generic exception type to extend DecoderException
This is useful for merging the FFmpeg video support pull request,
since it allows a Decoder base class implementation to catch
DecoderException rather than forcing it to catch Exception (i.e.,
everything). Note that unfortunately, Java doesn't allow catching
of a generic type (i.e., you cannot "catch (E e)") due to type
erasure.

PiperOrigin-RevId: 311300719
2020-05-14 22:23:10 +01:00
aquilescanta
f599155bbf Document the sample data format for samples with supplemental data
PiperOrigin-RevId: 311298802
2020-05-14 22:23:01 +01:00
bachinger
621f1b0b47 Make SilenceMediaSource add a media item to the timeline
PiperOrigin-RevId: 311295749
2020-05-14 22:22:52 +01:00
bachinger
fefb2a03c2 Provide a constructor that does not require a context
The only reason to require a context for creating an instance of
DefaultMediaSourceFactory is creating a user agent. DownloadHelper
has a bunch of static methods that need to instantiate a
DefaultMediaSourceFactory without a Context. By adding a setter for
the user agent we can remove that restriction and use a default user
agent.

PiperOrigin-RevId: 311291603
2020-05-14 22:22:42 +01:00
bachinger
478be50219 Remove constructor of SinglePeriodTimline without tag and media item
We aim for all SinglePeriodTimelines to set window.mediaItem and hence want to eliminate all constructors not passing a media item. The constructor removed in this CL is the easiest one to remove and fix in google3. It is still a breaking change for external ExoPlayer user who provide a custom media source with this timeline.

PiperOrigin-RevId: 311291493
2020-05-14 22:22:33 +01:00
olly
30bc77f249 Prevent leaking of the Thread.interrupt flag to other LoadTasks
PiperOrigin-RevId: 311290214
2020-05-14 22:22:25 +01:00
krocard
df0d115b31 Do not create AudioFormat with invalid encoding
PiperOrigin-RevId: 311150195
2020-05-14 22:22:16 +01:00
krocard
9197c9c9a0 Fix duplicated batch buffer test.
Two tests had the same code when the were
supposed to test different state.

PiperOrigin-RevId: 311149216
2020-05-14 22:22:07 +01:00
bachinger
66fd81401b Add forceDefaultLicenseUri to MediaItem.DrmConfiguration
ISSUE: #7114
PiperOrigin-RevId: 311115835
2020-05-14 22:21:58 +01:00
andrewlewis
c4cd559315 Upgrade IMA SDK to 3.19.0
PiperOrigin-RevId: 311106612
2020-05-14 22:21:49 +01:00
andrewlewis
8ed82e7621 Fix method ordering in ImaAdsLoader
Put static methods at the end.

Also add a couple of missing parameter name comments.

PiperOrigin-RevId: 311077684
2020-05-14 22:21:39 +01:00
andrewlewis
3478ef3108 Improve DEBUG logging in ImaAdsLoader
Log content progress events, as these are helpful to debug triggering of events
based on the content progress.

Don't log AD_PROGRESS events as they occur several times per second while ads
are playing, and the verbosity makes logs difficult to read.

PiperOrigin-RevId: 311077302
2020-05-14 22:21:30 +01:00
olly
ad85990455 Fix buffer subsample data before calling onQueueInputBuffer
It's very unlikely any onQueueInputBuffer implementations are looking
at the subsample encryption data, but from a correctness perspective
we should be passing a buffer object that's self-consistent.

PiperOrigin-RevId: 311011246
2020-05-14 22:21:22 +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
olly
dbff731d1f Move default CacheKeyFactory to CacheKeyFactory.DEFAULT
PiperOrigin-RevId: 310940572
2020-05-14 22:20:46 +01:00
olly
8ae8bf7b21 Split fetching FFmpeg from build_ffmpeg.sh
It makes it harder to work with a different branch. Also make
the FFmpeg instructions consistent with those of the other
extensions (e.g., by removing the "jni" part of the path from
the FFMPEG_EXT_PATH variable.

PiperOrigin-RevId: 310937751
2020-05-14 22:20:36 +01:00
ibaker
0fb4ba788f Switch SubtitleWebView to use single-quotes in generated HTML
The current state is inconsistent with SpannedToHtmlConverter, it seems
they might as well agree on quoting strategy.

PiperOrigin-RevId: 310926683
2020-05-14 22:20:27 +01:00
samrobinson
8528129e8d Make the base values of SilenceSkippingAudioProcessor configurable.
Issue:#6705
PiperOrigin-RevId: 310907118
2020-05-14 22:20:18 +01:00
andrewlewis
88223882d7 Remove deprecated symbols in ImaAdsLoader
PiperOrigin-RevId: 310901647
2020-05-14 22:20:08 +01:00
tonihei
9fa2aaf33d Use event playback position in EventLogger.
We currently use the playback position in the current window, not the
position in the window the event belongs to. This creates confusing
outputs, e.g, window=1, mediaPos=100, even if the position refers to
window 0.

issue:#7332
PiperOrigin-RevId: 310896908
2020-05-14 22:19:59 +01:00
ibaker
0dd57de1f1 Parse TTML's tts:textAlign into Cue.textAlign, not an AlignmentSpan
The tts:textAlign property only applies to <p> elements, which
correspond 1:1 with ExoPlayer Cue objects, so we can use
Cue.textAlignment to store this info instead of encoding it in
the span-styled text.

This will mean that TTML subtitles used with
SubtitleView#setApplyEmbeddedStyles(false) will start respecting
the tts:textAlign properties from the source data (currently this
information is stripped when we remove all span styling). I think this
is working-as-intended, we respect alignment of other subtitle types
(e.g. WebVTT) when applyEmbeddedStyles=false. We also respect all other
'positioning' related properties in this case e.g. Cue.position and
Cue.line.

PiperOrigin-RevId: 310895499
2020-05-14 22:19:50 +01:00
bachinger
19d639eb9a Make use of MediaItem in ProgressiveMediaSource
PiperOrigin-RevId: 310889726
2020-05-14 22:19:41 +01:00
samrobinson
1241c8c321 Rollback of 59ecce6c85
*** Original commit ***

Rollback of 70273a0361

*** Original commit ***

Assert incoming buffers are little endian in the DefaultAudioSink.

***

***

PiperOrigin-RevId: 310889382
2020-05-14 22:19:32 +01:00
christosts
159e3a80d5 Keep pending output format on MediaCodec.flush()
When operating the MediaCodec in asynchronous mode, we are seeing
NPEs raised from the DefaultAudioSink because output buffers are pushed
to the DefaultAudioSink with the DefaultAudioSink not configured yet.
This is possible to happen if an output buffer is passed with
MediaCodecAudioRenderer.processOutputBuffer() before an output format
change.

One possible code path to trigger this is when an output format change
is pending and we flush MediaCodec (e.g. for a seek): the callback is
waiting in the looper's queue but we ignore all currently queued
callbacks after a flush().

This commit checks for a pending output format change during a flush():
if one exists, and the next MediaCodec output callback right after the
flush() is an output buffer (and not a new output format), then the
pending output format is propagated first.

The only adapter that needs to change is the
AsynchronousMediaCodecAdapter which previsouly deleted all pending
callbacks immediately on flush(). The AsynchronousMediaCodecAdapter now
needs to also handle every enqueued callback in order to identify is
there's a pending output format change.

Testing: added unit tests for the new code. I have verified that if we
pass an output buffer to the audio renderer before the output format, it
will result on the specific NPE, but I cannot reproduce the base
scenario (an output format change is pending when flushing) on a real
device because we can't know if an output format is indeed pending.
PiperOrigin-RevId: 310885283
2020-05-14 22:19:24 +01:00
andrewlewis
6aab5e2e61 Upgrade IMA SDK to 3.18.2
PiperOrigin-RevId: 310883076
2020-05-14 22:19:14 +01:00
samrobinson
59ecce6c85 Rollback of 70273a0361
*** Original commit ***

Assert incoming buffers are little endian in the DefaultAudioSink.

***

PiperOrigin-RevId: 310377513
2020-05-14 22:19:05 +01:00
olly
9a4ec54bdf Propagate Format through extension video decoders
We currently propagate only ColorInfo, but propagating the whole Format
is generally useful (e.g., to get the frame-rate on the output side of
the decoder).

PiperOrigin-RevId: 310359650
2020-05-14 22:18:55 +01:00
ibaker
252bf43bf4 Stop parsing unsupported WebVTT CSS properties
The spec lists an exhaustive list of CSS properties that should be
recognised, all others must be ignored:
https://www.w3.org/TR/webvtt1/#the-cue-pseudo-element

PiperOrigin-RevId: 310353888
2020-05-14 22:18:46 +01:00
ibaker
99ebeaed17 Change the SubtitleView.Output interface
This allows properties to propagate when switching view types
(e.g. bottomPaddingFraction).

It also allows the style-stripping code to be pushed up to SubtitleView
and therefore shared.

PiperOrigin-RevId: 310353534
2020-05-14 22:18:37 +01:00