945 Commits

Author SHA1 Message Date
bachinger
4c838043d3 Dispatch custom action in MediaSessionLegacyStub
A custom action sent by legacy controllers as for instance the System UI mini player arrive at MediaSessionCompat.Callback.onCustomAction() and need to be dispatched to the session callback as a such.

PiperOrigin-RevId: 447486859
2022-05-10 17:50:30 +01:00
christosts
7a631f4050 MediaSessionService: define foregroundServiceType
PiperOrigin-RevId: 447467287
2022-05-10 17:49:22 +01:00
ibaker
54d8b5bc7c Don't implement Player.Listener from SubtitleView
We never register SubtitleView as a Player.Listener directly, it's
always done via PlayerView.

PiperOrigin-RevId: 447467037
2022-05-10 17:48:12 +01:00
hschlueter
63dcdf5803 Add listener for FrameProcessingExceptions.
This listener replaces
FrameProcessorChain#getAndRethrowBackgroundExceptions.
The listener uses a new exception type FrameProcessingException
separate from TransformationException as the frame processing
components will be made reusable outside of transformer soon.

PiperOrigin-RevId: 447455746
2022-05-10 17:47:22 +01:00
christosts
1b15d5c370 MediaSessionService: allow apps to opt-out from notifications
Issue: androidx/media#50
PiperOrigin-RevId: 447435259
2022-05-10 17:44:41 +01:00
hschlueter
2e544224c2 Fix GlUtil vector size constant name.
This constant is used for https://docs.gl/es2/glVertexAttribPointer
which takes the number of components per generic vertex attribute
(meaning the size of the individual coordinate vectors here) not the
number of attributes (the number of vertices that the old constant
name referred to).

PiperOrigin-RevId: 447427241
2022-05-10 17:42:39 +01:00
samrobinson
ff7629aba5 Match the suggested bitrate to the actual Kush Gauge formula.
As defined in Kush Amerasinghe's paper 'H.264 For the rest of us'.

PiperOrigin-RevId: 446988272
2022-05-09 11:05:43 +01:00
aquilescanta
e008a78ea6 Disable transcoding when reading content URIs
Before this change, we list the formats for which we don't
want transcoding. This change disables transcoding altogether.

This was tested by checking that transcoding takes place on a
short camera recording only when the added flag is not present
(and AndroidManifest does not declare support for HEVC).

PiperOrigin-RevId: 446986580
2022-05-09 11:04:52 +01:00
huangdarwin
e60ba54ddf Transformer GL: Remove obsolete TODOs.
We won't try to provide/rethrow helpful error messages that are already
provided by GL, as this sort of task would expand into writing a GL verifier.
A Gl verifier is unnecessarily complex for minimal payoff, especially as Apps
expected to read GL error messages would mostly be those writing custom
GlFrameProcessors, who should be already be familiar with reading GL error
messages anyways.

PiperOrigin-RevId: 446950837
2022-05-09 11:04:05 +01:00
ibaker
4f616d6003 Remove ExoPlayer's RawCcExtractor
RawCC is a Google-internal subtitle format, and is no longer used with
ExoPlayer.

PiperOrigin-RevId: 446950691
2022-05-09 11:02:25 +01:00
hschlueter
e9919f6da1 Remove redundant attribute from matrix transformation vertex shader.
The texture coordinates can be derived from the frame coordinates.

PiperOrigin-RevId: 446770538
2022-05-09 11:01:33 +01:00
christosts
3dec4266a3 Remove unused classes from session module
Remove PlayerNotificationManager and DefaultMediaDescriptionAdapter
which are unused in session. The functionality is covered by the
MediaNotification.Provider.

PiperOrigin-RevId: 446687875
2022-05-09 11:00:45 +01:00
yschimke
80928e730c Workaround for OkHttp Interrupt issues.
Relates to https://github.com/square/okhttp/issues/3146. This was from https://github.com/androidx/media/pull/71.

There is a draft PR https://github.com/square/okhttp/pull/7185/files which documents OkHttp's ideal handling of cancellation including interrupts.

But a few key points

1) This is a target state, and OkHttp does not currently handle interrupts correctly.  In the past this has been identified, and the advice is to avoid interrupts on Http threads, see discussion on https://github.com/square/okhttp/issues/1902. Also an attempt at a fix here https://github.com/square/okhttp/pull/7023 which wasn't in a form to land.

2) Even with this fixed, it is likely to never be optimal, because of OkHttp sharing a socket connection for multiple inflight requests.

From https://github.com/square/okhttp/pull/7185

```
Thread.interrupt() is Clumsy
----------------------------

`Thread.interrupt()` is Java's built-in mechanism to cancel an in-flight `Thread`, regardless of
what work it's currently performing.

We recommend against using `Thread.interrupt()` with OkHttp because it may disrupt shared resources
including HTTP/2 connections and cache files. In particular, calling `Thread.interrupt()` may cause
unrelated threads' call to fail with an `IOException`.
```

