685 Commits

Author SHA1 Message Date
olly
f2680d3169 Tweak readme
PiperOrigin-RevId: 376155192
2021-05-27 16:10:39 +01:00
aquilescanta
e8498054d7 Add ColorInfo to extractor tests' format serialization
PiperOrigin-RevId: 375992627
2021-05-27 10:43:36 +01:00
olly
1da25f5979 Remove deprecated MediaSource.getTag
PiperOrigin-RevId: 373222158
2021-05-12 11:52:03 +01:00
tonihei
61bbdb3794 Add missing isPlaceholder forwarding in SinglePeriodAdTimeline
Also make future similar issues less likely by adding isPlaceholder
to the set method of Period (in case forwarding Timeline
implementations use this instead of just updating values selectively)

#minor-release

PiperOrigin-RevId: 372138523
2021-05-06 13:33:06 +01:00
bachinger
4c1a294b2e Format Java source files
PiperOrigin-RevId: 372127633
2021-05-06 13:32:25 +01:00
krocard
3dc6cf6bec Deprecate EventListener in favor of Listener
#minor-release

PiperOrigin-RevId: 371348520
2021-04-30 18:56:35 +01:00
krocard
de895c4894 Add get video size
Move VideoSize in the common module and have the Player return it.

`Listener` and `AnalyticsListener` `onVideoSizeChanged` are updated
with the old method deprecated.

`VideoRendererEventListener.onVideoSizeChanged` was also migrated to
`VideoSize` but the old method is removed, not deprecated.
This is because:
 - apps calling/listening to this method is a rare and niche use-case.
 - it would introduce hard to diagnostic issues where if only the caller
   or the callee is updated to use the new method, the event will be lost.
   This doesn't occur with the other 2 listeners as the caller is always
   in ExoPlayer library and was updated to call both the old and new methods.

VideoSize is used everywhere except in `Format` as this would lead to
too much refactoring and backward compatibility breakage for little gain.

#minor-release

PiperOrigin-RevId: 371087419
2021-04-29 11:44:03 +01:00
christosts
0616c0d118 Add Player.getAvailableCommands()
Add method getAvailableCommands() in Player interface to return
the available commands. Method isCommandAvailable() moved to
BasePlayer since it can be implelented by calling
getAvailableCommands().

PiperOrigin-RevId: 370059328
2021-04-26 18:01:03 +01:00
ibaker
dafea4e40f Re-format some javadoc
PiperOrigin-RevId: 369642047
2021-04-21 18:46:00 +01:00
olly
2e5a616f26 Core/UI decoupling: Move spherical back to core
A subsequent change will make the UI module access
SphericalGLSurfaceView and VideoDecoderGLSurfaceView
using reflection, now we're at the point where we only
need to reflect the constructors.

PiperOrigin-RevId: 369630102
2021-04-21 18:45:24 +01:00
krocard
08336e372d Rollforward of Move VideoComponent to ExoPlayer
The original cl has been fixed by not implementing
VideoListener but Player.Listener in
StyledPlayerView.

VideoFrameMetadataListener and CameraMotionListener are still part
of the Player interface as a good way to break the UI dependency
on them has not yet been finalised.

PiperOrigin-RevId: 369417682
2021-04-20 14:02:48 +01:00
olly
7a13163664 MediaCodecAdapter.Factory creates a started Adapter.
This change moves the responsibility of creating, configuring and starting the MediaCodec from the MediaCodecRender to the MediaCodecAdapter.Factory.

This move allows ExoPlayer's client to decide how and when codecs are created and/or reused.

To allow the move, this CL replaces MediaCodecRenderer.ConfigureCodec with MediaCodecRenderer.getCodecConfiguration

PiperOrigin-RevId: 369273887
2021-04-20 00:10:36 +01:00
ibaker
6550ea88ea Rollback of cdebf6c68b
*** Original commit ***

Move VideoComponent in ExoPlayer

VideoFrameMetadataListener and CameraMotionListener are still part
of the Player interface as a good way to break the UI dependency
on them has not yet been finalised.

***

