1581 Commits

Author SHA1 Message Date
aquilescanta
af2b8fb7a6 Add CRC32 check for PAT section
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131294029
2016-08-31 15:25:25 +01:00
olly
0b6a93b468 Workaround missing data offsets in FMP4
If they're omitted, it's reasonable to assume it's because
they were uninteresting (i.e. sample data always tightly
packed at the start of the mdat). This is an issue for some
SmoothStreaming streams.

We actually already play such streams successfully, but
that's only due to another bug to be fixed in a following CL.
The same is true for V1, but given the low impact nature,
the fix will be V2 only.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131191975
2016-08-31 15:25:25 +01:00
olly
abaa4f1aad Don't update currentTrackBundle until end of block
If currentTrackBundle is updated at the start of the
block and then something goes wrong in the middle (e.g.
one of the skipFully calls) then the extractor wont
resume from the correct place.

This would be caught by our extractor tests if we had
a test sample that requires skipping to the sample data.
I'll try and construct one of those.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131191174
2016-08-31 15:25:25 +01:00
olly
42efb5413a SmoothStreaming fixes
- The -1 needs to be a 0. My bad.
- Create AAC CSD if not defined in manifest, like in V1.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131190995
2016-08-31 15:25:25 +01:00
aquilescanta
fd3d7be9c0 Fix data_offset not present bug in FragmentedMp4Extractor
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131183033
2016-08-31 15:25:25 +01:00
olly
ef7dd697b1 Fix ContentDataSource handling of AssetFileDescriptor
Also tweak how the null checks happen in a few DataSource
implementations (should be no-op changes, but allow you
to look at close() and be happy it does the right thing
without having to loop at the open() implementations).

Issue: #1759

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131172427
2016-08-31 15:25:25 +01:00
olly
5f1a2c71f0 Finalize V2 ExoPlayer API
There's still some internal to clean up to do, and in particular
it remains a TODO to be able to handle seek calls before the
timeline is set (for this CL, such calls are dropped). This change
does however finalize the API.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131171318
2016-08-31 15:25:25 +01:00
andrewlewis
85915f2ac1 Fix live window calculation and transition from VOD.
Fix the calculation of the seek window for multi-period DASH.

Snap the default initial position back to the start of its segment, to ensure
that the first sample provided when transitioning to a DASH live source is a
key-frame.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131052912
2016-08-31 15:25:25 +01:00
olly
458c7bfc05 Simplify ExoPlayerImplInternal
- Remove playingPeriodEndPositionUs. It doesn't look like it's
  required.
- Rename time variables to make it clearer what they are.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131027164
2016-08-31 15:25:24 +01:00
olly
94c908e89c Rename Window->MediaWindow, Timline->MediaTimeline
Window is potentially confusing with Android's Window class.
Once Window is renamed, it makes sense to rename Timeline too.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130938392
2016-08-31 15:25:24 +01:00
olly
fb55254f90 Fix a bunch more Javadoc
Also inline a few methods/classes where they can be made
private and therefore be removed from the public API.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130935090
2016-08-31 15:25:24 +01:00
aquilescanta
abdb8ddb6e Remove 1 track per type limitation in TsExtractor
Mainly, this allows the extractor to expose multiple audio tracks.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130928152
2016-08-31 15:25:18 +01:00
olly
d5607cfc47 Make Javadoc compile with Java8
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130922558
2016-08-31 15:25:18 +01:00
olly
9f1fc274c9 Add SimpleExoPlayer.getVolume API
Issue: #1754

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130780466
2016-08-31 15:25:18 +01:00
olly
2c84f016fe Parse and expose proj and st3d/stereo_mode
As described in:
https://github.com/google/spatial-media/blob/master/docs/spherical-video-v2-rfc.md.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130776689
2016-08-31 15:25:18 +01:00
olly
1579b68cf6 Sanitize constants
- Use a single constant for unset/unknown times across
  all time bases. Note also that this moves away from
  use of -1 for unset/unknown times in ms, which was a
  bad choice (it might conflict with real times, such
  as a time representing being just behind the start
  of a live window).
