2257 Commits

Author SHA1 Message Date
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
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
tonihei
0f9d9d56d6 Fix scrub seek position estimation for multi window time bar.
When using a multi window time bar, the onScrubStop method uses another
method to estimate the seek position than the updateProgress method for
rendering the time bar. If the time line contains windows starting with an
ad period followed by other content, they differ in their behaviour.
 - updateProgress checks all periods and leaves out all ad periods
 - onScrubStop only checks windows and leaves them out when the first
   period is an ad.

Changed onScrubStop to fit approach in updateProgess.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154271628
2017-04-26 15:18:36 +01:00
olly
9c2b0f6de2 Fix lint errors when building release
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154201059
2017-04-26 15:16:36 +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
aquilescanta
d3fe20cc64 Check the type of the (non-initial) loaded HLS playlist
This prevents illegal casts.

Issue:#2702

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154078240
2017-04-24 21:38:33 +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
olly
4c0b539054 Allow disabling hide on touch for SimpleExoPlayerView
Issue: #2501

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154036726
2017-04-24 21:34:12 +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
cblay
3280dc8777 Make SonicAudioProcessor public
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153762476
2017-04-21 17:47:54 +01:00
Sergio Moreno Mozota
3b7f47551c Add support for multiple subtitle tracks per PID and subtitle type identification 2017-04-20 21:32:59 +02:00
olly
ecb62cccd5 Delete broken PriorityHandlerThread class
This class is unnecessary; you can simply pass a thread
priority to HandlerThread's own constructor. It's also
broken, since HandlerThread.run() immediately overrides
the priority being set!

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153461225
2017-04-18 19:44:50 +01:00
olly
8be85d4d2f Consolidate version codes in root gradle file
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153453768
2017-04-18 19:42:27 +01:00
eguven
42e4100c05 Add DashDownloaderService which downloads DASH streams at the background
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153446615
2017-04-18 19:41:16 +01:00
andrewlewis
e87e2318d8 Fully reset AudioProcessors on releasing AudioTrack
Issue: #2675

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153445372
2017-04-18 19:40:05 +01:00
andrewlewis
835839456f Apply playback parameters when uninitialized
If AudioTrack.setPlaybackParameters was called before initialization (for
example, when an audio renderer is enabled) the parameters would actually be
dropped, because configure calls reset, which didn't apply draining playback
parameters if the track was not initialized. It would then overwrite the
draining parameters with the current parameters.

Set the playback parameters directly (without draining) for uninitialized tracks
so that the call to setPlaybackParameters in configure is a no-op.

Also, reset the stored channel count and sample rate when the audio processor
is released so that configure returns true when it is next used, which makes
sure that it gets flushed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153078759
2017-04-18 19:37:26 +01:00
tonihei
579d57b445 Less memory allocations for repeated calls to SubtitleView.draw()
The draw method checks if all inputs are the same as in the previous call.
The options to strip the subtitle of its styles were applied each time,
in order to check if the final CharSequence is still the same.

This additional computation (and memory allocations) can be prevented by
checking if the original CharSequence (including all styles) and the
flags to remove those styles are the same. The actual style removal is now
part of setupTextlayout().

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153061064
2017-04-18 19:36:08 +01:00
olly
12433ad146 Support intercepting setPlayWhenReady calls
Issue: #2454

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152938743
2017-04-18 19:34:39 +01:00
tonihei
0a7011b390 Support default style in Tx3g decoder.
The track initialization data of Tx3g includes default style values for
font styles, colour, and font family. Additionally the decoder now supports
vertical subtitle placements other than the Tx3g default of 85% video height.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152930057
2017-04-18 19:33:30 +01:00
sxp
1a22a4be5f Automated g4 rollback of changelist 152815185.
*** Reason for rollback ***

The force submit broke GVR: []

*** Original change description ***

Add DashDownloaderService which downloads DASH streams at the background

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152877808
2017-04-18 19:32:18 +01:00
eguven
5a6a1af441 Add DashDownloaderService which downloads DASH streams at the background
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152815185
2017-04-18 19:31:04 +01:00
olly
85adecf948 Remove reflection + make it easy to set extractor flags
The idea of using reflection was so that a developer could
delete a package they didn't want and have everything else
still compile. However, a developer doing this is likely
building from source, in which case editing the factories
too is pretty trivial.

