3636 Commits

Author SHA1 Message Date
ojw28
f4219b55e6
Merge pull request #3634 from jinminghe/bugfix/format
Set KEY_OPERATING_RATE for MediaCodecVideoRenderer.
2018-07-20 16:12:04 +01:00
tonihei
0721d372a7 Fix issue with keeping window sequence number after repeated seeks.
The number is shelved in calls to queue.clear() to keep it for the next
media period. However, the queue may also become empty by repeated calls to
advancePlayingPeriod which may happen when seeking to an unprepared period.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=205376036
2018-07-20 16:08:51 +01:00
hoangtc
ce62934861 Fix a bug with VideoRendererOutputCapturer when extracting frames of different size
Currently, when the VideoRendererOutputCapturer updates output size, it will
set the new surface, then release the old surface. This can lead to problem
when both surface depends on EGL, since the second release() can release EGL
resources of the first surface.

This CL reverses this process, and ensures that the old surface is released before the new one is created.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=205235451
2018-07-20 11:01:54 +01:00
tonihei
a076924caa Simplify using DataSource factories without a TransferListener.
Setting the transfer listener on the data source factories is only needed for debug
purposes, logging and for custom bandwidth metering which doesn't use the
player-provided bandwidth meter. As such, it is not compulsary and it should be easy
to set up the data source factory without a transfer listener.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204926083
2018-07-17 20:40:56 +01:00
tonihei
59b18a52d2 Make passing BandwidthMeter to TrackSelector and TrackSelection non-optional.
This was only needed temporatily until we could ensure that the player always
provides a BandwidthMeter.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204903640
2018-07-17 20:38:34 +01:00
olly
73af056da3 Widen setOutputSurface workaround
As part of this change:

- Don't apply the workaround on API level 27+. GTS coverage
  should prevent such devices from existing.
- Use Util.DEVICE consistently.
- Remove the "// Device name", which don't really add much
  but make extra work when updating the list.

Issue: #4468

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204889657
2018-07-17 20:35:51 +01:00
aquilescanta
f155aa2563 Add getMinimumLoadableRetryCount to LoadErrorHandlingPolicy.
This will allow deduplicating the argument from all Loader clients.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204889331
2018-07-17 20:34:36 +01:00
tonihei
6aab2bdc55 Set bandwidth meter at player level.
This bandwidth meter is then forwarded to the track selection and as a transfer
listener to media and data sources.

When no bandwidth meter is specified in the ExoPlayerFactory methods, a static
singleton instance will be used.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204881497
2018-07-17 20:32:59 +01:00
tonihei
74dadae520 Make values forwarded to bandwidth listener final again.
When notifying the bandwidth listeners of new samples, the forwarded values
need to be final to prevent concurrent access. Putting the event forwarding
into a separate method ensures the values are final.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204877650
2018-07-17 20:30:13 +01:00
olly
b25a124239 HLS: Fill primary sample formats with track format info (e.g. bitrate)
Issue: #3297

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204732266
2018-07-17 20:28:52 +01:00
eguven
7b2da629ea Make it possible to disable DownloadService notifications
Issue: #4389

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204728270
2018-07-17 20:27:30 +01:00
olly
8f0729b5ad Add AudioListener (audio equivalent to VideoListener)
Issue: #3994

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204722997
2018-07-17 20:26:27 +01:00
aquilescanta
e247a08a36 Parameterize load error handling in HLS
Issue:#2844
Issue:#2981

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204718939
2018-07-17 20:25:18 +01:00
olly
e2059eabe1 Enhance copyWithManifestFormatInfo to handle muxed manifest formats
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204470264
2018-07-17 20:22:33 +01:00
olly
450448b220 Fix bug where sourceId wasn't set for the first chunk
The sample queues haven't been created when the first init call
occurs. In this case we need to set sourceId when we subsequently
create the queues.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204467538
2018-07-17 20:21:10 +01:00
olly
ef728178a8 Improve format derivation for chunkless preparation
1. Copy label into derived formats
2. If audio is the primary track type, copy additional fields from
   the variant formats. This is probably a no-op in practice, since
   I don't think variant formats have these fields set anyway, but
   it seems like the right thing to do in case they ever are set in
   the future.

Note: It's a bit strange to use createXContainerFormat rather than
createXSampleFormat, but in practice the methods used here are
better matched for what we're trying to do.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204467287
2018-07-17 20:19:57 +01:00
hoangtc
19cc2c822a Fix a bug with TTML using font size as % of cellResolution.
After [] we support default font size for TTML, relative to the cellResolution of the document. However, this introduced a bug that makes TTML font-size in such case always follow the cellResolution font size, even when SubtitleView.setApplyEmbeddedStyles(false) and SubtitleView.setApplyEmbeddedFontSizes(false) were used.

