5092 Commits

Author SHA1 Message Date
tonihei
877c6965c3 Correctly report type of ParsingLoadable.
The helper method only reported DATA_TYPE_UNKNOWN even if the actual type
is known.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=200067296
2018-06-18 11:09:43 +01:00
tonihei
c1181000f9 Correctly report buffered position for multi-period window.
Currently only the buffered position in the current media period can be queried.

To achieve this, we save the buffered positions of all MediaPeriods to the
PlaybackInfo together with a list of MediaPeriodIds. ExoPlayerImpl can then
determine the correct buffered position for multi-period windows and windows
with midroll ads.

In addition, this change adds two new convenience methods to the Player interface
to query the total buffered duration across all windows and to get the buffered
duration of the content while playing an ad.

Issue:#4023

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=200041791
2018-06-18 11:08:22 +01:00
olly
d6878f152c Offset SIDX timestamps by presentationTimeOffset
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199856613
2018-06-18 11:06:51 +01:00
tonihei
fcb9ca7b81 Replace onViewportSizeChanged with onSurfaceSizeChanged in AnalyticsListener.
This allows the AnalyticsCollector to register itself as a VideoListener to
get these updates automatically instead of relying on the user to provide
updates.

The ViewportSizeReporter was amended to do the pixel to dp conversion itself.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199796532
2018-06-18 11:05:07 +01:00
andrewlewis
448ce43ddf Fix unused playlistParser in deprecated constructor
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199792156
2018-06-18 11:04:01 +01:00
eguven
fb00221d7d Fix demo app multi period stream track selection for downloading
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199791722
2018-06-18 11:02:46 +01:00
tonihei
0beff72452 Remove onNetworkTypeChanged from AnalyticsListener.
It doesn't really serve a purpose and is not automatically triggered.
Apps need to trigger it manually through
AnalyticsCollector.notifyNetworkTypeChanged which is easy to forget.
Moreover, the current network type can be obtained by Util.getNetworkType
at any time when it's needed without the need for a listener.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199790033
2018-06-18 11:01:27 +01:00
andrewlewis
f02788af4b Add support for registering custom MIME types
Also add a few missing MP4 object types.

Issue: #4264

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199778373
2018-06-18 11:00:05 +01:00
eguven
a406dc8bee Use TrackKey in place of RepresentetionKey, StreamKey, RenditionKey
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199767518
2018-06-18 10:58:52 +01:00
olly
8e65696f02 Update forced dependencies to fix release
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199758072
2018-06-18 10:57:43 +01:00
olly
b408de9ad9 Fix incorrect padding application
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199683216
2018-06-18 10:56:33 +01:00
andrewlewis
4256759011 Fix some javadoc errors
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199650794
2018-06-18 10:55:22 +01:00
aquilescanta
4bbc93b022 Add license server URL to SchemeData
Allows DrmInitData to carry a license server URL when the media declares one.

Issue:#3393

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199643743
2018-06-18 10:54:04 +01:00
tonihei
48193e2901 Add QoE field reporter for formats.
This reports video and audio format selections.
See [] for spec details.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199627176
2018-06-18 10:52:41 +01:00
aquilescanta
bb684b528e Promote getResponseHeaders to DataSource
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199607604
2018-06-18 10:51:31 +01:00
tonihei
ccc41f1adf Add surface size change callback to VideoListener.
This allows to detect changes in the surface size. SimpleExoPlayer already
has the necessary listeners to report size changes for all surfaces whose
lifecycle are managed by SimpleExoPlayer.

In a subsequent change, AnalyticsCollector can be registered as a
VideoListener to automatically notify of surface size changes.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199605434
2018-06-18 10:50:28 +01:00
tonihei
9f20683a6c Factor out Handler creation in construtor to prevent warning suppression.
Using new Handler(this) in a constructor potentially leaks an uninitialized
object. This is mostly not a problem because we don't use the Handler within
the constructor. Added a Util method to keep the warning suppression local.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199605377
2018-06-18 10:49:16 +01:00
Khang NT
3a99f965bd Correct document of PlayerView & PlayerControlView
Change R.id to R.layout
2018-06-15 00:49:27 +07:00
tonihei
cad3de91c9 Add utility methods for network type and country.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199487948
2018-06-06 19:03:25 +01:00
andrewlewis
199f686fe1 Set METADATA_KEY_TITLE
Issue: #4292

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199478946
2018-06-06 19:02:33 +01:00
andrewlewis
f59e6e572b Fix some categories of error prone warnings
When switching from Stack to ArrayDeque, calls to add() need to be replaced by
calls to push() because ArrayDeque treats the first element in the list as the
top of the stack.

