1477 Commits

Author SHA1 Message Date
ishani
f76b80c3cb Automated g4 rollback of changelist 219130576.
*** Original change description ***

Re-enable codec re-use

Issue: #2826

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219585084
2018-11-01 11:19:35 +00:00
Oliver Woodman
2dfe7a7ad6 Misc fixes / stylistic consistency changes for merged pull requests 2018-10-31 20:37:59 +00:00
ojw28
3b7d0b7923
Merge pull request #5004 from pakerfeldt/status-message-invalidresponsecodeexception
Provide http status message to InvalidResponseCodeException
2018-10-31 20:01:56 +00:00
Oliver Woodman
f1d31bdf4f Fix test 2018-10-31 19:49:24 +00:00
Oliver Woodman
097c045bef Resolve conflicts 2018-10-31 19:45:32 +00:00
ojw28
02573297f4
Merge pull request #4996 from YukiMatsumura/fix-idle-requirements
fix checkIdleRequirement
2018-10-31 19:17:25 +00:00
eguven
9d947a56f8 Add MediaChunkListIterator
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219472988
2018-10-31 17:48:08 +00:00
olly
5f6c907c65 Reset DefaultBandwidthMeter on network type change
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219454931
2018-10-31 14:00:57 +00:00
andrewlewis
7d99794bb8 Allow MP4s with truncated stco to be played
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219448836
2018-10-31 13:59:17 +00:00
andrewlewis
1094da2b61 Fix player state transitions for postroll ads
Before this change, the player state would be STATE_ENDED then
STATE_BUFFERING (when the postroll ad was marked as played) then
STATE_ENDED again.

Queueing a final content media period with start point equal to
the content duration after a postroll ensures that the player
state doesn't change to STATE_ENDED transiently.

Switch from using C.TIME_END_OF_SOURCE to C.TIME_UNSET for media
periods that should not have an end point and are not followed
by an ad.

Content media periods before postrolls have end position
C.TIME_END_OF_SOURCE. If the postroll ad loads, its content
position is set to the content duration, which should be known
at the point of loading the postroll, then a final 'empty'
content media period with start position equal to its duration
is queued. If the postroll fails to load, this empty content
media period is queued up directly after the preceding content
media period.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219443683
2018-10-31 13:54:15 +00:00
olly
053a7bc0b9 Simplify DefaultDrmSession event handling
- Handling EVENT_PROVISION_REQUIRED is unnecessary because we handle
  it via NotProvisionedException, which was thrown on all API levels.
- Handling EVENT_KEY_EXPIRED during playback is unnecessary. All it
  does is cause an error to be thrown, but an error will be thrown
  anyway out of the MediaCodec when it tries to use the expired keys.
  It's currently a race condition where the error gets thrown from,
  where-as having it always be thrown from one place is preferable.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219172021
2018-10-31 13:50:51 +00:00
olly
7eeeb40d24 Add options for controlling audio track selection
Issue: #3314

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219158729
2018-10-31 13:49:08 +00:00
olly
069e3cbf7d Clean up DefaultTrackSelectorTest
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219139356
2018-10-31 13:47:26 +00:00
olly
038238430b Re-enable codec re-use
Issue: #2826

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219130576
2018-10-31 13:45:45 +00:00
olly
4824f352de Decouple input format and codec format
This paves the way to cleanly fix the first two issues
listed in [] onDisabled will null inputFormat,
but nulling of codecFormat will remain tied to the codec
being released.

Issue: #2826

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219125458
2018-10-31 13:44:03 +00:00
olly
194d0f3331 Add a bit of structure DefaultTrackSelector, for sanity
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219109829
2018-10-31 13:38:51 +00:00
eguven
ed32e2a7f7 Add TrackSelectionUtil.getAverageBitrate method
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=218877191
2018-10-31 13:37:06 +00:00
olly
ede62e97b2 Fix track selection when forceLowestBitrate is enabled:
- Only use bitrate when comparing two tracks if their bitrates are
  actually different.
- For audio, prefer to use bitrate over selection flags.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=218660886
2018-10-31 13:33:32 +00:00
olly
4fe14c7693 Minor cleanup to BandwidthMeter/DefaultBandwidthMeter
- Improve variable naming
- In the edge case that bytes are transferred in a sample that
  has 0 elapsed time, carry the bytes forward into the next
  sample. If we don't do this then the estimate will be calculated
  as though those bytes were never transferred. In practice I
  suspect this very rarely occurs.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=218551208
2018-10-31 13:31:43 +00:00
olly
1b6801c091 Simplify setting of codec operating rate
Issue: #2826

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=218540967
2018-10-31 13:29:57 +00:00
andrewlewis
706ce49bd3 Fix handling of MP3s with appended data
Issue: #4954

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=218357113
2018-10-24 18:44:35 +01:00
olly
66a6921c26 Remove non-addEventListener ways of adding an event listener
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=218347641
2018-10-24 18:43:05 +01:00
olly
d56b7ad811 Clean up codec reinitialization
Issue: #2826

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=218346327
2018-10-24 18:41:22 +01:00
olly
66c508651a Cleanup codec init, flush and release
Issue: #2826

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=218332277
2018-10-24 18:39:41 +01:00
olly
2fc122745a Give EventDispatcher more predictable behavior
If EventDispatcher.removeListener is called to remove a listener,
and if the call is made from the same thread that said listener
handles events on, then it should be guaranteed that the listener
will not be subsequently invoked on that thread.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=218331427
2018-10-24 18:37:59 +01:00
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
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
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
tonihei
70ccbc6eb8 Fix review comments
See https://github.com/google/ExoPlayer/pull/5004
2018-10-24 11:47:36 +02:00
Patrik Åkerfeldt
8c5703e931 Provide http status message to InvalidResponseCodeException
When response code alone is not enough to distinguish error responses, the http status message is helpful.
2018-10-23 16:51:46 +02:00
Yuki312
9d114b1ccb fix checkIdleRequirement 2018-10-23 17:13:26 +09: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
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