3914 Commits

Author SHA1 Message Date
krocard
d857eec1f7 Move classes Player depends on to common
This will allow player to be moved to common.

#player-to-common

PiperOrigin-RevId: 347375344
2020-12-17 11:25:52 +00:00
olly
5aac1898bb Use longs to avoid intger overflow
PiperOrigin-RevId: 347351440
2020-12-17 11:25:36 +00:00
sneelavara
b70f08b740 CEA-708 Decoder fixes for issue #1807
Fixed the verticalAnchorType and horizontalAnchorType calculation

The anchorID 0, 1 and 2 should correspond to verticalAnchorType=ANCHOR_TYPE_START, anchorID 3, 4, 5 is ANCHOR_TYPE_MIDDLE, anchorID 6, 7 and 8 is ANCHOR_TYPE_END

The anchorID 0, 3 and 6 should correspond to horizzonatlAnchor=ANCHOR_TYPE_START, anchorID 1, 4, 7 is ANCHOR_TYPE_MIDDLE, anchorID 2, 5 and 8 is ANCHOR_TYPE_END
2020-12-16 16:22:12 -08:00
bachinger
2ee40270e5 Support setPlaybackSpeed(float) with the MediaSessionConnector
Issue: #8229
#exofixit
PiperOrigin-RevId: 346968046
2020-12-14 10:17:53 +00:00
kimvde
4ee02a27de Mp4Extractor: add smta metadata to audio track
This is needed for slomo audio flattening.

PiperOrigin-RevId: 346965990
2020-12-14 10:17:43 +00:00
ibaker
73b9cee83a Add a ContentDataSource contract test
PiperOrigin-RevId: 346954787
2020-12-14 10:17:33 +00:00
bachinger
05c928f96d Add live configuration to Timeline.Window
Issue: #5011
PiperOrigin-RevId: 346828103
2020-12-14 10:17:23 +00:00
christosts
392b3ab573 Inject MediaCodecAdapter.Factory
Make the MediaCodecFactory injectable from the constructors of
MediaCodecAudioRenderer and MediaCodecVideoRenderer.

PiperOrigin-RevId: 346784661
2020-12-14 10:17:13 +00:00
olly
d01654386f VideoFrameReleaseTimeHelper: Split out frame-rate estimation
PiperOrigin-RevId: 346554044
2020-12-14 10:16:43 +00:00
tonihei
f18d81f8a8 Ensure onEvents is called when listener is removed.
When a listener is removed or released we may not have called
onEvents for events that happened before this point. To ensure
listeners don't miss events we need to trigger a final onEvents
with all events we have happened so far (if any).

PiperOrigin-RevId: 346553030
2020-12-14 10:16:34 +00:00
christosts
e7f5912677 Add Factory to MediaCodecAdapter
In a later change, MediaCoderAdapter.Factory will be injectable to
MediaCodecRenderer.

PiperOrigin-RevId: 346525171
2020-12-14 10:16:24 +00:00
aquilescanta
9eef7b06f7 Ease the creation of SampleQueues without DRM management
This is useful in cases where the client is not interested in DRM.

PiperOrigin-RevId: 346313024
2020-12-14 10:16:04 +00:00
krocard
42f5e53def Add an TrackSelector base interface
This will allow Player to move in common without
trackSelector and all its many dependency.

Currently all users of `getTrackSelector` are
downcasting it in `DefaultTrackSelector`, this change
thus does not break them.

Track selection API is intended to be reworked, methods
will be added to the currently empty interface.

#player-to-common

PiperOrigin-RevId: 346159765
2020-12-14 10:15:35 +00:00
krocard
b5f0379ba0 Move ExoPlaybackException in common
This is needed to move Player in common.

#player-to-common

PiperOrigin-RevId: 346157905
2020-12-14 10:15:25 +00:00
krocard
7d3e5f2af8 Move MediaPeriodId in common minimalistically
This is needed to move ExoPlayerException in common.
The follow up cl moves MediaPeriodId completely.

#player-to-common

PiperOrigin-RevId: 346133091
2020-12-14 10:15:15 +00:00
krocard
f0edcc4003 Reference C.FORMAT_* in deprecated RendererCapabilities
Avoid duplicating the values.

#player-to-common

PiperOrigin-RevId: 345642356
2020-12-14 10:14:24 +00:00
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
Oliver Woodman
5211a1f0a7 Merge pull request #8154 from samoylenkodmitry:handle_out_of_space
PiperOrigin-RevId: 345428731
2020-12-03 17:12:15 +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
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
olly
8192bb5503 VideoFrameReleaseTimeHelper: Simplify and add comments
PiperOrigin-RevId: 345198316
2020-12-03 17:10:53 +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
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
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
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
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
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
andrewlewis
866c7f85f8 Allow playing ads in playlists
- Remove restriction on `AdsMediaSource`s in playlists in `ExoPlayerImpl`.
- Allow playing playlists of `AdsMediaSource`s in the demo app.
- Add a sample with ads in a playlist in the demo app.

Issue: #3750
PiperOrigin-RevId: 344018774
2020-11-24 16:03:04 +00:00