Commit graph

35 commits

Author SHA1 Message Date
Oliver Woodman
6bf52dd69c Report decoder initialization information out of track renderer. 2015-04-10 23:06:57 +01:00
Oliver Woodman
a17123c49b Clean up codec reinitialization. 2015-04-10 23:03:50 +01:00
Oliver Woodman
d745384d99 Change decodeOnly to be a sample flag. 2015-04-10 22:55:12 +01:00
ojw28
9183525b5e Merge pull request #221 from martinbonnin/better_input_format_change_for_non_adaptive_codecs
better handling of input format change for non-adaptive codecs
2015-04-01 13:56:15 +01:00
Oliver Woodman
5d0457152d Remove need for InlinedApi with a few more C constants. 2015-03-11 15:48:12 +00:00
Oliver Woodman
8c1088559e Generalize getPsshInfo to properly accomodate WebM.
- Rather than returning a map, return a DrmInitData object,
  with mapped and non-mapped implementations.
- Include a suitable mimeType to pass to the MediaDrm. Previously
  we were incorrectly passing the mimeType of the samples,
  where-as MediaDrm expects the container mimeType. Note that
  it doesn't matter whether the mimeType starts with "video" or
  "audio", hence using video mimeTypes everywhere.
2015-03-10 19:42:48 +00:00
Oliver Woodman
a1d4a5e154 Continue waiting for keys until the codec is flushed.
It was possible for a codec input buffer to be filled with two frames' worth of
data, if seekTo was called after populating a buffer, if waitingForKeys was true
and seeking did not trigger a flush. This caused the CryptoInfo to be configured
as if the input buffer contained a large amount of reconfiguration data as
cleartext.

Move resetting waitingForKeys to flushCodec, so that we don't try to read the
next sample from the source until the first one has been consumed or discarded.
2015-03-03 18:16:22 +00:00
Oliver Woodman
bc99435b48 Add C.SAMPLE_FLAG_SYNC and removed InlinedApi suppression in a few places. 2015-02-13 20:20:45 +00:00
Oliver Woodman
61a86295fd Fix for video-only playbacks transitioning straight to STATE_ENDED.
The complexity around not enabling the video renderer before it
has a valid surface is because MediaCodecTrackRenderer supports
a "discard" mode where it pulls through and discards samples
without a decoder. This mode means that if the demo app were to
enable the renderer before supplying the surface, the renderer
could discard the first few frames prior to getting the surface,
meaning video rendering wouldn't happen until the following sync
frame.

To get a handle on complexity, I think we're better off just removing
support for this mode, which nicely decouples how the demo app
handles surfaces v.s. how it handles enabling/disabling renderers.
2015-02-12 17:02:34 +00:00
Martin Bonnin
e33e1d7922 cleaner test 2015-01-27 18:37:27 +01:00
Martin Bonnin
c228017fe4 rename hasQueuedOneInputBuffer to hasQueuedInputBuffer 2015-01-27 18:35:40 +01:00
Martin Bonnin
424b29f996 remove REINIT_STATE_DO_REINIT_NOW state, reinit directly when needed. 2015-01-27 10:44:02 +01:00
Martin Bonnin
79708f43f8 handle the case when flushCodec() is called while reiniting the decoders 2015-01-22 10:24:51 +01:00
Oliver Woodman
a879819dd3 Force callers into MediaCodecUtil to catch any exceptions that occur.
Issue: #217
Issue: #228
2015-01-12 17:40:55 +00:00
Martin Bonnin
e8a8c49a97 better handling of input format change for non-adaptive codecs
* this fixes a bug when switching from HE-AAC 22050Hz to AAC 44100Hz (the AudioTrack was not reset and we were trying to send a bad number of bytes, triggering a "AudioTrack.write() called with invalid size" error)
* this also improves quality switches, making it almost seamless
2014-12-23 13:47:50 +01:00
Oliver Woodman
2a832fd3c4 Minor stylistic tweaks. 2014-11-20 11:03:47 +00:00
ojw28
d506d7660d Merge pull request #147 from jonasl/dev-gc
MediaCodecTrackRenderer: Avoid excessive garbage generation
2014-11-19 16:08:38 +00:00
Oliver Woodman
127bcd18c3 Bring internal/external branches closer.
- Unredact internal error ids.
- Move images.
2014-11-19 15:58:26 +00:00
Jonas Larsson
255c3b27f6 MediaCodecTrackRenderer: Avoid excessive garbage generation
Looking up a long in a HashSet<Long> auto boxes the long and leaves
it for the GC. As decodeOnly is relatively infrequent it's much
better to do a simple linear search in a List<Long>. That way
we can avoid boxing every incoming time stamp value. In the general
case this will be linear searching in an empty list, a very fast
operation.