Removing the reflection makes specifying extractor flags
via the default factory easy, and removes the need for
special proguard config.

Issue: #2657

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152810423
2017-04-18 19:29:56 +01:00
tonihei
1dc8bb5bb1 Support 'styl' in Tx3g decoder.
Extended Tx3gDecoder to read additional information after subtitle text.
Currently parses font face, font size, and foreground colour.

Font identifier and other information provided in subtitle sample description
not yet supported.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152793774
2017-04-18 19:28:42 +01:00
Tyler Roach
3b4d981891 If hasOutputFormat is true, nalUnitLengthFieldLengthDiff will never be 0 2017-04-18 09:32:40 -04:00
Rohit Krishnan
329b8910ca Remove unnecessary check. sampleRateIndex is masked with 0x03 so it is constrained to be between 0 and 3. 2017-04-17 22:07:33 -04:00
Rohit Krishnan
896f63a3c3 Fixes OOM that can occur from reading first NAL packet before sequence header 2017-04-14 12:11:04 -04:00
Tyler Roach
59c44af4cb Added mp3 support to FLV extractor 2017-04-13 14:56:22 -04:00
aquilescanta
f36500c200 Add support for audio adaptation
When no video tracks or renderers are present, attempt audio adaptation.

Issue:#1975

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152708422
2017-04-11 12:15:04 +01:00
aquilescanta
2a4df60b01 Add pattern information to ExoPlayer's CryptoInfo
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152708351
2017-04-11 12:15:04 +01:00
olly
0aee235e0a Make ID3 parser more robust (again)
I've also removed unnecessary "empty" cases, since to add them
everywhere would bloat the code quite a lot. Note that
new String(new byte[0], 0, 0, encoding) is valid and will produce
and empty string.

Issue: #2663

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152697288
2017-04-11 12:15:04 +01:00
aquilescanta
c185963355 Add IntDef to reader internal state and default branch
Adding the default branch prevents linting warnings.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152675789
2017-04-11 12:15:04 +01:00
aquilescanta
8da2e2c8d5 Track format changes in (E-)AC-3 syncframes
This allows propagating format changes to the track output.

Issue:#2552

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152672983
2017-04-11 12:15:04 +01:00
andrewlewis
147020f816 Hide player controls when an ad is playing
Also fix an issue where ad timelines with unknown ad period durations
would not be shown in multi-window mode. (The time bar doesn't use the
duration of ad periods, but shows a fix-size indicator instead.)

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152666055
2017-04-11 12:15:04 +01:00
andrewlewis
d8c71df255 On re-preparation, suppress source info refresh until ack'ed
ExoPlayerImpl.prepare() replaces the timeline with an empty timeline. After this
happens, MSG_SOURCE_INFO_REFRESHED could be handled on the main thread and
could relate to the old source, so the player could expose a stale timeline.

Count pending prepares in ExoPlayerImpl so that source info refreshes can be
suppressed until preparation actually completes.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152496255
2017-04-11 12:15:04 +01:00
andrewlewis
4b94877476 Fix DefaultTimeBar vertical positioning in the demo app
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152492104
2017-04-11 12:15:03 +01:00
tonihei
ac0a4353da SubtitleView - New method setApplyEmbeddedFontSizes
When option is set to false, SubtitlePainter strips all absolute
and relative font size spans from the cue text.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152484724
2017-04-11 12:14:44 +01:00
Oliver Woodman
156bc52c8f Clean up DVB support
- Removed the PES_STRIPPED flag. It's unnecessary. We can strip
  PES in the TS extractor instead.
- Made nearly all of the object classes in DvbParser immutable.
  Else it's non-obvious that none of this state can be mutated.
- Made a a lot of the methods in DvbParser static for the same
  reason.
- Removed unnecessary null checks, code that was never executed,
  unused fields etc.
- Add proper flushing of DvbParser, to prevent corrupt output
  following a seek.
2017-04-06 19:16:31 +01:00