PiperOrigin-RevId: 369194309
2021-04-20 00:09:45 +01:00
krocard
cdebf6c68b Move VideoComponent in ExoPlayer
VideoFrameMetadataListener and CameraMotionListener are still part
of the Player interface as a good way to break the UI dependency
on them has not yet been finalised.

PiperOrigin-RevId: 368863829
2021-04-20 00:08:08 +01:00
krocard
54f3dfb453 Move DeviceComponent in ExoPlayer
PiperOrigin-RevId: 368437660
2021-04-15 10:52:35 +01:00
krocard
5ae84ab5f4 Move TextComponent to ExoPlayer
PiperOrigin-RevId: 368428647
2021-04-15 10:52:24 +01:00
krocard
4fc4ddbc6a Move AudioComponent to ExoPlayer leaving key methods in Player
PiperOrigin-RevId: 368413660
2021-04-15 10:51:05 +01:00
olly
3032252fde Use a single message for setting video renderer outputs
Previously, we had separate MSG_SET_SURFACE and
MSG_SET_VIDEO_DECODER_OUTPUT_BUFFER_RENDERER messages for
setting different types of supported output. Use of these
constants to switch between outputs during use of a player
was confusing because not all video renderers support both
message types.

To switch from VideoDecoderOutputBufferRenderer to a Surface,
it was sufficient just to send MSG_SET_SURFACE, since all
video renderers support this and clear any other output that
might be set. Conversely, to switch in the opposite direction,
just sending a MSG_SET_VIDEO_DECODER_OUTPUT_BUFFER_RENDERER was
not sufficient, because not all video renderers handle this
message to clear any previous output. Hence it was necessary to
explicitly clear a previously set surface using a separate
MSG_SET_SURFACE message. Passing two messages to switch the
output may prevent renderers from implementing the output switch
efficiently.

This change passes all outputs using a single message type, and
requires that all renderers treat unsupported outputs as though
null were passed (i.e., they clear any existing output). There
are some other miscellaneous improvements:

1. Non-surface outputs are now passed to onRenderedFirstFrame.
   This fixes a bug in SimpleExoPlayer's onRenderedFirstFrame,
   where previously it could not correctly equality check the
   output corresponding to the event to its current output in
   the VideoDecoderOutputBufferRenderer case.
2. Fix SimpleExoPlayer to report surface size changes for the
   VideoDecoderOutputBufferRenderer case. Even though the
   surface is rendered to indirectly in this case, we can still
   query (and listen to changes to) the surface's size.

PiperOrigin-RevId: 368215850
2021-04-13 18:01:28 +01:00
olly
e499f6d38c Improve tests to use output surfaces more realistically
Prior to this change, there were some unrealistic quirks in
our Robolectric tests. For example, onRenderedFirstFrame would
be called when using FakeVideoRenderer, despite no output to
render the frame to ever being set. This change improves the
realism of these tests. These changes are required for some
improvements being made to how outputs are set on video
renderers.

PiperOrigin-RevId: 367652169
2021-04-12 11:44:36 +01:00
tonihei
c455bad8f8 Add Period.isPlaceholder to fix preparation issues for concatenation.
We added a source that allows mixed placeholder and non-placeholder
periods, but have no way to denote that in the Timeline because the
placeholder flag only exists on Window level. This causes a bug if
the first item in a concatenation has a window-period offset and the
player can't detect whether it's still a placeholder or not.

Adding this flag to Period allows the player to detect this reliably.
In addition we need to make sure that re-resolving pending positions
only happens for the first placeholder period where the window-offset
can actually change. As all subsequent periods have to start at position
0, so they don't need to be re-resolved (and shouldn't).

PiperOrigin-RevId: 367171518
2021-04-09 13:18:15 +01:00
olly
1242237294 Add isBlacklisted method to ExoTrackSelection interface.
Make BaseTrackSelection blacklist and isBlacklisted methods non-final.