- Add a few other unset constants, and use them.
- Fix some hardcoding of -1 where existing constants
  should have been used.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130775594
2016-08-31 15:25:18 +01:00
andrewlewis
725337dab3 Fix VOD to live transitions.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130755346
2016-08-31 15:25:18 +01:00
olly
f2ee7ef07b Fix formatting
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130662159
2016-08-31 15:25:18 +01:00
olly
83e466d129 Toward API finalization
- Remove getNewPlayingPeriodIndex from MediaSource
- Remove all absolute references to period indices from
  Window. Their existence prevents ConcatenatingMediaSource
  from being able to efficiently handle children with
  large numbers of entries (e.g. a cursor backed source),
  since it would copy all windows into its merged timeline.
- Fix ExoPlayerImplInternal to attempt a restart in the
  case that the loading (but not yet prepared) period is
  removed, in absence of a playing period.
- Implement logic for finding the "next" period in the old
  timeline when attempting a retry.

Removing some of the nasty US<->MS conversions left as a
virtual TODO.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130659973
2016-08-31 15:25:18 +01:00
andrewlewis
eff82e920e Fix DASH multi-period transitions and manifest updates.
Period transitions can either be to new windows (in which case the default
position for the new window should be loaded) or to the next period of the
current window (in which case the the new period should be played from zero).
Fix the logic for calculating the new period index to load to implement this.

In processManifest, periodsById may contain periods that have been removed from
the manifest, which are still being used by the player (it releases periods on
receiving the source info refresh after processManifest returns). Ignore
periods that have been removed from the manifest when calling updateManifest.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130626441
2016-08-31 15:25:18 +01:00
olly
c009028dad Prepare for removal of period based ExoPlayer methods
- This change marks the methods that will be removed, and
  renames the Window methods to remove "Window" from their
  names.
- The Window methods need to be made to work (rather than
  throw exceptions) when the timeline isn't set. Once that
  gets done in a subsequent CL, the deprecated methods will
  be removed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130612979
2016-08-31 15:25:17 +01:00
andrewlewis
1695e2ac48 Fix DASH period index calculation.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130612920
2016-08-31 15:25:17 +01:00
olly
b2a28a140c Move default start position into Window
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130610236
2016-08-31 15:25:17 +01:00
olly
3e0bae616f Minor ExoPlayerImplInternal cleanup
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130547431
2016-08-31 15:25:17 +01:00
cdrolle
cdb0ef13c8 Expose timeout values in DefaultDataSourceFactory.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130522990
2016-08-31 15:25:07 +01:00
olly
b35648eafb Add window based methods to ExoPlayer
- This change also enables seeking in live windows in the
  ExoPlayer demo app.
- The added playlist doesn't transition properly by itself,
  but for manual transitions it works correctly, and
  demonstrates seeking into a default position.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130515880
2016-08-31 15:25:07 +01:00
olly
fa84aa2123 Incremental step toward correct event propagation
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130509123
2016-08-31 15:25:07 +01:00
olly
317a8ef19b Simplify DashMediaSource and simulate manifest refreshes
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130507478
2016-08-31 15:25:07 +01:00
andrewlewis
5296d5b198 Move isFinal flag to the Window.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130503190
2016-08-31 15:25:07 +01:00
eguven
671a15badf ExtractorMediaPeriod: Use URI sha1 hash as the DataSpec key.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130422264
2016-08-31 15:25:07 +01:00
olly
7bed85950e Fix/improve SmoothStreaming live window
- Add missing callback call.
- Allow injection of live edge offset.
- Refine calculation of live window size to correctly
  handle just-started streams where the DVR window
  hasn't yet grown to full size.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130412465