String.split() has counterintuitive default behavior; see
https://github.com/google/error-prone/blob/master/docs/bugpattern/StringSplitter.md.
I've switched usages to pass limit = -1 argument, which means empty elements are
no longer removed from the end of the returned array.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199472592
2018-06-06 19:01:35 +01:00
hoangtc
a0b4e58312 Update PixelCopySurfaceCapturerV24, uses only 1 copy step.
Currently, we are using 2 copy steps for PixelCopySurfaceCapturerV24:
- Copy from the source surface to a similarly sized bitmap (using PixelCopy API).
- Copy from the bitmap to a scaled bitmap, based on the given output size, using scaledBitmap API.
This CL merges the 2 steps and uses PixelCopy API to perform copy directly from
the source surface to the bitmap of the given output size.
However, since our test uses scaledBitmap API to create reference bitmap from original image, due to various Bitmap copy optimizations (filtering, antialiasing etc...) that are different between PixelCopy API and scaledBitmap API implementations, the result images cannot be the same. We can perform the our tests by asserting that their PSNR value is very high, which means they are very similar.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199472005
2018-06-06 19:00:37 +01:00
olly
50c50a4635 Bump version + update release notes
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199453125
2018-06-06 18:59:39 +01:00
aquilescanta
645363059b Fix leak in the demo app
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199448766
2018-06-06 18:58:37 +01:00
Oliver Woodman
050ee4a0a3 Fix punctuation 2018-06-05 19:34:54 +01:00
ojw28
c7c9788f03
Merge pull request #4316 from Anton111111/dev-v2
Blacklist Moto C from setOutputSurface
2018-06-05 19:25:14 +01:00
ojw28
ad2996afe4
Merge pull request #4314 from TakuSemba/fix-bug-when-loading-init-data
close initDataSource after reading
2018-06-05 19:25:01 +01:00
tonihei
1773708fe4 Allow passing BandwidthMeter to TrackSelector and TrackSelection.Factory.
This enabled the player to specify the bandwidth meter after the track
selector and the track selection factory have been created.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199286400
2018-06-05 19:24:07 +01:00
tonihei
23afdd6f66 Add QoEAnalyticsListener implementation and test.
The implementation keeps track of QoE sessions and forwards events to the
field reporters of the relevant sessions.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199269574
2018-06-05 12:46:47 +01:00
tonihei
841ce9df71 Fix track selection nullability issues.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199266768
2018-06-05 12:45:55 +01:00
aquilescanta
17ab9da5b6 Enable java 8 for some missing projects
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199265539
2018-06-05 12:44:56 +01:00
olly
a5820b7535 Explicitly null MediaPeriod callbacks on release
If a MediaPeriod uses a Loadable, then there are typically
reference chains of the form:

LoadingThread[GCroot]->Loadable->MediaPeriod->Player

Where the player is the MediaPeriod callback. When the
player is released, this reference chain prevents the
player from being GC'd until Loadable cancellation
completes, which may not always be fast. This in turn
will typically prevent the application's activity from
being GC'd, since it'll normally be registered as a
listener on the player (directly or indirectly via
something like a view).

This change mitigates the issue by removing references
that the MediaPeriod holds back to the player. The
MediaPeriod will still not be eligible for GC, but the
player and application activity will be, which in most
cases will be most of the leak (in terms of size).

Issue: #4249

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199143646
2018-06-05 12:43:59 +01:00
eguven
810e06c338 Fix starting the download service in the background throw exception
This happens when the device screen is locked.

