6886 Commits

Author SHA1 Message Date
olly
0f64ace515 Only set experimentalSetForegroundModeTimeoutMs value when it's > 0
PiperOrigin-RevId: 345489364
2020-12-14 10:13:51 +00:00
olly
2980354510 VideoFrameReleaseTimeHelper: Account for playback speed
Previously the helper would constantly lose (or never establish) sync
for non-1x playback speeds. This changes the helper to account for
other playback speeds correctly.

PiperOrigin-RevId: 345458859
2020-12-03 17:13:21 +00:00
ibaker
74bbd5367e Gracefully handle null-terminated subtitle content in MKV containers
This was reported for SSA/ASS in PR #8265, but it seems to me the
SubRip part of the Matroska spec is similarly loose, so this change
handles null-terminated strings in both.

#minor-release

PiperOrigin-RevId: 345452667
2020-12-03 17:13:12 +00:00
ibaker
95e2ce26f3 Update the log tag of DefaultAudioSink
The old tag reflects the original name of this class. It was renamed in
2017:
<unknown commit>

Possibly the old name was kept for compatibility with existing logs
analysis? I didn't see an explicit discussion of this in the review
comments of the rename change.

The current tag confused me slightly - I assumed a line was being
emitted by the android.media.AudioTrack rather than ExoPlayer's
DefaultAudioSink.

PiperOrigin-RevId: 345450056
2020-12-03 17:13:03 +00:00
olly
2766211d0c Disable VSYNC adjustments if display cannot be queried
PiperOrigin-RevId: 345442367
2020-12-03 17:12:50 +00:00
bachinger
3b7aa1d5f1 Use HLS rendition report when changing primary playlist
Issue: #5011
PiperOrigin-RevId: 345440697
2020-12-03 17:12:41 +00:00
Oliver Woodman
5211a1f0a7 Merge pull request #8154 from samoylenkodmitry:handle_out_of_space
PiperOrigin-RevId: 345428731
2020-12-03 17:12:15 +00:00
bachinger
4907c2153b Add FLAG_MIGHT_NOT_USE_FULL_NETWORK_SPEED to HLS preload media chunks
Issue: #5011
PiperOrigin-RevId: 345425048
2020-12-03 17:12:04 +00:00
krocard
09509c2390 Simple migration to common
Migrate all classes that are simple to move to
common.

#player-to-common

PiperOrigin-RevId: 345412080
2020-12-03 17:11:56 +00:00
andrewlewis
ebe54113a9 Fix SonicAudioProcessor end of stream behavior
The `AudioProcessor` interface requires that no more input is queued after
queueing end of stream, but `DefaultAudioSink` did queue more input and the
implementation of `SonicAudioProcessor` actually relied on this to drain output
at the end of the stream.

Fix this behavior by getting `Sonic` output in `getOutput` and having
`DefaultAudioSink` only queue input to processors that are not draining.

Also add TODOs to clean up audio processor implementations where the code
handles interaction that doesn't conform to the interface.

PiperOrigin-RevId: 345406478
2020-12-03 17:11:47 +00:00
krocard
830982496d Move Timeline to common
PiperOrigin-RevId: 345398603
2020-12-03 17:11:38 +00:00
krocard
553d5351c2 Move Renderer.VideoScalingMode back to C
As Player depends on VideoScalingMode, and
Renderer should not move to common,
to move Player to common, VideoScalingMode
needs to move first.

#player-to-common

PiperOrigin-RevId: 345314448
2020-12-03 17:11:30 +00:00
bachinger
affdff65e3 Remove HLS chunks based on parts not in playlist anymore
Issue: #5011
PiperOrigin-RevId: 345275266
2020-12-03 17:11:22 +00:00
ibaker
10b9de8342 Add an MKV asset with SSA subtitles for extractor and playback tests
Asset generated using a temporary SSA file and:
```
$ mkvmerge -o sample_with_ssa_subtitles.mkv sample.mkv input.ssa
```

PiperOrigin-RevId: 345217628
2020-12-03 17:11:13 +00:00
Oliver Woodman
b22b53f6f1 Merge pull request #8215 from TiVo:p-fix-apple-iframe-bug
PiperOrigin-RevId: 345202157
2020-12-03 17:11:03 +00:00
olly
8192bb5503 VideoFrameReleaseTimeHelper: Simplify and add comments
PiperOrigin-RevId: 345198316
2020-12-03 17:10:53 +00:00
olly
69dcad71de Update StyledPlayers control overlay scrim from 30% opacity to 60% opacity for Accessibility requirements.
PiperOrigin-RevId: 345190774
2020-12-03 17:10:44 +00:00
christosts
1ff0965a10 Do not advance SystemClock manually in tests
Changes MetadataRetriever and Transformer so that their
respective tests don't need to manually control the SystemClock
in order to execute taks posted with delay from Loader.

