63 Commits

Author SHA1 Message Date
olly
dbb43567a3 Finalize v2 directory + package name
- The package is renamed to avoid conflicts with v1, should any
app wish to include both v1 and v2 for a period of time. This is
similar to the approach used by some other open source projects
(e.g. okhttp).
- Copyright year is updated everywhere for completeness.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=126895326
2016-07-08 12:12:09 +01:00
andrewlewis
af3452d231 Make SampleSources reusable and implement SampleSourceProvider.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=126888556
2016-07-08 10:15:14 +01:00
olly
19d65a7a9d Report loading on/off changes via ExoPlayer.
Also attempt to clear up naming a little, using "buffering" to
mean the user visible buffering state, and "loading" to mean a
source being loaded.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=126693592
2016-07-07 20:45:53 +01:00
andrewlewis
dd031691b0 Pass an ExtractorsFactory to ExtractorSampleSource.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=126672854
2016-07-07 20:44:12 +01:00
andrewlewis
2073f3fce3 Expose source indices via ExoPlayer (playlists #5).
ExoPlayer.EventListener.onPositionDiscontinuity is notified during seeking and
transitioning from one source to the next.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=125578976
2016-07-07 20:23:21 +01:00
olly
ec4c7d3acf Remove Eclipse support. Simplify manifests.
It looks like the manifests are essentially pointless,
but various tools are unhappy if I delete them.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=124976509
2016-06-15 20:26:37 +01:00
olly
f4e4fd51c6 Clean up chunked media source event listeners.
- Event listener is now at the SampleSource level, since the
  individual ChunkTrackStream instances are created internally.
- Event listener receives events corresponding to loads made
  at the SampleSource level (e.g. manifest fetches) in addition
  to those made by the ChunkTrackStream instances.
- Added ability for FormatEvaluators to propagate arbitrary
  information (as an Object) through to the listeners. This was
  a request from YouTube.
- Added significantly more information to each event, for example
  the DataSpec that defines the load being made is now passed, as
  is timing information.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=124732984
2016-06-15 19:43:17 +01:00
olly
ff745ac444 Make ExtractorSampleSource constructor consistent.
The allocator and buffering policy (e.g. how large the buffer
is) is moving to the top level as part of playlist support,
so it no longer makes sense to inject these parameters as
args into ExtractorSampleSource's constructor.

Instantiating the allocator and buffer size inside of the
source is temporary and only until they're moved up.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=123968976
2016-06-15 19:42:03 +01:00
olly
ced7de15a9 Promote DemoPlayer to library as SimpleExoPlayer.
DemoPlayer moves into core library as SimpleExoPlayer, which
implements ExoPlayer.

Issue: #383
Issue: #592
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=123090184
2016-06-15 19:41:34 +01:00
aquilescanta
2f4bfc3f5f Add the TrackSelectionPolicy to decouple track "assignment" and selection
Allows the user to provide their own criteria for selecting one of the available tracks
without having to reimplement the track assignment logic, i.e. linking type x tracks with
type x renderer.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122422087
2016-06-15 19:41:32 +01:00
olly
3760f514a9 Flesh out ExoPlayer extensions.
1. AudioDecoderTrackRenderer now reports decoder initialization
   and AudioTrack underruns.
2. AudioDecoderTrackRenderer can now render more than one output
   buffer per call to doSomeWork, to be consistent with
   MediaCodecAudioTrackRenderer. This may also prevent audio
   underruns in the case that audio is fragmented into many small
   buffers.
3. AudioDecoderTrackRenderer now has an overridable method that
   receives the audio session id, to be consistent with
   MediaCodecAudioTrackRenderer.
4. Fix unsafe event notification in LibvpxVideoTrackRenderer.
5. Vpx and AudioDecoder extensions now increment the CodecCounter
   inputBufferCount field correctly.
6. Decoders now have names :).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122250009
2016-06-15 19:41:31 +01:00
andrewlewis
403f164b75 Pass the sample Format to AudioDecoderTrackRenderer.createDecoder.
The FFmpeg extension can support various different MIME types, so pass the
whole format to configure the decoder.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122246589
2016-06-15 19:41:31 +01:00
andrewlewis
1dcd454477 Rename util.extensions package to extensions.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122151232
2016-06-15 19:41:30 +01:00
olly
68d39b5159 Remove DecoderInputBuffer.size
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122146105
2016-06-15 19:41:30 +01:00
olly
f9f95d638b Make ExtractorSampleSource amenable to proguarding.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122085277
2016-06-15 19:41:30 +01:00
olly
356288a018 Fix documentation.
- Merge guide.md updates from GitHub.
- Update Opus repository.
- Fix missing link in Opus README.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122080285
2016-06-15 19:41:30 +01:00
eguven
9ee3030b79 Opus initialization data should be in native order.
http://developer.android.com/reference/android/media/MediaCodec.html#CSD
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121957004
2016-06-15 19:41:30 +01:00
eguven
642b2009f3 Add extensions to v2 demo app.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121674924
2016-06-15 19:40:39 +01:00
eguven
d1eb43ad62 V2 Extension fixes
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120699171
2016-06-15 19:39:11 +01:00
olly
2e0518f47b Apply Android studio code analysis suggestions.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120326293
2016-06-15 19:39:09 +01:00
eguven
a7d7859478 Shared super class for LibflacAudioTrackRenderer and LibopusAudioTrackRenderer.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120225655
2016-06-15 19:39:09 +01:00
andrewlewis
d7ac074088 Fix Android NDK links.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120107182
2016-06-15 19:39:08 +01:00
olly
628a209b9b Add Eclipse projects for extension tests.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119843448
2016-06-15 19:39:08 +01:00
andrewlewis
e4ee19513c Remove ExoPlayer.STATE_PREPARING.
prepare(SampleSource) is renamed to setSource(SampleSource). The player
immediately transitions to STATE_BUFFERING when the source is set, at which
point doSomeWork is called.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119838825
2016-06-15 19:39:08 +01:00
eguven
2b0f2ec3bc Add opus and flac tests to MOE
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119759105
2016-06-15 19:39:07 +01:00
andrewlewis
e594eccd4d Merge SampleSourceTrackRenderer into TrackRenderer.
TrackRenderer and SampleSourceTrackRenderer both now use a TrackStream
so they can be merged.

