6295 Commits

Author SHA1 Message Date
ibaker
cdfee89181 Use CSS inheritance for background-color in WebViewSubtitleOutput
CSS background-color isn't inherited to inner HTML elements by default:
https://developer.mozilla.org/en-US/docs/Web/CSS/background-color

But Android Span styling assumes an outer BackgroundColorSpan will
affect inner spans. This usually doesn't make a difference, because
HTML elements are transparent by default, so there's an implicit
inheritance by just being able to see through to the 'outer' element
underneath. However this doesn't work if the inner element sits outside
the bounding box of the outer element, e.g. <rt> (ruby text, sits above/below)
or a <span> with font-size > 100%.
END_PUBLIC

Demo of <rt> and font-size problems: http://go/cpl/ruby-backgrounds/1
Demo of CSS inheritance: http://go/cpl/css-inheritance/1

PiperOrigin-RevId: 320915999
2020-07-13 14:04:20 +01:00
andrewlewis
245459a34a Fix raw type
PiperOrigin-RevId: 320909448
2020-07-13 14:04:11 +01:00
insun
5e50e110a4 Mark currently selected subtitle track in track list
Previously, the automatically selected subtitle track
has not been marked (with check mark) in subtitle track list,
just like audio track.

But, in subtitle track option UI, there is no 'auto' option,
which is different from audio track selection menu.

This CL marks the auto selected subtitle track name in the cc list.

PiperOrigin-RevId: 320802575
2020-07-13 14:04:02 +01:00
kimvde
702568c3b6 Remove some occurrences of dummy in core library
Remove occurrences in comments and private fields.

ISSUE: #7565
PiperOrigin-RevId: 320606558
2020-07-13 14:03:54 +01:00
olly
a0703cb716 Add encoding constant for AAC ER BSAC
PiperOrigin-RevId: 320601157
2020-07-13 14:03:45 +01:00
krocard
33cf96cfdf Fix more DecoderCounter increase in batching mode
The counter was increased by one for each batch
instead of each frame.

Additionally fix a null check.

PiperOrigin-RevId: 320592873
2020-07-13 14:03:36 +01:00
ibaker
9290b468d0 Stop sharing a Handler between EPI and EPII
Sharing the Handler has led to it being accidentally used for purposes
beyond the original intention.

Instead for EPII -> EPI communication: Call methods directly on
ExoPlayerImpl that then post from the playback thread to the
application thread.

And for the MediaSourceList and Queue initialization, create a dedicated
Handler based on the same applicationLooper.

PiperOrigin-RevId: 320590527
2020-07-13 14:03:27 +01:00
olly
09e97cf279 Fix some Javadoc issues
PiperOrigin-RevId: 320581002
2020-07-13 14:03:19 +01:00
kimvde
efce10c873 Simplify FragmentedMp4Extractor sample time logic
PiperOrigin-RevId: 320574671
2020-07-13 14:03:10 +01:00
ibaker
6624c7cb9a Check referenceCount > 0 in DefaultDrmSession#release()
Also flip DefaultDrmSessionManager#prepare()/release() into guard
clauses.

Suggestions from review comments on:
316f8a88cd

PiperOrigin-RevId: 320572462
2020-07-13 14:03:01 +01:00
andrewlewis
3214851fbb Migrate off deprecated IMA SDK APIs
AdDisplayContainer now takes the video ad player at construction time,
and obstructions are registered/unregistered via a new method. Also
'content complete' is now notified via ad callbacks rather than the
AdsLoader.

PiperOrigin-RevId: 320567666
2020-07-13 14:02:52 +01:00
andrewlewis
bcbe310681 Use MediaPeriodId for ad preparation errors
PiperOrigin-RevId: 320565543
2020-07-13 14:02:43 +01:00
andrewlewis
1e2ed51f25 Add support for H.263 and MPEG-4 Part 2 in TS
The new reader is named H263Reader as it handles H.263 streams, but
MPEG-4 Part 2 streams are also intended to be handled. The reader's
output format MIME type is video/mp4v as the H.263 streams can be
decoded by decoders supporting this MIME type.

