3936 Commits

Author SHA1 Message Date
tonihei
5ce2f1763d Check if source has been prepared before releasing it.
In ConcatenatingMediaSource, the source may be removed before it started
preparing (this may happen if lazyPreparation=true). In this case, we
shouldn't call releaseSource as the preparation didn't start.

Issue:#4986

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=218141658
2018-10-24 18:30:51 +01:00
eguven
ea49d39a4d Add VR string and icon
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=218137830
2018-10-24 18:29:10 +01:00
olly
62759e8dd6 Cleanup VR video player sample app
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=218003875
2018-10-24 18:25:51 +01:00
olly
f3b4575436 Temporarily disable codec reuse
There are multiple subtle issues with the current implementation:

1. setOperatingRate can cause a codec initialization even if the
   renderer is disabled. This is not supposed to happen.
2. If the codec is released whilst the renderer is disabled, the
   renderer can instantiate a new codec using the old format when
   it's enabled again, only to immediately have to reconfigure or
   release it if the actual format to be played is different.
3. Codec reuse does not take into account renderer configuration.
   The specific case where this is problematic is if the video
   renderer is re-enabled with a different tunneling session id.
   The reused codec is then not configured correctly.

Also moved availableCodecInfos reset into releaseCodec for sanity.

Issue: #2826

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217924592
2018-10-24 18:24:12 +01:00
andrewlewis
bb5a9ef8ad Remove extra blank line
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217907544
2018-10-24 18:22:31 +01:00
olly
42c9b244ee Make context non-optional in AudioFocusManager
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217897796
2018-10-24 18:20:54 +01:00
tonihei
6977fdbc1d Properly reset period id and start position in ExoPlayerImpl.
This is a no-op change as the respective values are not used so far but
the change makes the current state cleaner and is less error-prone.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217892421
2018-10-24 18:17:33 +01:00
olly
ca4b5d0a0d Make context non-optional for DefaultBandwidthMeter
- Added ability to override the DefaultBandwidthMeter network type.
- These methods currently only work properly if called before the
  meter is used, but the plan is for them to be handled in the same
  way as internally detected network changes.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217887019
2018-10-24 18:15:53 +01:00
tonihei
4c6507e7a0 Remove deprecated MediaSource.prepareSource.
This method only ensured backward compatibility while the new version was not
public yet. Now ExoPlayer 2.9.0. is public, this workaround can be removed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217881691
2018-10-24 18:14:09 +01:00
olly
bf57d44023 Update VR video player sample app
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217874381
2018-10-24 18:12:29 +01:00
eguven
8f3c3e2841 Add GlUtil createBuffer overload which doesn't copy values
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217846755
2018-10-24 18:10:43 +01:00
olly
1ef3efaa90 Automated g4 rollback of changelist 217356705.
*** Reason for rollback ***

Photos regression is resolved by []

*** Original change description ***

Automated g4 rollback of changelist 217189082.

*** Reason for rollback ***

Broke photos (b/117818304)

*** Original change description ***

Add ExoPlayer.setForegroundMode

Issue: #2826

***

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217773278
2018-10-18 23:39:51 +01:00
olly
3805717026 Decouple dummySurface lifespan from codec lifespans
I don't think there's any particular reason for releasing
dummySurface when we release the codec. It seems to make
more sense to decouple the two, and treat a dummySurface as
a resource that should be released on reset.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217711788
2018-10-18 23:39:51 +01:00
olly
1c6abc8b03 Set output on surface in all states
setSurface only sets the output surface on the codec if the
renderer is enabled or started. This was fine in the past
because the codec was always null in other states, however
the recent codec reuse work means this is no longer the case.

The output surface should always be set if the codec is
non-null. If setting the surface requires releasing the codec
instance, we should only instantiate the new instance if
enabled or started. This is in line with what onDisabled does
if flushing requires releasing the codec

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217676434
2018-10-18 23:39:51 +01:00
olly
05a98a7b79 Code shrinking doesn't like Class.super.defaultMethodName
Just not doing it seems simplier and more obviously correct
than suppressing the warnings in our proguard file.

Issue: #4890

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217675527
2018-10-18 23:39:51 +01:00
eguven
86fdcb08d8 Fix documentation confusion in MediaChunkIterator subclasses
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217505571
2018-10-18 23:39:51 +01:00
falhassen
423a954e1b Automated g4 rollback of changelist 217189082.
*** Reason for rollback ***