2016-08-31 15:25:06 +01:00
olly
e0773f705f Allow applications to specify the live edge offset.
Also allow use of suggestedPresentationDelay taken from the
manifest, and enable this by default.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130409924
2016-08-31 15:25:06 +01:00
andrewlewis
76f7fffb8d Clean up period identifiers.
SinglePeriodTimelines can all use the same identifier, as their identifier is
wrapped in a pair with the (fixed) source index when they are concatenated with
other sources' timelines.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130386297
2016-08-31 15:25:06 +01:00
olly
bb8cbbfbe8 Allow mapping of period->window
This is a 1:1 mapping. This change formalises the fact,
and makes it possible to easily query the mapping.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130375111
2016-08-31 15:25:06 +01:00
olly
e35f9addaf Remove playWhenReadyCommitted.
This was always a bit of a hack; for Play Movies. It may well
no longer be necessary, and if not I'd like to think of a nicer
or more general way of doing it. We can always bring it back
if needed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130373433
2016-08-31 15:25:06 +01:00
olly
18a8655343 Javadoc cleanup: ExoPlayer#x -> #x
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130369177
2016-08-31 15:25:06 +01:00
eguven
096f85202e Use manifest URL sha1 hash as the content id.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130293908
2016-08-31 15:25:06 +01:00
andrewlewis
63ab601d75 Use consistent identifiers for extractor periods.
Also, fix clearing the timeline for source info changes.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130292700
2016-08-31 15:25:06 +01:00
andrewlewis
80227840f6 Post source info refreshes.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130289294
2016-08-31 15:25:06 +01:00
olly
1a909fd163 Change SeekWindow -> Window, and add window duration.
- This avoids the need to have to use the timeline to
  calculate a window duration, which can be awkward.
- Window now represents a window of availability with
  an isSeekable flag, rather than a window of
  seekability.
- Promoted Timeline and Window to top package; they're
  pretty important :).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130278509
2016-08-31 15:25:06 +01:00
andrewlewis
b120bea029 Don't reuse MediaPeriods.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130266483
2016-08-31 15:25:06 +01:00
olly
b5e41a903d Remove buffered position edge case.
It's no longer safe to convert END_OF_SOURCE -> duration on
the main therad, since the Timeline from which the duration
is obtained is posted to the main thread, where-as the
buffered position is passed by updating a volatile. Hence
an update to the latter might become visible to the main
thread before the corresponding Timeline.

This change moves the conversion to the playback thread.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130265893
2016-08-31 15:25:06 +01:00
andrewlewis
6e24372414 Use integers as identifiers for DASH periods.
This is in preparation for making it so that periods aren't reused.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130113382
2016-08-31 15:25:05 +01:00
olly
0ca81b1a4c Make sure TrackSelections refer to the correct TrackGroups
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130111048
2016-08-31 15:25:05 +01:00
aquilescanta
fc5df6312d Add support for multiple truns in a single traf
This kind of mp4 files has been seen in Hls+fMp4 samples.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130094845
2016-08-31 15:25:05 +01:00
olly
d04fde1a53 Distinguish dense vs sparse tracks for buffering purposes
- For audio/video, we should report the minimum largest
  queued timestamp. This ensures that buffering continues
  rather than stops in the case of bad sample interleaving.
- If there are "sparse" tracks then they should be ignored
  for this calculation, otherwise the buffered position can
  end up getting stuck at some small value (e.g. if there's
  a text track containing a single sample with a small
  timestamp).
- In the edge case that there are only "sparse" tracks, we
  probably want to take the maximum largest queued time
  instead.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130094266
2016-08-31 15:25:05 +01:00
eguven
c380ba2dc1 CacheSpan.isEOS (is end of stream) field shows whether the {@link CacheSpan} contains the end of the original stream.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130084365
2016-08-31 15:25:05 +01:00
olly
cc28aeadd8 Automated rollback
*** Reason for rollback ***

Referential equality was probably the right thing to do, since using .equals
breaks track selection in the case that a source exposes two or more tracks
whose formats are equal. We should fix the way overrides work instead.

*** Original change description ***

Fix multi-period transitions with track selection overrides

An override applies across periods provided they expose the
same track groups according to .equals, but the formats in
the override are then compared against the period's formats
according to ==. Use .equals consistently to fix.

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130083840
2016-08-31 15:24:50 +01:00
olly
1811b01b07 Report duration only via Timeline
It's error prone (and more code) to report two ways

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=129999117
2016-08-31 13:25:21 +01:00
olly
d8ffafea65 Simplify Timeline classes a bit
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=129993536
2016-08-31 13:24:44 +01:00