The implementation is based on the framework implementation for
extracting MPEG-4 video in MPEG-TS
(https://cs.android.com/android/platform/superproject/+/master:frameworks/av/media/libstagefright/mpeg2ts/ESQueue.cpp;l=1825;drc=86e363c1fac27302ca4ae33e73296f7797672995)
and is similar to the existing H262Reader.

Issue: #1603
Issue: #5107
PiperOrigin-RevId: 320565337
2020-07-13 14:02:34 +01:00
kimvde
c29fc94540 Fix saiz and senc sample count checks for FMP4
Issue: #7592
PiperOrigin-RevId: 320556981
2020-07-10 09:09:39 +01:00
olly
fd3e10ed76 Fix VPFO counter reporting
DecoderCounters are reset in onEnabled, but the way the local
counters in MediaCodecVideoRenderers were reset assumed the
DecoderCounters were reset in onStarted.

PiperOrigin-RevId: 320440991
2020-07-10 09:09:30 +01:00
olly
351b54e97f Pass correct Format to AudioSink.configure
Building on the Format that was provided on the input side of the
decoder creates a format that's a mixture of the formats on the
input and output sides of the decoder. This change instead builds
a PCM format from scratch.

PiperOrigin-RevId: 320405656
2020-07-10 09:09:21 +01:00
krocard
945471452f Update skippedOutputBufferCount correctly in batching mode
The counter was increased by one for each batch
instead of each frame.

PiperOrigin-RevId: 320396903
2020-07-10 09:09:12 +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
insun
9a42141e66 Toggles subtitle button's image and content description accordingly
PiperOrigin-RevId: 320323388
2020-07-09 08:04:16 +00:00
ibaker
b1e9257de1 Fix the type of message passed with MSG_PLAYBACK_INFO_CHANGED
The receiving code was updated in:
7b82a3c889
but this sending site was missed.

PiperOrigin-RevId: 320173033
2020-07-09 08:04:04 +00:00
ibaker
9b4918656f Move AnalyticsCollector setup from SimpleExoPlayer to ExoPlayerImpl
PiperOrigin-RevId: 320172040
2020-07-08 13:56:56 +01:00
olly
01249bf1cd BaseRenderer: Add getStartPositionUs
This is useful for subclasses to easily query the point up to which
they should only decode (but not render) content, rather than each
subclass having to have its own startPositionUs and update it in
onPositionReset.

PiperOrigin-RevId: 320163677
2020-07-08 13:56:47 +01:00
ibaker
61acd434f6 Rollback of 252bf43bf4
*** Original commit ***

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: 320150427
2020-07-08 13:56:38 +01:00
olly
90c17fbe84 CameraMotionRenderer: Cleanup + respect decode-only flag
PiperOrigin-RevId: 320149613
2020-07-08 13:56:29 +01:00
tonihei
8748646cb8 Remove deprecated constructor from AdaptiveTrackSelection.Factory.
This constructor and the way of passing BandwdithMeter has long been
deprecated now and can be removed.

PiperOrigin-RevId: 320147888
2020-07-08 13:56:21 +01:00
insun
b8e9f19b37 Add document for show_subtitle_button attribute
This also removes unused deprecated methods.

PiperOrigin-RevId: 320141729
2020-07-08 13:56:12 +01:00
tonihei
ebb9569624 Rollback of 75eab31d79
*** Original commit ***

Rollback of 0943886cbd

*** Original commit ***

Use last queue format instead of previous decision to select new track

We currently use the save...

***

PiperOrigin-RevId: 320015109
2020-07-08 13:56:04 +01:00
olly
9b652ac14b Fix TrackSampleTable.durationUs to be 0 for sideloaded tracks
PiperOrigin-RevId: 320006659
2020-07-08 13:55:55 +01:00
tonihei
75eab31d79 Rollback of 0943886cbd
*** Original commit ***

Use last queue format instead of previous decision to select new track

We currently use the saved selectionIndex to base our new track
selection decision on. This index might be stale if the previous
selection didn't result in a queue update (e.g. when loading live
streams where the new chunk isn't available yet).

Fix this by using the format of the last chunk to make the new decision.

Issue: #7582

***

PiperOrigin-RevId: 319991676
2020-07-08 13:55:47 +01:00
ibaker
fa594489d9 Completely separate MediaSource & DrmSession EventDispatchers
PiperOrigin-RevId: 319989989
2020-07-08 13:55:38 +01:00
tonihei
0943886cbd Use last queue format instead of previous decision to select new track
We currently use the saved selectionIndex to base our new track
selection decision on. This index might be stale if the previous
selection didn't result in a queue update (e.g. when loading live
streams where the new chunk isn't available yet).

Fix this by using the format of the last chunk to make the new decision.

Issue: #7582
PiperOrigin-RevId: 319957980
2020-07-08 13:55:21 +01:00
tonihei
b259476ab9 Remove wait time parameter for evaluateQueueSize calls.
The wait time parameter is an implementation detail where we can just
provide a default.

In addition, we should also force the evaluation when the last chunk
in the queue changed to ensure it is always evaluated before starting
to load a new chunk.

Issue: #7582
PiperOrigin-RevId: 319949251
2020-07-08 13:55:00 +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
6cf15de7e9 Re-add "waiting for keyframe" logic in MediaCodecRenderer
This is a partial revert of 0a2bacb7b7. I've added a comment
explaining why the code path is necessary after all, to avoid
future confusion.

PiperOrigin-RevId: 319822696
2020-07-08 13:54:34 +01:00
olly
93b5b947db Support decode-only metadata buffers
PiperOrigin-RevId: 319798613
2020-07-08 13:54:24 +01:00
ibaker
7474547e0f Don't clear the exception in SimpleDecoder.flush()
Clearing the exception puts the SimpleDecoder into a silent failure
state - the decoder thread is dead (because decode() has returned
false) but it's still possible to queue buffers to the decoder (they
just never get decoded). This partially reverts
4107375c9d

