7917 Commits

Author SHA1 Message Date
Oliver Woodman
e2a6775ea4 Merge pull request #6999 from xufuji456:dev-v2
PiperOrigin-RevId: 298544278
2020-03-30 14:25:03 +01:00
Oliver Woodman
c3f9f0e5fe Merge pull request #7010 from dbrain:fix_nullability
PiperOrigin-RevId: 297187116
2020-03-30 13:47:20 +01:00
vigneshv
265670cf93 Add ReleaseInputBuffer callback
The release_input_buffer callback will be called when the library
is done consuming an "input buffer". The buffer passed into
EnqueueFrame must be kept valid until this callback is called. If
frame parallel is false, then this callback can be nullptr (in
this case the buffer has to be kept valid until the next call to
DequeueFrame). If frame parallel is true, this callback cannot be
nullptr.

PiperOrigin-RevId: 296276083
2020-03-30 13:46:50 +01:00
Oliver Woodman
8591e69b6a Remove duplicate SCTE-35 format and add sample to TsExtractorTest
It's not clear why we're currently outputting the format in both init()
and consume() - it seems likely that this was accidentally introduced
in <unknown commit>
when we started outputting the format in consume() but didn't remove it
from init().
2020-03-30 13:46:24 +01:00
olly
908a76e851 Change libgav1's frame buffer callback API.
1. Have frame buffer callbacks return Libgav1StatusCode instead of int.
The 0 (success), -1 (failure) return value convention is less obvious.
Note: The callers of frame buffer callbacks,
BufferPool::OnFrameBufferSizeChanged() and YuvBuffer::Realloc(),
currently return bool, so more work is needed to propagate the frame
buffer callbacks' Libgav1StatusCode return value to the Decoder API.

2. Allow the FrameBufferSizeChangedCallback to be omitted if the frame
buffer size information is not useful to the application.

3. Remove the old (version 1) frame buffer callback API. Remove the
frame buffer callback adaptor.

frame_buffer2.h is renamed frame_buffer.h.
Libgav1FrameBuffer2 is renamed Libgav1FrameBuffer.
GetFrameBufferCallback2 and ReleaseFrameBufferCallback2 are renamed
GetFrameBufferCallback and ReleaseFrameBufferCallback.

PiperOrigin-RevId: 295971183
2020-03-30 13:44:13 +01:00
olly
75bd4ebc18 Use &id_ as buffer_private_data for libgav1.
This avoids the issue of whether it is defined behaviour to cast an
arbitrary int (or even intptr_t) value to a void* pointer. This is the
original approach used before commit 0915998add5918214fa0282a69b50a159168a6d5.

PiperOrigin-RevId: 295552115
2020-03-30 13:44:05 +01:00
olly
766b383d27 Use libgav1 frame buffer callback helper functions
Libgav1 recently added the ComputeFrameBufferInfo() and SetFrameBuffer()
helper functions for writing frame buffer callbacks. Using them
simplifies the Libgav1GetFrameBuffer() function.

Also resurrect the AlignTo16() function.

PiperOrigin-RevId: 295548330
2020-03-30 13:43:58 +01:00
olly
b73f6b6ef0 gav1_jni: fix pointer->int conversion warnings
fixes:
gav1_jni.cc:446:25: error: cast from pointer to smaller type 'int' loses information
  const int buffer_id = reinterpret_cast<int>(buffer_private_data);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gav1_jni.cc:730:9: error: cast from pointer to smaller type 'int' loses information
        reinterpret_cast<int>(decoder_buffer->buffer_private_data);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

after 0915998add

PiperOrigin-RevId: 295211245
2020-03-30 13:43:47 +01:00
olly
0acc95cfbb Cast void* to JniContext* using static_cast.
static_cast is more appropriate than reinrerpret_cast for casting from
void* to JniContext*. See Section 7.2.1 (page 173) in The C++
Programming Language, 4th Edition and
https://stackoverflow.com/questions/310451/should-i-use-static-cast-or-reinterpret-cast-when-casting-a-void-to-whatever

PiperOrigin-RevId: 293812940
2020-03-30 13:43:39 +01:00
olly
11635191a6 Switch to new libgav1 frame buffer callback API.
The new code in Libgav1GetFrameBuffer is copied from
libgav1/src/frame_buffer_callback_adaptor.cc. It may become libgav1
utility functions available to libgav1 clients in the future.

The Libgav1FrameBuffer struct in the old frame buffer callback API is
defined as follows:

  typedef struct Libgav1FrameBuffer {
    uint8_t* data[3];
    size_t size[3];
    void* private_data;
  } Libgav1FrameBuffer;

Copy these three fields to the JniFrameBuffer class as private data
members and add the RawBuffer() and Id() getter methods.

The existing AlignTo16 function is replaced by the copied Align template
function.

PiperOrigin-RevId: 293709205
2020-03-30 13:43:27 +01:00
ibaker
1818921a20 Catch-and-log all subtitle decode errors
issue:#6885
PiperOrigin-RevId: 295931197
2020-03-30 13:41:41 +01:00
andrewlewis
ed1eade980 Update stale comment in TrimmingAudioProcessor
The part about leaving the pending trim start byte count unmodified
if the processor was just configured is not correct.