This fixes a previous attempt to fix the problem.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199130325
2018-06-05 12:43:03 +01:00
tonihei
0f1931cbcf Add getTransferListener to BandwidthMeter.
This will allow the player to obtain the transfer listener used by the
bandwidth meter in order to pass it automatically to the relevant data
sources.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199124880
2018-06-05 12:42:08 +01:00
andrewlewis
bdaea799f1 Fix variable name
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199120421
2018-06-05 12:41:13 +01:00
falhassen
8e4e5fe0cc Fix javadoc in CacheKeyFactory.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199110920
2018-06-05 12:40:17 +01:00
tonihei
007d3c61bd Allow setting player lazily in AnalyticsCollector.
This helps to use the AnalyticsCollector without SimpleExoPlayer. Currently,
that may be problematic, if the contructor needs the player, but in order to
create the player, one already needs the AnalyticsCollector as a listener for
the renderers.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199105012
2018-06-05 12:39:19 +01:00
falhassen
49eb27da0a Add a CacheKeyFactory to CacheDataSource.
A CacheKeyFactory can be passed to the CacheDataSource constructor, allowing clients to dynamically generate a custom cache key for any given upstream uri.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198878723
2018-06-05 12:38:20 +01:00
eguven
536bd68294 Fix starting the download service in the background throw exception
This happens when the device screen is locked.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198875192
2018-06-05 12:37:24 +01:00
olly
6cfc7b7ebb Remove Loadable.isLoadCanceled
This simplifies Loadable implementations, and also removes the
possibility of an incorrect Loadable implementation causing the
wrong Loader.Callback method being called (perviously, for the
correct method to be called, we relied on isLoadCanceled being
implemented correctly).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198871133
2018-06-05 12:36:23 +01:00
eguven
47c1404865 Avoid starting RequirementsWatcher if there is no download task
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198860680
2018-06-05 12:35:23 +01:00
tonihei
bf3c943b23 Replace hash by Object reference for uids.
There is the small (but unlikely) chance that the uids clash because the
Objects have the same hash code.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198855724
2018-06-05 12:34:27 +01:00
tonihei
b6113763b4 Allow lazy preparation of child source in a concatenation.
This adds an optional parameter to ConcatenatingMediaSource to prepare
child sources only lazily when are needed. This is helpful for long playlists
of media sources with manifests to prevent a lot of simultaneous manifest
loads.

Issue:#3972

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198855676
2018-06-05 12:33:31 +01:00
aquilescanta
7f866b2a07 Extract HlsPlaylistTracker interface
This allows injection of custom implementations and configuration of
DefaultHlsPlaylistTracker without modifying the HlsMediaSource interface.

Issue:#2844

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198846607
2018-06-05 12:32:32 +01:00
olly
29b9320fb9 Avoid possibility of leaking an activity/service context
The bug here was that we'd create a VideoFrameReleaseTimeHelper
using whatever context DefaultRenderersFactory has, and it would
then hold a reference to that context via DisplayManager. A leak
could then occur if the player outlived the life of the context
used to create it (which would be strange/unusual, but not
impossible).

Issue: #4249

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198747599
2018-06-05 12:31:11 +01:00
olly
69b4aa9e36 Explicitly null out LoadTask.callback on release
As highlighted by the ref'd issue, we can end up with
memory leaks if Loadable.load implementations take a long
time to return upon cancelation. This change cuts off one
of the two problematic reference chains.

This doesn't do much about the ref'd issue, since there's
a second reference chain that's much harder to deal with:
Thread->LoadTask->loadable. But since it's easy just to
cut this one off, I figure it makes sense to do so.

Issue: #4249

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198735386
2018-06-05 12:30:11 +01:00
tonihei
27f009d239 Enable Java 8 support.
This enables compiler support for Java 8 features.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198709705
2018-06-05 12:29:14 +01:00
tonihei
2813c0699f Clarify threading requirements for the player in the doc.
This makes the requirement that all calls are made on one thread more
explicit and also mentions this in the Getting Started guide.

Issue:#4278

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198694579
2018-06-05 12:28:16 +01:00
andrewlewis
9852af7372 Don't advertise support for video/mpeg ads
Issue: #4297

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198536888
2018-06-05 12:26:21 +01:00
andrewlewis
c7081ed764 Update IMA and Play Services
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198536438
2018-06-05 12:25:22 +01:00