This PR leaves the Loader/DataSource thread parked on a countdown latch, while this may seem wasteful and an additional context switch. However in practice the response isn't returned until the Http2Connection and Http2Reader have a response from the server and these means effectively parking in a `wait()` statement here 9e039e9412/okhttp/src/jvmMain/kotlin/okhttp3/internal/http2/Http2Stream.kt (L140)

PiperOrigin-RevId: 446652468
2022-05-09 10:59:41 +01:00
hschlueter
4b8ff72d30 Use MatrixTransformation instead of wrapping its GlFrameProcssor.
ScaleToFitFrameProcessor, PresentationFrameProcessor,
and EncoderCompatibilityFrameProcessor now each implement
MatrixTransformation instead of wrapping
MatrixTransformationFrameProcessor.

PiperOrigin-RevId: 446480286
2022-05-09 10:58:56 +01:00
huangdarwin
337b7f769d GL: Update exoplayer to use bindTexture.
Refactoring change only.

PiperOrigin-RevId: 446475708
2022-05-09 10:57:54 +01:00
christosts
c8c7ec61f0 Add TrackSelector.release()
The TrackSelector is released when the player is released. The
TrackSelector can be reused if TrackSelector.init() is called again.

PiperOrigin-RevId: 446439717
2022-05-09 10:57:08 +01:00
bachinger
9ca0f7862a Use Media 3 command constants instead of legacy constants
PiperOrigin-RevId: 446425897
2022-05-09 10:54:26 +01:00
ibaker
931bc70d5f Migrate usages of the deprecated TrackSelectionParameters.CREATOR
PiperOrigin-RevId: 446400192
2022-05-09 10:52:11 +01:00
hschlueter
c94035278c Separate matrix effect specification and implementation.
This change splits AdvancedFrameProcessor into 4 files:
- MatrixTransformationFrameProcessor for the GlFrameProcessor
  implementation
- MatrixTransformation and GlMatrixTransformation for the GlEffect
  specification
- MatrixUtils for the static matrix helpers

PiperOrigin-RevId: 446236384
2022-05-09 10:51:14 +01:00
christosts
534cfc7968 Misc fix on parameter comment
PiperOrigin-RevId: 446181877
2022-05-09 10:50:31 +01:00
christosts
90600e985e Use Android 12L APIs directly
Some APIs from Android 12L were used either via reflection or
constants values were hard-coded. We can now use these APIs directly
since we upgraded the compile SDK version to 32.

PiperOrigin-RevId: 446167543
2022-05-09 10:48:43 +01:00
ibaker
1bde777122 Allow stable API users to bundle/unbundle TrackSelectionParameters
It's reasonable to serialize this type to support backgrounding
use-cases, as demonstrated by the main demo app.

PiperOrigin-RevId: 446161300
2022-05-09 10:46:53 +01:00
ibaker
9a67b30750 Migrate usages from C.TYPE_* to C.CONTENT_TYPE_*
PiperOrigin-RevId: 446156308
2022-05-09 10:46:04 +01:00
hschlueter
b410a922fe Introduce GlEffect interface for effect specification.
PiperOrigin-RevId: 446143537
2022-05-09 10:44:30 +01:00
olly
90ce9a6787 Add AV1 support to the getCodecMaxInputSize function.
PiperOrigin-RevId: 445973162
2022-05-09 10:43:33 +01:00
olly
21448ba302 Add MIDI mime types to decoder_midi and api.txt
PiperOrigin-RevId: 445445952
2022-05-09 10:42:46 +01:00
ibaker
8323c69ed2 Allow stable API users to register PlayerView listeners
These listeners cover controller visibility and fullscreen button
clicks.

PiperOrigin-RevId: 445420757
2022-05-09 10:41:49 +01:00
ibaker
5784068838 Allow stable API users to use DebugTextViewHelper
This is used from the main demo app.

PiperOrigin-RevId: 445420580
2022-05-09 10:41:03 +01:00
ibaker
3dff9fbe36 Allow users of the stable API to register an EventLogger
Overriding any methods of AnalyticsListener requires using the unstable
API. In future we can incrementally add AnalyticsListener methods to the
stable API.

PiperOrigin-RevId: 445420361
2022-05-09 10:40:21 +01:00
hschlueter
3869c0a851 Return recommended output size for FrameProcessorChain.
Also add warning for what can happen if this is ignored.

Previously the return value was overridden by setOutputSurface, now
setOutputSurface only overrides the values using internally.

PiperOrigin-RevId: 445377036
2022-05-09 10:38:32 +01:00
ibaker
abbd7652b1 Add more UI symbols (and some others) to the stable API
These are used by the main demo app and would be reasonably used by
other relatively simple media playback apps.

PiperOrigin-RevId: 445371266
2022-05-09 10:37:42 +01:00
ibaker
0789e2780c Add some Util methods to the stable API
These are used in the main demo app