This CL updates the fix so that the default font-size using cellResolution works in the same way as other embedded styles, and can be turned off using setters from SubtitleView.

GitHub: #4491

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204467033
2018-07-17 20:18:52 +01:00
hoangtc
7cba5429fc Add supports for frame-capture retrying for MetadataRetriever.
For the MetadataRetriever, for certain queries, after setting up the player to
render a frame (by seeking to the position), sometimes the player will seek to
the same position and ignore the seek, leading to the frame not being captured,
leaving the retriever in deadlock, waiting for the frame forever. This CL adds
a retry timer to avoid this and make sure we can return query result after some
time.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204460200
2018-07-17 20:17:36 +01:00
olly
cba6da8906 No-op cleanup of DashTimeline
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204451894
2018-07-17 20:16:14 +01:00
olly
18ab4b9112 Fix / improve format merging
1. Prefer label and language values in the manifest to those in
   the media. This is particularly helpful if the sample format
   contains "und" as the language.
2. Copy label when deriving formats in HlsSampleStreamWrapper
3. When there's only one variant in HlsSampleStreamWrapper, use
   the regular copyWithManifestFormatInfo. This allows more
   information to be retained from the sample format.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204340008
2018-07-17 20:13:23 +01:00
Jinming he
5cdb886db1 Address comments. 2018-07-16 21:36:00 +08:00
Jinming he
db53606c1d Merge master into bugfix/format. 2018-07-16 21:04:25 +08:00
Oliver Woodman
05a31dfd24 Format cleanup 2018-07-12 16:08:11 +01:00
ojw28
41636ada88
Merge pull request #4391 from kaltura/add-label
Add label attribute support for DASH audio/text
2018-07-12 16:05:19 +01:00
Oliver Woodman
e4b05a5ae6 Merge branch 'dev-v2' of https://github.com/JungleGenius/ExoPlayer into JungleGenius-dev-v2 2018-07-12 15:54:47 +01:00
ojw28
423cfa3b73
Merge pull request #4442 from keiththompson/keiththompson__/skip_ad_within_ad_group
Add withSkippedAd method to AdPlaybackState.
2018-07-12 15:48:05 +01:00
ojw28
651cfd9ebb
Merge pull request #4480 from drhill/dev-v2_mkv_forced_default_flipped
MKV Extractor flip default and forced flag values to their proper names
2018-07-12 15:46:49 +01:00
andrewlewis
44c253058e Ignore all edit lists if one track's edits can't be applied
Issue: #4348

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204261718
2018-07-12 15:40:11 +01:00
tonihei
78d7754f29 Add addListener/removeListener to BandwidthMeter.
That allows to add listeners after the BandwidthMeter has been created which is
helpful as the BandwidthMeter instances are often long-lived static instances.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204255299
2018-07-12 15:39:05 +01:00
matttt
9914587894 Remove the static modifier from DefaultDashChunkSource::newMediaChunk and DefaultDashChunkSource::newInitializationChunk allowing for overrides.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204167521
2018-07-12 15:37:52 +01:00
aquilescanta
32a91b5689 Add LoadErrorHandlingPolicy to customize blacklisting and backoff logic
Issue:#2844
Issue:#3370
Issue:#2981

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204149284
2018-07-12 15:36:35 +01:00
tonihei
095c6e4bf8 Add MediaChunkIterator for HLS media playlists.
This allows to iterate through the available segments of the playlist.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204100116
2018-07-11 14:57:49 +01:00
hoangtc
39b812298d Add supports for reading duration for a PS stream.
Add supports for reading duration for a PS stream by reading SCR values from
the header of packs at the start and at the end of the stream, calculating the
difference, and converting that into stream duration.

Github: #4476

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203954752
2018-07-11 14:56:54 +01:00
tonihei
68822c0c41 Remove BandaidTransferListener.
It has now become an empty shell as the real TransferListener provides all its
methods.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203950443
2018-07-11 14:55:54 +01:00
tonihei
c3df64f102 Extend TransferListener with onTransferInitializing and additional parameters.
This allows more fine-grained analysis of transfers.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203950327
2018-07-11 14:54:35 +01:00
tonihei
2b1434dfcb Change DataSource.Type to a boolean.
There are only two types at the moment and we can therefore use a boolean.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203937357
2018-07-11 14:53:14 +01:00
eguven
18d208ab93 Fix DownloadService doesn't stop when the app is killed
Also fixed showing "remove notification" when download is completed.