(This may also be useful for adding playlist support, in case TrackStreams need
to be replaced during playback.)
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119743228
2016-06-15 19:39:07 +01:00
olly
730e4ac953 Remove workaround for FrameworkSampleSource.
FrameworkSampleSource will still be useful for audio, where
sample interleaving isn't an issue. We could optionally add
a "don't wait for first frame" boolean to the video renderer
if we *really* need to keep some form of this workaround in
place, but I'd rather not do so for now.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119733224
2016-06-15 19:39:07 +01:00
eguven
192f566a1b Copy opus extension v1->v2
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119643009
2016-06-15 19:39:07 +01:00
olly
cdae9ac5d2 ExoPlayer V2 Refactor - Steps 1/2.
GitHub note - Apologies for the cryptic change descriptions,
they relate to a design doc that's not externally visible.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=113043764
2016-06-15 18:53:40 +01:00
olly
da2752137b Add proguard config for Opus extension.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112776882
2016-01-22 13:58:57 +00:00
olly
d804446b34 Implement seeking via a single code path.
When a seek is performed, renderers currently perform the
actions that they need to take in two places: Some changes
are performed in seekTo implementations. Other changes are
performed when discontinuities are read from the source.

In HLS we need to perform what is effectively a seek
originating in the source. To support this, this CL allows
discontinuities read from the source to modify the playback
position. All actions that renderers perform as a result
of a seek are moved to be performed when a discontinuity is
received.