PiperOrigin-RevId: 295745371
2020-03-30 13:40:36 +01:00
olly
23e4236227 Add missing IntDef to switch
PiperOrigin-RevId: 295692163
2020-03-30 13:39:30 +01:00
Oliver Woodman
49910fe725
Merge pull request #6989 from google/dev-v2-r2.11.3
r2.11.3
2020-02-18 15:02:33 +00:00
Oliver Woodman
b14d879947 Tweak Javadoc 2020-02-18 14:47:58 +00:00
olly
5f1c6b650d Fix SmoothStreaming
Issue: #6981
PiperOrigin-RevId: 295579872
2020-02-18 12:15:13 +00:00
olly
d93b57c009 Zero out trailing bytes in CryptoInfo.iv
CryptoInfo.iv length is always 16. When the actual initialization vector
is shorter, zero out the trailing bytes.

Issue: #6982
PiperOrigin-RevId: 295575845
2020-02-18 12:14:34 +00:00
kimvde
a967ff3204 Fix DefaultExtractorsFactory Javadoc
PiperOrigin-RevId: 295540885
2020-02-18 12:11:29 +00:00
olly
cd0999e733 Bump version to 2.11.3
PiperOrigin-RevId: 295695297
2020-02-18 12:10:24 +00:00
olly
fd24df3b26 Fix demo app download notification
PiperOrigin-RevId: 294503035
2020-02-13 18:14:21 +00:00
Oliver Woodman
62092e6645
Merge pull request #6888 from google/dev-v2-r2.11.2
r2.11.2
2020-02-13 18:11:29 +00:00
Oliver Woodman
0740e3cc8e Fix release date 2020-02-13 18:08:54 +00:00
aquilescanta
fefe4616fc Revert accidental change in media.exolist.
PiperOrigin-RevId: 294193213
2020-02-13 18:06:09 +00:00
andrewlewis
646e690d9f Add GL demo app
Demonstrates rendering to a GLSurfaceView while applying a GL shader.

Issue: #6920
PiperOrigin-RevId: 293551724
2020-02-13 16:52:20 +00:00
aquilescanta
19c8858341 Prepare and release DrmSessionManager in Renderers
Issue: #6951
PiperOrigin-RevId: 294187695
2020-02-13 15:53:05 +00:00
kimvde
67a748f47d FLAC extension: remove sample rate check
This check is not needed because the FLAC specification does not
restrict the sample rate value and because the extension reads files
with other sample rates properly.

PiperOrigin-RevId: 292909391
2020-02-13 15:50:20 +00:00
olly
890fd4efb8 Don't re-init codec if DRM session is unchanged
This condition is trying to detect when it might be necessary
to switch from a non-secure to a secure codec. This is not
possible if the DRM session is unchanged, unless a different
codec is required for some other reason (e.g., H264 -> H265),
which is anyway handled by canKeepCodec below.

PiperOrigin-RevId: 292909126
2020-02-03 14:46:08 +00:00
olly
b7c5f5cde6 Avoid unnecessary decoder instantiations on key rotation
Issue: #6903
PiperOrigin-RevId: 292884280
2020-02-03 11:24:25 +00:00
olly
45cb55ce09 Lock down SampleQueue to reasonable extension points
PiperOrigin-RevId: 292542298
2020-02-01 19:40:07 +00:00
bachinger
ee2ad943d7 annotate nullabilty of CommandReceiver
Issue: #6938
PiperOrigin-RevId: 292415853
2020-02-01 19:39:43 +00:00
andrewlewis
0cc1eba757 Add missing AV1 extension path to .gitignore
PiperOrigin-RevId: 292347360
2020-02-01 19:39:28 +00:00
olly
fd88115728 HLS: Fix key rotation
Passing EXT-X-KEY DrmInitData through the FragmentedMp4Extractor
doesn't work for streams with key rotation, because an extractor
instance is used for multiple segments, but is only passed the
EXT-X-KEY DrmInitData corresponding to the first segment.

This change removes passing DrmInitData through the extractor,
and instead passes it via FormatAdjustingSampleQueue. This is
in-line with how manifest DrmInitData is handled during DASH
playbacks.

Issue: #6903
PiperOrigin-RevId: 292323429
2020-02-01 19:39:06 +00:00
olly
850aef4f67 SampleQueue: Let subclasses easily invalidate format adjustment
This is a nice-regardless improvement to SampleQueue, which will
likely to used to fix the referenced issue. It makes it possible
for SampleQueue subclasses to support dynamic changes to format
adjustment in a non-hacky way.

Issue: #6903
PiperOrigin-RevId: 292314720
2020-02-01 19:38:06 +00:00
olly
12bb35867e Expand dangal workaround to all API levels
It doesn't seem worth keeping the cap, since the device
will presumably stop receiving major version updates at
some point anyway.

