3269 Commits

Author SHA1 Message Date
andrewrice
78c4cb74ea Fixes incorrectly-ordered arguments to calls to assertEquals
([]
This change has been automatically generated by an Error Prone check that
detects incorrect argument ordering on calls to assertEquals-style methods. See
[]

Cleanup change automatically generated by javacflume/refactory
Refactoring: third_party/java_src/error_prone/project/core/src/main/java/com/google/errorprone/bugpatterns/argumentselectiondefects:AssertEqualsArgumentOrderChecker_refactoring

Tested:
    TAP --sample for global presubmit queue
    []

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156739144
2017-05-23 15:19:55 +01:00
eguven
1687f1653e Make the error messages the first parameter in Assertions methods to match JUnit methods
Reverse parameter order creates a slight confusion.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156712385
2017-05-23 15:19:55 +01:00
tonihei
1594e71917 Test for changing repeat mode during playback
(Related to GitHub Issue #2577)

Added test to ExoPlayerTest which changes the repeat mode during playback.
Test verifies that ExoPlayer shows the periods in the intended order.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156168166
2017-05-17 16:48:07 +01:00
olly
8e0bf6cd2f Clear the correct buffer in MediaCodecRenderer
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156131086
2017-05-17 16:48:07 +01:00
olly
72ba736a7f Clear up BaseRenderer.disable
- Call onDisabled last. onDisabled really shouldn't be doing
  anything with the stream, so pretty sure this is fine (and
  guarantees the stream is cleared properly even if onDisabled
  throws a RTE).
- Remove super.onDisabled calls from Text/Metadata renderers.
  This is just for consistency; we don't make such calls in
  other direct descendants of BaseRenderer.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156130640
2017-05-17 16:48:07 +01:00
andrewlewis
9a7306a4cc Remove unnecessary throws clause
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156061458
2017-05-17 16:48:07 +01:00
andrewlewis
929ef172a0 Fix handling of removed periods
If a timeline update removed periods at the end of the timeline which
had been buffered, handleSourceInfoRefreshed would call
getNextPeriodIndex and get back -1 for the last period holder in the
new timeline. Then isLastPeriod(-1) could throw.

Fix this behavior so that the remainder of the timeline is discarded.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156061016
2017-05-17 16:48:07 +01:00
bachinger
f335fb936d Enlarge size of data array of parsable packetArray if ogg packet size exceeds
the current size.

https://github.com/google/ExoPlayer/issues/2782

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156018137
2017-05-17 16:48:07 +01:00
tonihei
3dd2f4af57 Tests for timeline repeat mode support.
Checking the expected next/previous window indices and if the correct window
or period gets returned.

TimelineTest defines mock classes and verification methods used by the specific
implementation tests.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155727385
2017-05-17 16:48:07 +01:00
sillywab8
ed65958e5d Add support for AVC Level 5.2 2017-05-12 08:24:40 -05:00
ojw28
17cee63544 Merge pull request #2794 from mofneko/fix-unused-variable
Fix unused variable
2017-05-10 21:59:05 -07:00
tonihei
c0d16ea2cb Possible NullPointerException in ExoPlayerImplInternal.setRepeatModeInternal
When readingPeriodHolder and playingPeriodHolder are both null, a
NullPointerException is thrown when trying to reassign readingPeriodHolder.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155635846
2017-05-11 05:53:20 +01:00
tonihei
02c51ee01c Update period holders in ExoPlayerImplInternal when repeat mode changes.
(Relating to GitHub issue #2577)

Changing the repeat mode during playback may require to discard or rebuffer
certain periods because the requested order of playback changed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155600910
2017-05-11 05:53:20 +01:00
tonihei
8a210becef Add repeat mode support to Timeline implementations.
(Relating to GitHub Issue #2577)

The Timeline base class provides the default implementation.

Timeline wrappers (e.g. ClippingTimeline, ConcatatedTimeline) forward all
requests to the respective inner timelines. Some like ConcatenatedTimeline add
their own additional logic to bridge between the child timelines.

In addition, ConcatenatedTimeline and LoopingTimeline now have a common
abstract base class as they share most of their code.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155509269
2017-05-11 05:53:20 +01:00
aquilescanta
4abf64b7ef Make MODE_SINGLE_PMT the default mode
Even though this is not strictly spec compliant, this will make exoplayer
behave like it used to before multiple program support. Developers
who want to take advantage of the multiple program support are probably
less than the ones who only want their stream to "just work". This is
particularly useful for streams obtained after a filtering component,
like a tv tuner.

Issue:#2757

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155486122
2017-05-11 05:53:20 +01:00
aquilescanta
1f43fb1998 Introduce CryptoData parameter object
This will allow supporting more encryption schemes. Including some
that require more encryption data, like the encryption pattern.

Issue:#1661
Issue:#1989
Issue:#2089

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155481889
2017-05-11 05:53:20 +01:00
arakawa_yusuke
86ac913df6 Fix unused variable 2017-05-09 21:20:57 +09:00
ojw28
0302fd6b4d Merge pull request #2765 from AOrobator/dev-v2
Dev v2
2017-05-08 23:14:14 +01:00
ojw28
f302d528f8 Merge pull request #2787 from mofneko/remove-fully-qualified-name
Remove fully-qualified name
2017-05-08 23:14:03 +01:00
tasnimsunny
b299718036 Make removal of non-existent cache span a no-op
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155413733
2017-05-08 22:39:14 +01:00
olly
812068a208 Avoid process death if OOM occurs on a loading thread
This is most commonly caused by malformed media, where
the media indicates that something we need to make an
allocation for is *really huge*. Failing playback is
appropriate for this case; killing the process is not.

Issue: #2780

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155408062
2017-05-08 22:32:07 +01:00
tonihei
c70cd37c5a Repeat mode UI
Added repeat mode toggle buttons to UI. Current mode gets forwarded to
Exoplayer instance, but without playback behaviour changes yet.
Translations for button descriptions are also missing - this will be another CL.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155386549
2017-05-08 22:30:58 +01:00
andrewlewis
631cce9171 Fix interpolation for rate/pitch adjustment
Based on https://github.com/waywardgeek/sonic/commit/7b441933.

Issue: #2774

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155349817
2017-05-08 22:27:44 +01:00
andrewlewis
4b5c521a33 Use native byte order for SimpleOutputBuffers
The default byte order for ByteBuffers is big endian, but platform decoder
output buffers use native byte order. AudioProcessors handle native byte order
input/output.

When using a software audio decoding extension the Sonic audio processor would
receive big endian input but was outputting to a native byte order buffer,
which could be little endian. This mismatch caused audio output to be
distorted.

After this change both platform decoder and extension decoder output buffers
should be in native byte order.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155320973
2017-05-08 22:26:38 +01:00
arakawa_yusuke
4f9cf44986 Remove fully-qualified name 2017-05-08 20:05:10 +09:00
olly
7f66725953 Don't set MAX_INPUT_SIZE to unnecessarily large values
If the codec isn't adaptive, there's no need to accommodate
the width/height/input-size of streams that don't have the
same resolution as the current stream. This is because we'll
always need to instantiate a new codec anyway.

Issue: #2607

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155194458
2017-05-05 15:35:52 +01:00
olly
4c39627ed1 Some minor cleanup related to track selection and caching
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155103828
2017-05-04 20:58:02 +01:00
tonihei
4d1826dd3d Add repeat mode mechanics to Exoplayer.
(Relating to GitHub Issue #2577)

All getter, setter and callbacks have been added and value of repeatMode is
passed to getNextXXXIndex methods.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155071985
2017-05-04 20:55:48 +01:00
aquilescanta
3a5548d72a Fix javadocs typos
Issue:#2773

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155062917
2017-05-04 20:54:34 +01:00
olly
7773831d88 Add DummySurface for use with MediaCodec
A DummySurface is useful with MediaCodec on API levels 23+.
Rather than having to release a MediaCodec instance when the
app no longer has a real surface to output to, it's possible
to retain the MediaCodec, using MediaCodec.setOutputSurface
to target a DummySurface instance instead. When the app has
a real surface to output to again, it can call swap this
surface back in instantaneously. Without DummySurface a new
MediaCodec has to be instantiated at this point, and decoding
can only start from a key-frame in the media.

A future change may hook this up internally in MediaCodecRenderer
for supported use cases, although this looks a little awkward. If
this approach isn't viable, we can require applications wanting
this to set a DummySurface themselves. This isn't easy to do with
the way SimpleExoPlayerView.setPlayer works at the moment, however,
so some changes will be needed either way.

Issue: #677

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154931778
2017-05-04 20:52:19 +01:00
falhassen
6d01460b58 Use Looper.getMainLooper() in Handler constructors in ExoPlayer when needed.
Looper.myLooper(), the default looper, may be null in background threads. This adds a fallback to use the main app looper.

This will allow ExoPlayer instances to be built in background threads in Photos.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154845446
2017-05-04 20:51:14 +01:00
tonihei
ab30d715c7 Infinite loops using new Timeline features
Using the new getNextWindowIndex method of Timeline, LoopingMediaSource now
uses a InfinitelyLoopingTimeline which does not unroll the windows to
157 million iterations but just starts from the beginning. If an explicit
number of iterations is given, we still unroll.

This change also allows multi-window timebars to show infinitely looping
playlists correctly.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154817554
2017-05-04 20:47:51 +01:00
tonihei
6d2fa12e16 Add getNextWindowIndex to Timeline
(Preparation for Repeat Toggle Function - GitHub Issue #2577)

In addition, Timeline now also got a getPreviousWindowIndex and a
getNextPeriodIndex method with default implementations.

Changed ExoPlayerImplInternal and PlaybackControlView to use these
methods at all occurances of period and window index operations.

Note: Does not include repeat mode yet and no timelines are actually
using it so far. Please wait for the next CLs for this.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154520664
2017-05-04 20:45:31 +01:00
aquilescanta
5c723f4d3d Prevent text tracks with no language being selected by default
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154421706
2017-05-04 20:44:17 +01:00
Andrew Orobator
c4fff54d2c Improved Documentation
Added missing coma and fixed typo for EventListener#onTimelineChanged
2017-05-03 10:49:36 -04:00
olly
1e12c07954 Move renderer building into a factory class.
To inject custom renderers into SimpleExoPlayer, developers
currently need to extend SimpleExoPlayer and override the
renderer building methods. This is in contrast to the rest
of the library, where we use proper injection. This change
restores consistency. I think it's fine to make
SimpleExoPlayer final again, but if we find people extending
it for non-renderer purposes, we can revert that part of the
change.

ExoPlayerFactory now has analogous methods for the simple
and non-simple cases, which is a nice outcome.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154295726
2017-04-26 15:49:35 +01:00
olly
b88deaa1ca Bump version and update release notes
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154198359
2017-04-26 15:15:32 +01:00
Oliver Woodman
c50cfd8345 Minor additional cleanup of multiple DVB subtitles per PID support 2017-04-25 16:41:04 +01:00
Oliver Woodman
f903098721 Merge branch 'dev-v2' of persistent-https://github.com/google/ExoPlayer into dev-v2 2017-04-25 16:38:06 +01:00
olly
fb88087ac4 Tweak video renderer surface swaps
Fixes the following issues:

1. When a surface is set, it's expected that the renderer will
notify video size + when a frame is rendered to it. This is true
even if the surface isn't changing. Right now this is achieved
by setting renderedFirstFrame to false, but this is problematic
in the case that the surface isn't changing because (a) it will
force rendering of a subsequent frame to the output even when
paused, which is incorrect, and (b) isReady will return false
until this occurs.

2. When the surface really is changing, isReady can return false
until the first frame has been rendered into the new surface, which
will break seamless surface switching. This change allows isReady
to return true up to allowedJoiningTimeMs for this case.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154171111
2017-04-25 16:35:40 +01:00
anjalibh
e07b8fe7d5 Parse ColorInfo from WebM Container and set it on MediaFormat.
* colorSpace, colorRange and colorTransfer are relevant to all videos.
* The rest of the fields are relevant only to HDR videos.
* Tested on a prototype device that decodes VP9 profile 2, 10 bit.
* The Webm spec spells color as 'colour' so the webm id reference use the same spelling.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154098189
2017-04-25 16:34:19 +01:00
olly
f0a72c4908 Fix playback of DASH/VP9/SegmentList DASH content
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154077149
2017-04-24 21:37:33 +01:00
olly
8e8a6a2994 Support efficient switching between SimpleExoPlayerView instances
Prior to this change, the only way to switch SimpleExoPlayerView
was to do:

oldView.setPlayer(null);
newView.setPlayer(player);

This would cause the video renderer to have to transition through
oldSurface->noSurface->newSurface, which is inefficient (noSurface
requires platform decoders to be fully released).

After this change we support:

newView.setPlayer(player);
oldView.setPlayer(null);

This results in direct oldSurface->newSurface transitions, which are
seamless on Android M and above. The change also adds some robustness
against developers ending up with strange behavior as a result of
clearing the player from a view in a different ordering than we expect
w.r.t. registering of other listeners.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154044976
2017-04-24 21:35:24 +01:00
Oliver Woodman
51de6e53eb Clean up multiple DVB subtitles per PID support 2017-04-24 16:58:01 +01:00
Oliver Woodman
aa43556b79 Merge branch 'dev-v2-dvbsubs-leftovers' of git://github.com/tresvecesseis/ExoPlayer into tresvecesseis-dev-v2-dvbsubs-leftovers 2017-04-24 15:31:19 +01:00
Oliver Woodman
860eb26301 Misc cleanup for merged pull requests 2017-04-21 18:09:01 +01:00
ojw28
5381b4ec56 Merge pull request #2683 from tylerjroach/dev-v2
Added mp3 support to FLV extractor
2017-04-21 17:57:18 +01:00
ojw28
4c096505d3 Merge pull request #2688 from tylerjroach/dev-v2-NALU-OOM-Fix
Fix potential OOM that can occur reading first NAL packet before seq header
2017-04-21 17:56:49 +01:00
olly
86ed73e744 Use method arguments instead of member variables
This is a no-op cleanup change.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153830409
2017-04-21 17:48:28 +01:00
olly
1506b6d2b7 Pragmatic fix for Concat(source1, Looping(source2))
Issue: #2680

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153827243
2017-04-21 17:48:28 +01:00