6919 Commits

Author SHA1 Message Date
andrewlewis
12f1615205 Use MediaItem as ads identifier by default
Issue: #3750
PiperOrigin-RevId: 347572122
2020-12-17 11:25:53 +00:00
andrewlewis
0633778c70 Fix handling of repeated ads identifiers
Previously the `AdTagLoader` only had one listener which meant that updates
that should affect all periods with matching identifiers in the timeline only
affected the last-attached one. Fix this by having `AdTagLoader` track all its
listeners.

Issue: #3750
PiperOrigin-RevId: 347571323
2020-12-17 11:25:53 +00:00
tonihei
9982e1f154 Release AnalyticsListeners after calling SimpleExoPlayer.release
Currently we don't remove the AnalyticsListeners registed to
SimpleExoPlayer after calling release. We didn't do this mainly
because there are messages triggered as part of the release that
still cause interesting events (e.g. decoderDisabled with the
final counters, final dropped counts etc).

However, we should fully release/remove the listeners once these
pending events are delivered to:
 1. Not leak listener implementations (e.g. if the listener is an
    Activity)
 2. Ensure we don't send future events that may cause listeners
    to unintentionally access released or nulled variables. This
    could happen for example if someone calls a player method
    after the player was released.
In addition, we can add a onPlayerReleased callback to
AnalyticsListener to allow implementations to clean themselves up
once all pending events are delivered.

PiperOrigin-RevId: 347434344
2020-12-17 11:25:53 +00:00
christosts
e18892cd03 Make setters of TestResource.Builder accept a value.
PiperOrigin-RevId: 347388172
2020-12-17 11:25:52 +00:00
christosts
401634a9fb Create UdpDataSource contract test
PiperOrigin-RevId: 347386108
2020-12-17 11:25:52 +00:00
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
bachinger
a335c96450 Deprecate HttpDataSource.Factory.getDefaultRequestProperties
#exofixit

PiperOrigin-RevId: 347375323
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
olly
94e745872d Fix UI menu not dismissing on API level 22 and earlier
Issue: #8272
#minor-release
PiperOrigin-RevId: 347010412
2020-12-14 10:18:43 +00:00
olly
2accb41ef6 StyledPlayerControlView: Fixes for minimal mode
- Re-layer layout so that the central controls end up on
  top (and, more importantly, have preference for receiving
  touch input) if the view is so small that elements start
  to overlap. This requires splitting the background and
  the controls themselves.
- Fix bug that could cause the scrubber to not be hidden
  in minimal mode, if the mode is entered when the controls
  are not visible.
- Fix positioning of minimal controls.
- Remove scrubber padding in minimal mode, since the scrubber
- Remove unused bar_gravity value.

PiperOrigin-RevId: 347008789
2020-12-14 10:18:33 +00:00
olly
7d478a9f5a StyledPlayerControlView: Simplify layout
- Replace some magic constants with use of layout gravity where possible
- Remove some attributes that are set in code anyway
- Remove some attributes that are set to their default values
- Inline transport controls
- Minor naming cleanup

PiperOrigin-RevId: 346980595
2020-12-14 10:18:23 +00:00
krocard
7aeeb8dd22 Minor refactor in Matroska extractor
#exofixit

PiperOrigin-RevId: 346975740
2020-12-14 10:18:13 +00:00
bachinger
297c2bf901 Make StyledPlayerControlView use control dispatcher for speed changes
#exofixit

PiperOrigin-RevId: 346972678
2020-12-14 10:18:03 +00: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
aac22da2d6 Fix missing Javadoc
PiperOrigin-RevId: 346764371
2020-12-14 10:17:03 +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
bachinger
9a00ba1d38 Improve javadoc of Window.windowStartTimeMs
PiperOrigin-RevId: 346346359
2020-12-14 10:16:14 +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
93b3f43ed2 Fix some extractor nullness checks
Fix Matroska, Heif, FLAC, Ogg, Opus, Vorbis
extractor nullness check.

There should be no functional change.
Every media that fail to be parsed should still fail.
Every media that parsed successfully should still succeed.

This refactor aims to push all nullness constraints up the call stack to clarify each API nullness contract. This ensures implementation and caller have to prove their respective contract close to where such logic is implemented. This also allows to fail early if an nullness contract is broken instead of deep in the call stack.

For example, by adding a requirement that all implementation of `StreamReader.readHeaders` have to initialize `setupData.format` if the return false, each overriding method is forced to prove this next to the logic initializing it. This also means the runtime check might not be needed because the nullnessChecker can prove itself the contract holds.

This is in contrast with adding a null check at the point of usage, which will not catch logic errors where they are produce, but later when they are perceived; making it harder to debug and catching the issue at run time instead of compile time.

#exofixit

PiperOrigin-RevId: 346163124
2020-12-14 10:15:45 +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
bachinger
734565a83c Use parts when choosing next chunk after track change
Issue: #5011
PiperOrigin-RevId: 346080748
2020-12-14 10:15:05 +00:00
kimvde
dd782ef9b4 Throw ParserException if AAC config is invalid
Issue:#8295
PiperOrigin-RevId: 346064966
2020-12-14 10:14:45 +00:00
aquilescanta
0501d47144 Add iso9 to the list of supported MP4 brands
Issue: #8308
#minor-release
PiperOrigin-RevId: 345707141
2020-12-14 10:14:35 +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
kimvde
3a17dd5fec Slomo flattening: get metadata from smta box
Retrieve the capture frame rate and the SVC temporal layer count from
the smta box instead of the meta box because this is what Samsung do. It
is not guaranteed that the meta box will be present and will contain all
the necessary info in all slomo files.

PiperOrigin-RevId: 345639680
2020-12-14 10:14:14 +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
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