PiperOrigin-RevId: 366256521
2021-04-06 16:13:41 +01:00
samrobinson
3d3c90b89d Add getMediaMetadata to Player and SimpleExoPlayer.
PiperOrigin-RevId: 366240390
2021-04-01 16:06:43 +01:00
krocard
1526ca5e3c Move add/remove Player.Listener down of BasePlayer
The BasePlayer implementation of add/remove
Listener knows about Components.
As those are removed from the Player
interface, the implementation of those
methods needs to be moved down in Player
implementations.

This commit makes no functional change.

PiperOrigin-RevId: 364985291
2021-04-01 16:03:09 +01:00
krocard
774cce4df3 Make StubExoPlayer not abstract
All Player methods should throw
NotSupportedException.
Making it abstract prevents the compiler catching
non implemented methods.

PiperOrigin-RevId: 364974387
2021-04-01 16:02:59 +01:00
bachinger
dc4148d576 Add positions and new reasons to onPositionDiscontinuity
PiperOrigin-RevId: 364861539
2021-03-24 19:56:25 +00:00
krocard
bb1261da3c setPlaybackParameters no longer accepts null for DEFAULT
Null was an alias for DEFAULT. Remove this for nullness
safety in the API.

The ExoPlayer implementation still checks for null and
replaces it by DEFAULT, so this is ABI compatible.

PiperOrigin-RevId: 364370017
2021-03-24 18:05:57 +00:00
Ian Baker
6c688891e3 Merge pull request #8653 from dlafayet:textemphasis
PiperOrigin-RevId: 364363882
2021-03-24 18:05:46 +00:00
gyumin
7b4b5cbf5a Preserve window indices of Timeline when bundling
PiperOrigin-RevId: 364324490
2021-03-24 18:05:35 +00:00
olly
1affbf9357 DataSources: Enforce that opening at end-of-resource succeeds
- Update the three `HttpDataSource` implementations to use the
  Content-Range response header to determine when this is the
  case. The Content-Range header is included when the status
  code is 416. See [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/416).
- Update `ByteArrayDataSource` to conform to the requirement.
- Update `DataSourceContractTest` to enforce the requirement.

PiperOrigin-RevId: 363642114
2021-03-24 18:04:27 +00:00
krocard
b24d9f64a9 Implement deprecated getPlaybackError in PlayerBase
PiperOrigin-RevId: 363606255
2021-03-24 18:03:48 +00:00
olly
2d9177b7c2 SampleStream/SampleQueue: Introduce read flags
- SampleQueue.peek is replaced with SampleQueue.read with
  FLAG_PEEK. This also exposes peek functionality through
  SampleStream.
- Use of DecoderInputBuffer.isFlagsOnly is replaced with
  FLAG_OMIT_SAMPLE_DATA. This flag can be used with or
  without FLAG_PEEK, where-as previously the read position
  would never be advanced for an isFlagsOnly buffer.
- formatRequired is replaced with FLAG_FORMAT_REQUIRED.

PiperOrigin-RevId: 363460105
2021-03-24 18:03:28 +00:00
tonihei
31f65f63ff Remove AutoAdvancingFakeClock.
The class is just an empty shell around the super class and can be
removed.

PiperOrigin-RevId: 363386440
2021-03-24 18:03:18 +00:00
kimvde
997ea3b3c4 Replace timeline reference equality checks in FakeMediaSource
#minor-release

PiperOrigin-RevId: 363141851
2021-03-24 18:02:28 +00:00
olly
675b81e5f7 DataSource: Tighten contract to return -1 on premature end-of-input
PiperOrigin-RevId: 363001266
2021-03-24 18:02:17 +00:00
olly
10de7b2ab0 Tighten DataSource contract test assertions
Assert that opening the DataSource at the end of the resource
results in only RESULT_END_OF_INPUT being read.

open() and read() are still permitted to throw, although this
permissiveness will be removed in subsequent commits.

PiperOrigin-RevId: 362905314
2021-03-15 19:15:01 +00:00
gyumin
f8fb9dd606 Implement Bundleable for Timeline
PiperOrigin-RevId: 362474276
2021-03-12 10:53:41 +00:00
krocard
3f4f2f90b5 Move offload events to their own listener
Move offload events from Player.EventListener to
ExoPlayer.AudioOffloadListener.