Issue: #6899
PiperOrigin-RevId: 291899439
2020-02-01 19:37:20 +00:00
Oliver Woodman
3e75d2a689 Fix demo app 2020-01-27 19:13:24 +00:00
olly
fbe840e880 Upgrade OkHttp dependency to 3.12.8
OkHttp 3.12.7 introduced a regression, which was fixed in 3.12.8.

PiperOrigin-RevId: 291695577
2020-01-27 19:08:45 +00:00
ibaker
d1703ad68c Ensure the demo app requests local-file permissions for subtitle files
Currently we only do this for the main sample URI, not for subtitles.
So pairing a web-based video file with a local subtitle file on a fresh
install just throws a 'permission denied' exception.

PiperOrigin-RevId: 290794091
2020-01-27 19:07:41 +00:00
andrewlewis
b59a1b89e3 Remove duplicate release note
PiperOrigin-RevId: 290600248
2020-01-27 19:06:57 +00:00
tonihei
c79cb1bfe0 Add ID3 genres added in Wimamp 5.6 (2010).
All these genres are currently causing a warning and are not added to the Metadata.Entry.

PiperOrigin-RevId: 290594810
2020-01-27 19:06:36 +00:00
olly
7aefaa7d68 extensions/av1: use -O2 for release builds
+ force arm (over thumb) mode for 32-bit builds

-O2 improves performance ~30-40% over the default -Oz depending on the
resolution; this is similar to what is done for vp9 which uses -O3.

PiperOrigin-RevId: 290318121
2020-01-27 19:06:17 +00:00
olly
ce1ec1d5dc Release notes: Move download segment merging out of 2.11.2
PiperOrigin-RevId: 290276507
2020-01-17 17:00:34 +00:00
olly
b137cfbd99 Tidy up DownloadService restart. Final change for #6798.
- Add additional Listener methods to DownloadManager, to inform of
  changes to whether the downloads are paused or waiting for requirements.

- Only schedule the Scheduler if we really are waiting for requirements.

- Only restart the service if we're no longer waiting for requirements,
  and if there are queued downloads that will now be restarted.
  Previously the service would be restarted whenever the requirements
  were met, regardless of whether there was any work to do.

- Restart service if it might be stopping, as well as if it's already
  stopped. Also restart service if there's a download state change to a
  state for which the service should be started, if.

Issue: #6798
PiperOrigin-RevId: 290270547
2020-01-17 16:16:52 +00:00
olly
0a2373c300 2.11.2 release notes and version bump
PiperOrigin-RevId: 290269098
2020-01-17 16:16:36 +00:00
krocard
49349f0f28 Do not hold a codec in OnFrameRenderedListener
Doing so prevent Codec which is a big object with
JNI to be garbage collected.

As the codec can not be hold in the listener, there
is no way to call release, as it must be called on
the same codec.
As a result the release method is also removed.
The downside is that at runtime some callbacks may be
dropped but it should be a short transitive state.

This also simplifies lifecycle of the listener as
the client does not have to know if release needs
to be called or not.

An alternative would have been to hold a weak ref,
but I deemed it too complicated for the
runtime gain.

PiperOrigin-RevId: 290231659
2020-01-17 16:14:51 +00:00
Oliver Woodman
ea4711630f Fix build 2020-01-17 14:30:48 +00:00
olly
f146bad439 HLS: Fix slow seeking into long MP3 segments
Issue: #6155
PiperOrigin-RevId: 290117324
2020-01-17 14:02:33 +00:00
kimvde
0456b638e3 FlacExtractor: handle case where last frame < MAX_FRAME_HEADER_SIZE
PiperOrigin-RevId: 290079840
2020-01-17 14:02:29 +00:00
krocard
e202560dc9 Tunneling timestamp use Message instead of Runnable
This avoids allocating a Runnable.

PiperOrigin-RevId: 290079660
2020-01-17 14:02:16 +00:00
olly
0ac22d3401 Start service in foreground if allowed
This fixes an issue where a DownloadService implementation
that allows foreground but doesn't provide a scheduler would
not be restarted in the case that it was still in memory but
classed as idle by the platform.

It also speeds up service restart in the case that a
scheduler is provided.

Issue: #6798
PiperOrigin-RevId: 290068960
2020-01-17 14:01:50 +00:00
olly
f35cb8ae49 Split SampleQueue.advanceTo for advance & seek use cases
This method has two use cases:

1. Seeking. Calls are immediately preceded by a call to rewind(), and
   the returned value isn't important unless it's ADVANCED_FAILED (i.e.
   the caller is only interested in success and failure).
2. Advancing. The return value is important unless it's ADVANCED_FAILED,
   in which case the caller wants to treat it as 0.

This change creates separate methods for each use case. The new seekTo
methods automatically rewind and return a boolean. The updated advanceTo
method returns 0 directly in cases where ADVANCED_FAILED was returned.
Arguments that were always hard-coded to true by callers have also been
removed.

This change is a step toward one possible solution for #6155. How we'll
solve that issue is still up for discussion, but this change seems like
one we should make regardless!

Issue: #6155
PiperOrigin-RevId: 290053743
2020-01-17 14:01:45 +00:00