PiperOrigin-RevId: 445369540
2022-05-09 10:36:57 +01:00
ibaker
5766cd52ba Add copies of PlayerControlView's public listeners to PlayerView
Developers are expected to (eventually) only use methods on
PlayerView (and not PlayerControlView) to interact with the UI
controller.

PiperOrigin-RevId: 445361488
2022-05-09 10:35:58 +01:00
ibaker
1ceccc94ac Prefix @ContentType values with CONTENT_
PiperOrigin-RevId: 445356625
2022-05-09 10:35:12 +01:00
ibaker
1b2e9da0af Rename CONTENT_TYPE_ @AudioContentType values to AUDIO_CONTENT_TYPE_*
This is consistent with the IntDef name, and frees up the CONTENT_TYPE_
prefix for the @ContentType values (which are currently just TYPE_*,
and therefore ambiguous with lots of other 'type' values in C).

PiperOrigin-RevId: 445356476
2022-05-09 10:34:27 +01:00
bachinger
fdd5bcdf5b Clean up MediaConstants
PiperOrigin-RevId: 445219759
2022-05-09 10:33:45 +01:00
ibaker
e7e466f729 Remove empty <p> tag from WebvttDecoder
PiperOrigin-RevId: 445217294
2022-05-09 10:32:48 +01:00
ibaker
a756121c9c Fix Util.inferContentTypeForExtension to handle .ism (smooth streaming)
This method was introduced in e414f0d2ac
as a replacement for Util.inferContentType(String) but it incorrectly
didn't return TYPE_SS when passed "ism" or "isml".

PiperOrigin-RevId: 445217167
2022-05-09 10:32:02 +01:00
huangdarwin
0de9955eb2 Transformer: Misc nits
* Add a /* paramName= */ comment
* Remove an unnecessary comma.
* Remove extra "internal " for a b/### link

PiperOrigin-RevId: 445169649
2022-05-09 10:30:18 +01:00
ibaker
c09647988f Remove unneeded warning suppression from FrameworkMediaDrm
PiperOrigin-RevId: 445162900
2022-05-09 10:29:31 +01:00
claincly
c82cbc094f Change video asset used in TranscodeQualityTest
The old video has a `irregular' resolution of 1080x720. Change to a 1920x1080
video.

PiperOrigin-RevId: 445124065
2022-05-09 10:28:43 +01:00
huangdarwin
0f3e63909c Transformer: Restrict frame buffer size for all omx decoders API >= 29.
PiperOrigin-RevId: 445119411
2022-05-09 10:27:58 +01:00
bachinger
826039ad07 Support chronometer for notifications without seekbar for lower APIs
This appears on the notifcation as the elapsed duration like '2:12'
as we had this with the PlayerNotifcationtManager. Notifications on
recent API versions show a seekbar and duration based on the media
session playback state and ignore the chronometer.

PiperOrigin-RevId: 445110202
2022-05-09 10:25:54 +01:00
claincly
564dc11f28 Add device capability based test skipping.
Change test name prefix from `transform` to `transcode` for consistency.

PiperOrigin-RevId: 445106224
2022-05-09 10:25:07 +01:00
olly
a16c0b3068 Reading AV1 initialization data.
We add an entire class like we do for parsing other codec initialization formats; it's currently not doing any parsing though (... initialization data is really simple for AV1 though: just the entire contents of the box).

For testing, we add the sample file, having been re-encoded with ffmpeg (and we also happen to have another av1 file, too).

PiperOrigin-RevId: 444890282
2022-05-09 10:24:18 +01:00
bachinger
1e251b3be7 Fix incorrect JavaDoc
PiperOrigin-RevId: 444874326
2022-05-09 10:22:32 +01:00
ibaker
fd6b57469d Fix calculations that may lose precision compared to their target type
PiperOrigin-RevId: 444861268
2022-05-09 10:21:44 +01:00
claincly
7af91fc9d5 Ignore mandatory SDP fields as ExoPlayer doesn't use them
Issue: google/ExoPlayer#10049
PiperOrigin-RevId: 444833508
2022-05-09 10:20:38 +01:00
ibaker
e414f0d2ac Clean up Util.inferContentType methods
This fixes some small niggles:
1. `inferContentType(String)` is documented to take a path, but in the
   tests we're passing full URIs.
2. A `String` parameter is usually a path, but also a MIME type or an
   extension. In the new methods, the meaning of a `String` parameter
   is always clear from the name of the method.
3. `inferContentType(String)` is always passed an extension in
   'production' code (which has to be manually prefixed with a dot).
4. `inferContentType(Uri, @Nullable String)` always ignores the Uri if
   the String is non-null. IMO this logic is clearer to a reader if it's
   just in-lined at the call-site.

These methods are used from the demo apps, so will be part of the stable
API.

PiperOrigin-RevId: 444826053
2022-05-09 10:19:01 +01:00
Ian Baker
2898d41f4a Merge pull request #9967 from jruesga:cea708-handle-multiple-service-blocks
PiperOrigin-RevId: 444816821
2022-05-09 10:18:14 +01:00