Also always recreate the decoder when handling an error in TextRenderer

This ensures we can try and decode a later subtitle sample after
encountering a decode error. This behaviour is what nulling out the
exception in SimpleDecoder.flush() was trying to achieve. We need to
ensure we don't start passing data to the new decoder until we've
hit the next key frame, so we throw away any non-keyframe samples
inside TextRenderer#render().

Issue: #7590
PiperOrigin-RevId: 319785908
2020-07-06 16:46:58 +01:00
ibaker
39144a7e76 Set MediaPeriodId in ProgressiveMediaPeriodTest
PiperOrigin-RevId: 319784140
2020-07-06 16:46:58 +01:00
kimvde
3612874d19 Miscellaneous fixes to FragmentedMp4Extractor
ISSUE: #7308
PiperOrigin-RevId: 319747742
2020-07-06 16:46:58 +01:00
kimvde
64a24e08fe Add compatible brands to MP4 sniffer
Issue: #7584
PiperOrigin-RevId: 319744023
2020-07-06 16:46:58 +01:00
tonihei
27c239d6b3 Directly track playback queue in AnalyticsCollector.
We currently try to keep track of the playback queue (MediaPeriodQueue)
by listening to onMediaPeriodCreated/onMediaPeriodReleased events.
This approach has some problems:
 1. It's easily broken by custom MediaSources that don't report these
    events correctly.
 2. We need to make some assumptions about what the order of these
    events actually means. For example it is currently important that
    the playing period gets released last in MediaPeriodQueue.clear()
 3. We don't see batched events (like MediaPeriodQueue.clear()), so that
    it is impossible to keep the "last reading period" for example. This
    information is needed to correctly associate renderer errors to
    periods after the queue has been cleared.

All of these problems can be solved by directly tracking the queue.

This also makes the onMediaPeriodCreated/Released/ReadingStarted events
obsolete and they can be removed in a future change.

PiperOrigin-RevId: 319739993
2020-07-06 16:46:35 +01:00
kimvde
b30e2b961f Rename some white/blacklist occurrences in core library
ISSUE: #7565
PiperOrigin-RevId: 319734842
2020-07-06 16:43:36 +01:00
kimvde
6872910d5a Add support for partially fragmented MP4s
ISSUE: #7308
PiperOrigin-RevId: 319541273
2020-07-06 16:43:26 +01:00
kimvde
0ee3a35ade Rename some white/blacklist occurences in HLS library
ISSUE: #7565
PiperOrigin-RevId: 319536055
2020-07-06 16:43:16 +01:00
ibaker
3d968dddb9 Explicitly declare IdentityHashMap types
PiperOrigin-RevId: 319520755
2020-07-06 16:43:05 +01:00
ibaker
391f9b923e TTML: Fix writingDirection to be parsed from regions not styles
It applies only to regions:
https://www.w3.org/TR/2018/REC-ttml2-20181108/#style-attribute-writingMode

PiperOrigin-RevId: 319515547
2020-07-03 15:32:01 +01:00
ibaker
f39b1d0f90 Fix TTML ruby decoding to resolve styles by ID
The current code only works if the tts:ruby attributes are defined
directly on the in-line elements. This changes that so we also consider
tts:ruby attributes on `style` nodes referenced by ID.
PiperOrigin-RevId: 319515177
2020-07-03 15:31:51 +01:00
tonihei
08478d1163 Remove throws clause from Renderer.stop
We don't need the renderer immediately after stopping, so the
renderer should not throw a checked exception until it's used again.
This is inline with the not throwing from disable().

Also, none of the known implementation throw an exception at the moment
and all reasonable base classes omit the throws clause already.

PiperOrigin-RevId: 319503643
2020-07-03 15:31:41 +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
kimvde
ccb337f2e1 MP4: set TrackSampleTable to 0 when there are no samples
Because the stbl atom is mandatory, there is no reason for having a
special C.TIME_UNSET value instead of 0.

PiperOrigin-RevId: 319496999
2020-07-03 15:31:09 +01:00