Best way to understand CL:
- Look at SampleSource interface change and then at the
  concrete implementations, to make sure they've been
  changed properly.
- Look at SampleSourceTrackRenderer change.
- Look at concrete renderers. The general pattern is that
  code previously performed in seekTo and READ_DISCONTINUITY
  is merged into onDiscontinuity().

Note: This will be further untangled in V2.

Issue #676
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112720746
2016-01-22 12:11:16 +00:00
Oliver Woodman
00068c8954 Add vpx extension playback test. 2016-01-22 11:36:21 +00:00
vigneshv
bb55fd8e47 opus: Add CodecCounters support
Fixes Issue #1047
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=111708934
2016-01-14 17:08:25 +00:00
vigneshv
00f84fc85f Move APP_PLATFORM to Application.mk
Fixes github Issue #944
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=109563981
2015-12-07 19:55:17 +00:00
andrewlewis
c685e27972 Fix {Opus,Vpx}DecoderWrapper flush() buffer handling.
Currently, input/output buffers can 'leak' if they are dequeued then the decoder
is flush()ed. This happens if an input buffer is dequeued then a discontinuity
is read, or an output buffer is dequeued and is early. If this happens several
times, no more buffers are available.

This change makes flush() work like MediaCodec: it returns all dequeued
input/output buffers to the codec. Keeping the behavior in line with MediaCodec
might make it easier to factor out a common decoder interface in the future.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=109054178
2015-12-02 17:01:48 +00:00
Oliver Woodman
81040e8d23 Remove stray author tag 2015-11-27 15:56:46 +00:00
Oliver Woodman
0236831e48 Remove author tags. 2015-11-25 17:07:09 +00:00
Oliver Woodman
57ee90a96c Clean up AudioTrack. 2015-11-17 16:29:42 +00:00
Oliver Woodman
830229c821 Fix Libopus renderer's isReady to take into account outputBuffer avail. 2015-11-17 15:45:42 +00:00
Oliver Woodman
62a89ae90c tweak javadoc 2015-10-27 18:57:26 +00:00
Oliver Woodman
dd4d4e8f7e Add libopus/libvpx availability checks 2015-10-27 18:36:24 +00:00
Oliver Woodman
c0f0cbcb7a Move to target API level 23 2015-10-26 15:02:32 +00:00
Oliver Woodman
d8b1f9efcc Add API to get the version of native decoders
Add API to get the version of underlying libvpx and libopus
decoders. Also update the demo app to show the version in the UI.
2015-10-26 14:53:27 +00:00
Oliver Woodman
ba6cb05e0a Update ReadMe files. 2015-09-29 21:55:51 +01:00
Oliver Woodman
e96e618046 Clean up expansion of sample buffers.
- The old approach was technically incorrect, because the checks
were "capacity < sampleSize" and hence neglected the fact that
the buffer position may be greater than 0 (e.g. if the caller
wants to prefix the sample with some additional data).

- Also proactively throw an exception if the buffer is too small,
rather than wait for the failure when we actually do the write.
2015-09-28 20:23:45 +01:00
Oliver Woodman
820433de06 Call stop() to fully play out remaining audio!
Issue: #707
2015-09-10 18:19:09 +01:00
Oliver Woodman
8c3f93d6bf Start to fix media mime types.
- Admit we don't know the mime type (using unknown mime types) rather
  than passing the container mime type.
- Pass the correct mime type for opus, vp9 and vp8, and remove the incorrect
  container checks in the corresponding extensions.
2015-09-07 13:56:54 +01:00
Oliver Woodman
4a9ff7b094 Correctly propagate END_OF_STREAM through Opus decoder. 2015-09-01 14:16:36 +01:00
Oliver Woodman
35a744a5d4 Use perl for in-place substitution. 2015-09-01 14:11:01 +01:00
Oliver Woodman
cde1c27e2b Make Opus codec-specific data match the platform.
Issue: #690
2015-08-19 16:34:59 +01:00