PiperOrigin-RevId: 345024140
2020-12-03 17:10:19 +00:00
bachinger
1a5d79b78a Schedule load for non-primary playlist for low latency streams
Low latency streams potentially need to remove preload chunks in case they are removed from the playlist. Hence we need to schedule loading the next playlist even if the playlist is not a primary playlist.

Issue: #5011
PiperOrigin-RevId: 344995891
2020-12-03 17:10:10 +00:00
andrewlewis
c7e1d3f222 Mark assertion methods as @Pure
See https://checkerframework.org/manual/#type-refinement-purity.

PiperOrigin-RevId: 344994705
2020-12-03 17:10:01 +00:00
andrewlewis
69dad31b67 Mask ad media periods before the URI is available
Previously `MediaPeriodQueue` would return null if an ad media URI hadn't
loaded yet, but this meant that the player could be stuck in `STATE_READY` if
an `AdsLoader` unexpectedly didn't provide an ad URI. Fix this behavior by
masking ad media periods. `MaskingMediaPeriod` no longer requires a
`MediaSource` to instantiate it.

This also fixes a specific case where playback gets stuck when using the IMA
extension with an empty ad where the IMA SDK unexpectedly doesn't notify the ad
group fetch error.

Issue: #8205
PiperOrigin-RevId: 344984824
2020-12-03 17:09:53 +00:00
tonihei
8349d7849e Prevent reading into preload parts.
This is to ensure we can still discard the data if needed.

Issue: #5011
PiperOrigin-RevId: 344977548
2020-12-03 17:09:44 +00:00
ibaker
84a7ffc12a Add ParsableByteArray#ensureCapacity() method that keeps data
#exofixit

PiperOrigin-RevId: 344845328
2020-12-03 17:09:35 +00:00
samrobinson
7e635d9560 Set Format gapless info separately to Metadata in Extractors.
PiperOrigin-RevId: 344838400
2020-12-03 17:09:26 +00:00
bachinger
e6046a5c07 Discard HLS preload chunks when an HTTP 410 or 404 occurs
This change avoids an early fatal exception for replaced hinted parts.

Issue: #5011
PiperOrigin-RevId: 344828076
2020-12-03 17:09:17 +00:00
ibaker
e508fb64f3 Bump version to 2.12.2
PiperOrigin-RevId: 344801462
2020-11-30 16:11:44 +00:00
tonihei
f8041e1bc0 Add explaning comment to UI proguard file.
PiperOrigin-RevId: 344787160
2020-11-30 16:11:27 +00:00
tonihei
9f6ff55c0f Replace PeriodSeekInfo by static methods.
The inner class was only used to obtain 3 distinct pieces of
information which is better handled by static methods.

#exofixit

PiperOrigin-RevId: 344767661
2020-11-30 09:33:22 +00:00
krocard
538445572d Move FormatSupport in common
#player-to-common

PiperOrigin-RevId: 344558028
2020-11-30 09:33:11 +00:00
andrewlewis
4446e2637d Fix unexpected multiline comments
#exofixit

PiperOrigin-RevId: 344517105
2020-11-30 09:32:25 +00:00
samrobinson
6d01d40971 Remove unused get*Format from MediaCodecRenderer.
#exofixit

PiperOrigin-RevId: 344516187
2020-11-30 09:32:13 +00:00
krocard
93506f6395 Copy REPEAT_MODE to C temporary for timeline
This copy will be removed once Player is migrated to
common.

#exo-offload

PiperOrigin-RevId: 344515979
2020-11-30 09:32:01 +00:00
ibaker
46598a46fd Audit usages of ParsableByteArray#reset(int)
This method should be assumed to clear the data of the underlying array
(it will do this if the new limit > data.length).

This means it should only be called (directly) before writing into the
backing array.

It shouldn't be used as a shorthand for position=0, limit=x - those
should be two explicit method calls.

Most of these changes are no-ops, but they make the code more correct.

The TS SectionReader can't be easily changed to be 'safe', because it
relies on sectionData maintaining state between iterations of the while
loop. Instead I've added comments justifying the existing code.

PiperOrigin-RevId: 344515340
2020-11-30 09:31:49 +00:00
olly
9d8a41712d Move AnalyticsCollector method to correct block
#exofixit

PiperOrigin-RevId: 344428571
2020-11-27 11:08:42 +00:00
tonihei
87cd644d00 Add remaining proguard config tests.
This ensures we have full test coverage for proguard configs now.
The only configs not covered by tests are:
 - IMA and OkHttp which copy recommended configs from the respective
   library. I couldn't reproduce failures by removing them (and thus
   couldn't write a test that ensures they are correct).
 - Some dontwarn lines that just suppress warnings.