Signed-off-by: Jonas Larsson <jonas@hallerud.se>
2014-11-18 15:41:16 -08:00
Oliver Woodman
6a544da2f8 Use new MediaCodecList APIs on L. 2014-11-18 18:58:04 +00:00
Oliver Woodman
f1c646b793 Add diagnostic info to decoder exceptions + minor cleanup 2014-11-13 16:10:21 +00:00
Oliver Woodman
d2e73dd566 Add brackets to make expression clearer. 2014-11-06 19:26:41 +00:00
Oliver Woodman
5f6b197355 Allow direct and indirect buffer replacement.
Also tweak ManifestFetcher.
2014-10-27 10:58:43 +00:00
Oliver Woodman
027d9eefbd Smoother playback #1.
Propagate elapsedRealtimeUs to the video renderer. This allows
the renderer to calculate and adjust for the elapsed time since
the start of the current rendering loop. Typically this is <2ms,
but there situations where it can go higher (normally when the
video renderer ends up processing more than 1 output buffer in
a single loop).

Also made variable naming more consistent throughout the package.
2014-10-09 17:26:01 +01:00
Oliver Woodman
ec90eac301 Support anamorphic video content. 2014-09-11 16:34:35 +01:00
Oliver Woodman
5d35698d8f Make MediaCodecTrackRenderer discard non-keyframes after seek.
This means that after a decoder flush, the renderer will avoid
feeding non-keyframes into the decoder until it has received and
fed the first keyframe. The decoder has no way of correctly
decoding non-keyframes that arrive before a keyframe.
2014-09-08 11:30:20 +01:00
Oliver Woodman
d465ab7029 Call FormatHolder what it really is.
Since we have a Format class as well, it's very confusing that
FormatHolder actually holds a MediaFormat. I think it's quite
likely that Format will need promoting into the root package as
part of the HLS work, which will make this even more confusing
(although it is possible that for HLS we'll define yet another
Format class, if it turns out we need significantly different
fields).

Note - I deliberately avoided renaming the formatHolder
args/params, because they're not particularly ambiguous and
because it introduces some ugly line breaks.
2014-09-08 11:30:16 +01:00
Oliver Woodman
a7b88cd6a9 Tighten isReady() up again.
- Bring back requirement for the first video frame to be rendered
  before isReady returns true, *unless* we've deduced that the
  upstream source is serving multiple renderers.
- Ditto for requiring that the audio track has some buffered data.
2014-09-08 11:30:14 +01:00
Oliver Woodman
58e9e61688 Remove unnecessary SuppressWarning annotations. 2014-08-12 14:13:43 +01:00
Oliver Woodman
8ec8840261 Minor cleanup.
- Add constants class. Currently housing a single lonely variable,
which is used generally throughout the library, and so no longer
nicely fits into a specific class.

- Rename a few other constants to add clear units.

- Made minor tweak to ExoPlayer documentation.
2014-08-11 18:38:39 +01:00
Oliver Woodman
25a532656c Optimize some CodecCounter inefficiency.
1. Use ints rather than longs.
2. Remove some counters that dont seem hugely useful.
3. Replace use of volatile with explicit method calls that
   cause a memory barrier. This is a lot more efficient than
   using volatile because it can be invoked only once per
   doSomeWork.
2014-08-11 17:42:08 +01:00
Oliver Woodman
9a124120ff Changes around renderer readiness and extraction.
- Make MediaCodecTrackRenderer.isReady more permissive.
  This largely fixes #21
- Bring WebmExtractor closer to FragmentedMp4Extractor.
  The two will probably be placed under a common interface
  fairly soon, which will allow significant code
  deduplication.
2014-08-01 15:56:26 +01:00
Oliver Woodman
b3277c666b Add language to Format (+other misc fix). 2014-07-28 14:29:21 +01:00
Oliver Woodman
563b434de2 Keep audio time in sync with arbitrary decodeOnly samples.
AudioTrack time will go out of sync if the decodeOnly flag
is set of arbitrary samples (as opposed to just those following
a seek). It's a pretty obscure case and it would be weird for
anyone to do it, but we should be robust against it anyway.
2014-07-04 00:52:19 +01:00
Oliver Woodman
27ab5c83a6 Initial drop. 1.0.10. 2014-06-16 12:56:04 +01:00