PiperOrigin-RevId: 362472462
2021-03-12 10:44:50 +00:00
tonihei
4665ac5490 Add tests to DataSourceContractTest asserting uri/response headers.
These values must be null/empty while the source isn't opened. And the
Uri must be non-null if the source is open.

PiperOrigin-RevId: 362329032
2021-03-12 10:44:09 +00:00
tonihei
d9aee0f6a4 Add DataSource contract test for transfer listeners when opening fails.
TransferListener has the contract to have exactly one onTransferEnd per
onTransferStart, so the test can both assert that onTransferInitializing
is called, but not onTransferEnd (even after calling close).

PiperOrigin-RevId: 362262078
2021-03-12 10:42:55 +00:00
tonihei
bc9fb8615e Use correct period-window offset for initial prepare position.
MaskingMediaSource needs to resolve the prepare position set for a MaskingPeriod
while the source was still unprepared to the first actual prepare position.

It currently assumes that the period-window offset and the default position is
zero. This assumption is correct when a PlaceholderTimeline is used, but it
may not be true if the real timeline is already known (e.g. when re-preparing
a live stream after a playback error).

Fix this by using the known timeline at the time of the preparation.
Also:
 - Update a test that should have caught this to use lazy re-preparation.
 - Change the demo app code to use the recommended way to restart playback
   after a BehindLiveWindowException.

Issue: #8675
PiperOrigin-RevId: 361604191
2021-03-12 10:40:15 +00:00
gyumin
ffb7c466ed Implement addMediaItems(List) and clearMediaItems() in BasePlayer
PiperOrigin-RevId: 361487730
2021-03-12 10:39:54 +00:00
kimvde
0dcdbf0adf Add Player onAvailableCommandsChanged callback
PiperOrigin-RevId: 361122259
2021-03-12 10:39:22 +00:00
Denise LaFayette
f7f40bcb25 Address code review comments
- Split text emphasis mark and style into two IntDefs
- Represent textEmphasis="none" with a span rather than null
- Fixed bugs in the style parsing logic
2021-03-05 12:23:34 -08:00
Denise LaFayette
60a3af8d77 Fix broken unit test in TtmlDecoder.textEmphasis()
- Merge RUBY_POSITION with TEXT_EMPHASIS_POSITION in TtmlNode
2021-03-04 16:06:56 -08:00
Denise LaFayette
4ad6454713 Address code review comments
- Refactor TextEmphasis class to support different ordering of styles
- Merge RubySpan.Position and TextEmphasisSpan.Position
- Remove TTML constructs from Spanned classes
2021-03-04 15:49:28 -08:00
olly
560ed115df Add ResolvingDataSourceContractTest
PiperOrigin-RevId: 359783527
2021-03-02 17:03:35 +00:00
olly
759b0431bb DataSource: Tighten contract to throw if opened beyond end-of-input
Includes fixes for the HTTP implementations, which previously
broke this contract specifically in the case when a server
responds to a range request with a HTTP 200 response. To fix
this case, skipping to the requested position is moved from
read() to open(). As a side effect, this nicely simplifies
CronetDataSource!

PiperOrigin-RevId: 359737301
2021-03-02 17:03:14 +00:00
olly
c319220354 Add BandaidHttpDataSourceContractTest
Also fix a bug where BandaidHttpDataSource would pass -1 to
TransferListener.onBytesTransferred!

PiperOrigin-RevId: 359722821
2021-03-02 17:02:45 +00:00
olly
635544efe9 Add DataSourceContractTest for reading from the end with a set length
Given we're proposing to make reading from the end a non-error case,
it's important to check that we return the right thing from open(),
and that we read the right thing (i.e., nothing) once opened.

For now, this test allows quite a bit of permissiveness, in line
with other related tests. This will be tightened up in due course.

PiperOrigin-RevId: 359504075
2021-03-02 17:02:04 +00:00
Denise LaFayette
fcda8d47ff Support tts:textEmphasis in TTML parser and WebView output 2021-03-01 14:21:22 -08:00