In addition, this change fixes a couple of related issues:
 - Moved AV1 proguard config to correct module.
 - Removed mentioning of deprecated ExtractorMediaSource from README
 - Suppressed warning from IMA code that prevent proguarding under
   strict rules
 - Fixed wrong proguard exclusion in VP9 module.
 - Moved FLAC exclusion (DefaultExtractorsFactory) to correct module.
 - Added AlertDialog suppression for de-jetified code.
 - Removed unusued dependency from UI module that causes large APK
   size increase.

#exofixit
#minor-release

PiperOrigin-RevId: 344427532
2020-11-27 11:08:34 +00:00
olly
596dca6a86 SonicAudioProcessor: Fix scaling to account for pending input bytes
PiperOrigin-RevId: 344420436
2020-11-27 11:08:18 +00:00
tonihei
3f6ec59868 Improve PlaybackStatsListener by using onEvents callback
Previously the PlaybackStatsListener needed to handle all events
individually, which required to keep some state of the player and
to resolve potentially transient state changes.

Using onEvents allows to channel all simultanous updates through
one method so that no transient player state and other
inconsistencies need to be handled. This makes the logic easier
to read.

In addition it also allows to resolve all simultaneous events to
use one EventTime (with one timestamp).

#exofixit

PiperOrigin-RevId: 344415459
2020-11-27 11:08:10 +00:00
samrobinson
f1cf3d98d8 Add Format field to AudioSink.WriteException.
#exofixit

PiperOrigin-RevId: 344414313
2020-11-27 11:08:02 +00:00
olly
dd0246a31c DefaultAudioSink: Fix transient position calculation errors
PiperOrigin-RevId: 344408351
2020-11-27 11:07:47 +00:00
sungsoo
43713abe79 Add MediaUtilsTest
PiperOrigin-RevId: 344384426
2020-11-27 11:07:39 +00:00
olly
2fbad2105e Make special exception for cleartext-not-permitted
#exofixit

PiperOrigin-RevId: 344246408
2020-11-27 11:07:07 +00:00
olly
1201466b5c Fix NPE in onInputFormatChanged
PiperOrigin-RevId: 344243929
2020-11-27 11:06:59 +00:00
ibaker
3aa17bfb9b Switch extractor tests to single-parameter parameterized syntax
This is simpler than instantiating a single-element string array for
every parameter.

#exofixit

PiperOrigin-RevId: 344237475
2020-11-27 11:06:51 +00:00
samrobinson
8c9b92efc1 Add Format field to AudioSink.InitializationException
#exofixit

PiperOrigin-RevId: 344232362
2020-11-27 11:06:43 +00:00
tonihei
87e141d376 Remove boilerplate setting up FakeTimeline and FakeMediaSource.
In many cases it doesn't matter for the test itself how many windows
a timeline has, or even how the timeline of a MediaSource looks like.

And since we introduced the MediaItem-based APIs, single-window
Timelines are the only fully supported Timelines. Thus there is no
point in specifiying this explicitly.

Using these assumptions, we can remove some boilerplate when setting
up standard FakeTimelines or FakeMediaSources with a standard
FakeTimeline.

#exofixit

PiperOrigin-RevId: 344210395
2020-11-27 11:06:27 +00:00
olly
b7047a2467 Improve Player next/previous documentation
#exofixit
Issue: #5602
PiperOrigin-RevId: 344093622
2020-11-27 11:06:19 +00:00
tonihei
06bd3a65fe Don't inform of static metadata changes if they are all empty.
The current code creates placeholder metadata elements if there is no
static metadata. This causes onStaticMetadataChanged callbacks even
if there is no metadata.

Instead, we can keep the empty list as the static metadata is already
documented to be an empty list if the metadata is unavailable.

#exofixit

PiperOrigin-RevId: 344071639
2020-11-27 11:06:11 +00:00
bachinger
c17d1091f3 Remove "live" from fields in MediaItem.LiveConfiguraton
#exofixit

PiperOrigin-RevId: 344065519
2020-11-27 11:05:54 +00:00
olly
93ed71fb3e Support enabling next/previous actions in PlayerNotificationManager
The ref'd issue was marked as a doucmentation candidate, but I think
the confusion likely arises from the lack of "next" and "previous" in
the method names. Our other UI components also support enabling each
button individually, so this also brings notifications in line with
those.

Issue: #6491
#exofixit
PiperOrigin-RevId: 344058969
2020-11-24 16:04:14 +00:00
kim-vde
1cd08519f1 Merge pull request #8257 from xufuji456:dev-v2
PiperOrigin-RevId: 344057097
2020-11-24 16:04:04 +00:00