Broke photos (b/117818304)

*** Original change description ***

Add ExoPlayer.setForegroundMode

Issue: #2826

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217356705
2018-10-18 23:39:31 +01:00
andrewlewis
ee02c6789a Support seeking based on MLLT metadata
Issue: #3241

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217252254
2018-10-18 23:20:54 +01:00
olly
bfd67992f4 Add ExoPlayer.setForegroundMode
Issue: #2826

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217189082
2018-10-18 23:19:09 +01:00
olly
dbf5b073a6 Network type cleanup
1. Remove option to pass null context to Util.getNetworkType. IMO it's
   clearer for the caller to just not call the method in this case.
2. Stop using deprecated DefaultBandwidthMeter.Builder constructor in
   all but one place.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217147091
2018-10-18 23:17:16 +01:00
olly
6e7b41512f No-op cleanup of DefaultDrmSessionManager
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217139869
2018-10-18 23:15:34 +01:00
olly
6fb8f66ba6 Remove assertion causing failure on some Samsung devices
The assertion was so weak it probably wouldn't detect genuine
misuse of the DefaultAllocator API, so it seems fine just to
remove it.

We don't really know what happens when the player is allowed to
continue on the affected devices, but hopefully it either "just
works" or fails in a more graceful way.

Issue: #4532

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217113060
2018-10-15 11:14:56 +01:00
olly
d511370338 Fix DashManifestParser to properly skip unknown tags
Robustness fix to make sure we ignore tags with known names, but
which are nested inside of unknown tags. For example we don't want
to parse the third period in:

<Period>...</Period>
<Period>...</Period>
<CustomTag>
  <Period>...</Period>
</CustomTag>

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217101630
2018-10-15 09:36:56 +01:00
olly
ba6a118998 Retain decoder instance after the renderer is disabled
Issue: #2826

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=216852679
2018-10-15 09:35:23 +01:00
olly
842f622d29 Allow codec flushing without re-initialization
For decoder reuse, we want disable() to flush the decoder. However,
if the flush needs to release the decoder for some reason, it seems
non-ideal to immediately re-initialize it. Re-initialization can
also throw ExoPlaybackException, which we don't want for disabling.

This change allows a variant of flush that wont re-initialize the
decoder if it has to be released, which will be used from disable().

Issue: #2826

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=216834862
2018-10-15 09:33:37 +01:00
andrewlewis
42c3ff3934 Handle rotation signaled in MKV track name from HTC devices
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=216704331
2018-10-15 09:31:51 +01:00
andrewlewis
81a9293072 Project start position for preroll ad to content transitions
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=216675981
2018-10-15 09:30:06 +01:00
vsethia
048c8bd68f Snapshots are going to become the default soon and these tests are failing when
reloading frmo snapshots. b/117347850. This is a no-op change as the current
default == _fullboot. When we globally flip and make snapshots the default,
these tests would fail and we are moving them over so that when we flip your
tests still pass.

https://groups.google.com[]forum/#!topic/mobile-ninjas/Y69PTAT5GyY

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=216634430
2018-10-15 09:28:21 +01:00
tonihei
0a7745bc03 Fix some random Android Studio warnings.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215904019
2018-10-15 09:26:36 +01:00
olly
c5f9ad9f8b Minor fixes for period clipping
- Always clip to period duration for the last chunk. We previously
  did this only when the last chunk explicitly exceeded the period
  end time. We now also do it when the chunk claims to end at the
  period boundary, but still contains samples that exceed it.
- If pendingResetPositionUs == chunk.startTimeUs == 0 but the
  chunk still contains samples with negative timestamps, we now
  clip them by setting the decode only flag. Previously we only
  clipped such samples if the first chunk explicitly preceeded the
  start of the period.

Issue: #4899

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215763467
2018-10-15 09:23:00 +01:00
olly
cc7684d09f Introduce Renderer.reset
- It's a no-op for now
- Renderers that want to support retaining resources will move
  some functionality from their disable() implementations into
  reset()
- ExoPlayerImplInternal will be updated to not always call reset()
  immediately after disable(), which is what will enable resources
  to actually be retained.