Issue:#4469
Issue:#4488

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203927268
2018-07-10 14:03:05 +01:00
anjalibh
e60de62588 Libvpx: Support directly outputting YUV to SurfaceView. This is supposed to use hardware (not GPU) to convert YUV to RGB and overall use less power.
Power Comparison:

TextureView                          1080p         720p
                H264 HW              498, 496      507, 478
                VP9 RGB              1050, 1104    1185, 1152
                VP9 ANativeWindow    1070, 985     700, 674
GLSurfaceView
                VP9 YUV              1075, 1112    716, 635
SurfaceView
                H264 HW              419, 409      397, 377
                VP9 RGB              1044, 1139    654, 671
                VP9 ANativeWindow    975, 835      617, 623
                VP9 MediaCodec       683, 679      488, 476

Measures average current drawn mAH on a Nexus 6 at full brightness from time t=3 to t=95 seconds. The same clip was used for all tests. Two measurements were taken for each category.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203847744
2018-07-10 14:01:50 +01:00
olly
17a58969af Move subsampleOffset in Format
It's no longer text specific (it's used for metadata as well, and
in theory could apply to any stream in which samples contain multiple
sub-samples)

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203767825
2018-07-10 14:00:30 +01:00
tonihei
5c9fd1649a Fix wrong loop variable in DashMediaPeriod.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203766579
2018-07-10 13:59:19 +01:00
tonihei
74d8f89cb6 Restructure track selection in DashMediaPeriod.
Until now, the streams were released and re-enabled for each type of stream
(primary, event, embedded) in that order. That leads to problems when replacing
streams from one type to another (for example embedded to primary).

This change restructures the track selection to:
1. Release and reset all streams that need to be released or replaced.
 1(a). Including embedded orphan streams.
2. Select new streams.

Issue:#4477

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203751233
2018-07-10 13:58:18 +01:00
olly
dc8b73d372 Apply setOutputSurface workaround to all non-Google decoders
Where a device has this issue, it most likely applies to all
SOC vendor provided decoders, which are normally the only
video decoders other than the OMX.google software decoders
on the device. The fact we currently only blacklist for AVC
decoders is likely just a side effect of AVC's popularity.

I checked two devices already on the blacklist, and both
failed with other SOC vendor decoders on the device as well
(but passed if forced to use OMX.google decoders instead)

Issue: #4468

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203728285
2018-07-10 13:57:10 +01:00
olly
13789a3c1d Tweak DefaultTrackSelector documentation
Viewport constraints apply to adaptive content even if the
actual playback isn't adaptive (i.e. because the selector
ends up making a fixed track selection).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203726831
2018-07-10 13:55:51 +01:00
Drew Hill
e807212514 flip flag values to their proper names so that trackselector parameters can be useful 2018-07-07 12:28:58 -04:00
Oliver Woodman
8fa34c1ed6 Delete stray file 2018-07-06 18:26:49 +01:00
hoangtc
c1acf87fba Support handling frame queries for MetadataRetriever.
- Support handling frame queries (i.e get frames at times, output to certain
sizes) from MetadataRetriever.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203489788
2018-07-06 17:59:21 +01:00
tonihei
2c00be1aa3 Add workaround for unmatched track indices in tkhd and tfhd.
If there is only one track, we can assume that both boxes refer to the same track
even if the track indices don't match.

Issue:#4083

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203485872
2018-07-06 17:58:08 +01:00
olly
3b70d1d889 Avoid providing invalid responses to MediaDrm
MediaDrm.provideXResponse methods only accept the response
corresponding to the most recent MediaDrm.getXRequest call.
Previously, our code allowed the following incorrect call
sequence:

a = getKeyRequest
b = getKeyRequest
provideKeyResponse(responseFor(a));

This would occur in the edge case of a second key request
being triggered whilst the first was still in flight. The
provideKeyResponse call would then fail.

This change fixes the problem by treating responseFor(a)
as stale. Note that a slightly better fix would be to
defer calling getKeyRequest the second time until after
processing the response corresponding to the first one,
however this is significantly harder to implement, and is
probably not worth it for what should be an edge case.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203481685
2018-07-06 17:56:58 +01:00
tonihei
1cf8b255dc Add workaround for unmatched track indices in trex and tkhd.
Both boxes should contain the same list of track indices. However, if only one
track index in each list does not match, we can just assume that these belong
together.

Issue:#4477

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203481258
2018-07-06 17:55:47 +01:00
olly
bd952a802a Re-merge output surface workarounds and add TODO list
Issue: #4468

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203479944
2018-07-06 17:54:33 +01:00