Issue: #2826

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215729783
2018-10-15 09:19:30 +01:00
tonihei
d4b87cdc23 Fix updates of loading period and buffered positions in PlaybackInfo.
This makes the following changes to improve consistency among the PlaybackInfo
values:
 1. Update buffered position and total buffered duration after loading period
    is set as both values are affected by a loading period update.
 2. Add copyWithPosition to allow updating the position without resetting the
    loading period.
 3. Forward the total buffered duration to playing position updates
    as it may have changed with the new playing position.

Issue:#4899

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215712328
2018-10-15 09:17:34 +01:00
tonihei
9ca6544311 Simplify some buffered position related code.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215704344
2018-10-15 09:14:04 +01:00
Oliver Woodman
7849a5eb52 Subrip cleanup 2018-10-03 22:19:13 +01:00
ojw28
16fe67bfce
Merge pull request #4582 from szaboa/feature/4306_srt_position_tags
#4306 - Extract tags from SubRip subtitles, add support for alignment
2018-10-03 22:15:11 +01:00
eguven
e91065c4b0 Remove ProjectionRenderer.EyeType
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215562599
2018-10-03 22:13:34 +01:00
eguven
645f08af73 Prevent binding to DownloadService
DownloadService isn't designed to be bound.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215552423
2018-10-03 22:12:02 +01:00
eguven
9f8c22d719 Make it possible to use CacheKeyFactory with CacheDataSourceFactory and DownloaderConstructorHelper
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215541062
2018-10-03 22:10:30 +01:00
tonihei
f0e0a7cf57 Fix left position for subtitles.
When SubtitlePainter positions the cues centred in the given box, it must add
the left offset of the box to get the correct position.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215535289
2018-10-03 22:08:57 +01:00
tonihei
43c01562d1 Fix positioning of subtitles.
SubtitleView forwards the cue box position to SubtitlePainter. This should be
the position relative to the canvas of the SubtitleView. Currently, however,
we forward the position relative to the parent of SubtitleView. That causes
problems if SubtitleView has a non-zero offset position to its parent.

Issue:#4788

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215535281
2018-10-03 22:07:25 +01:00
tonihei
4386d5d466 Replace DefaultBandwidthMeter with CountryAndNetworkTypeBandwidthMeter.
This removes the experimental bandwidth meter and uses it as the new default.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215404065
2018-10-03 22:05:52 +01:00
tonihei
a8b851ce34 Add BasePlayer to avoid code duplication for common convenience methods.
A lot of methods just forward to other methods and there is no conceivable
way a player should implement it another way. Moving these methods to a
base player class allows to remove duplicated code across our player
implementations.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215374192
2018-10-03 22:02:47 +01:00
tonihei
8b2d998440 Remove deprecated ExoPlayer members with same name as non-deprecated version.
For example, using ExoPlayer.STATE_IDLE falls back to the Player.STATE_IDLE
automatically and thus there is no need to keep the deprecated members.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215363841
2018-10-03 22:01:17 +01:00
olly
687756ed31 Update moe equivalence
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215261807
2018-10-03 21:59:44 +01:00
Arnold Szabo
56c7e1ff47 #4306 - grouping line/lineAnchor and position/positionAnchor assignments, setting Cue's textAlignment to def value - null 2018-10-02 18:45:06 +03:00
Arnold Szabo
75a7385bbb #4306 - extends test case with line and position anchor verifications 2018-10-01 23:16:48 +03:00
Arnold Szabo
fc5eb12e79 #4306 - breaking after the first alignment tag is found 2018-10-01 22:45:15 +03:00
ojw28
b4ba913008
Merge pull request #4886 from talklittle/protected-audiotrackscore
Make DefaultTrackSelector.AudioTrackScore protected
2018-10-01 20:05:08 +01:00
eguven
7940fdfc5e Fix DownloadManager.TaskState javadoc
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215213255
2018-10-01 19:36:06 +01:00
tonihei
46731cdd1d Fix prepare position of DeferredMediaPeriods for windows with non-zero offset.
If we prepare a deferred media period before the actual timeline is available,
we either prepare with position zero (= the default) or with a non-zero
initial seek position.

So far, the zero (default) position got replaced by the actual default position
(including any potential non-zero window offset) when the timeline became known.

However, a non-zero initial seek position was not corrected by the non-zero
window offset. This is fixed by this change.

Related to that, we always assumed that the deferred media period will the
first period in the actual timeline. This is not true if we prepare with an
offset (either because of an initial seek position or because of a default
window position). So, we also determine the actual first period when the
timeline becomes known.

Issue:#4873

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215213030
2018-10-01 19:34:29 +01:00