2035 Commits

Author SHA1 Message Date
Andy Hung
71791c0e0c SoundPool: Clean up Stream::play_l logic for garbage collection
Test: soundpool_stress
Test: atest SoundPoolAacTest
Test: atest SoundPoolHapticTest
Test: atest SoundPoolMidiTest
Test: atest SoundPoolOggTest
Bug: 210682934
Change-Id: Ief7ff8415861570c0f2f817bfae7e88948d810c0
2021-12-15 19:40:10 -08:00
Andy Hung
361e9e1da9 Merge "SoundPool: Implement generic garbage collection" 2021-12-14 18:34:51 +00:00
Andy Hung
151117ec0b SoundPool: Update queue only if streamID matches
SoundPool API commands are based on an atomic
compare-StreamID if match then operate (see compare-exchange).

Test: soundpool_stress
Test: atest SoundPoolAacTest
Test: atest SoundPoolHapticTest
Test: atest SoundPoolMidiTest
Test: atest SoundPoolOggTest
Bug: 201233890
Bug: 201262390
Change-Id: I63cc07d581a0ac1d5440852bfe0c75edc9d73e75
2021-12-09 10:03:26 -08:00
Andy Hung
4474c3f82c SoundPool: Implement generic garbage collection
Move audio tracks to a gc mechanism for release outside of lock.

Test: soundpool_stress
Test: atest SoundPoolAacTest
Test: atest SoundPoolHapticTest
Test: atest SoundPoolMidiTest
Test: atest SoundPoolOggTest
Bug: 203193643
Change-Id: I5babd4f3fa73cca25579fde2194123bf62cf53b4
2021-12-02 11:32:28 -08:00
Emilian Peev
62d405415b MediaUtils: Tag HAL_PIXEL_FORMAT_RAW12 as non-YUV
Bug: 205179321
Test: Camera CTS
Change-Id: Ib2e7d510db8502e9ed0829e924e741ece7158a4f
2021-11-10 14:16:56 -08:00
Santiago Seifert
05f95dcaa7 Replace new with sp<>::make
As per sp's recommendations.

Bug: 204401299
Change-Id: Ida464b7ef44e2ad5855764e4e7d03b9f6bd5d1b0
Test: Built and flashed device.
Test: atest CtsMediaTestCases:MediaPlayerTest
2021-11-03 12:12:11 +00:00
Jiyong Park
0c103dcde9 Remove ndk_platform backend. Use the ndk backend.
The ndk_platform backend will soon be deprecated because the ndk backend
can serve the same purpose. This is to eliminate the confusion about
having two variants (ndk and ndk_platform) for the same ndk backend.

Bug: 161456198
Test: m
Merged-In: I674244ff9b873d3779d3d649822389ad441fa0af
Change-Id: I674244ff9b873d3779d3d649822389ad441fa0af
(cherry picked from commit 672b1349c86f4ae024e71587fc05bf8af046a53d)
2021-10-25 08:46:24 +09:00
Treehugger Robot
8b93d78c01 Merge changes I8c36f5af,I800bc352 am: 9acfdcf214
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1826714

Change-Id: I5b6c9dc465cd733569ec33afacee530e5b27eb11
2021-09-15 23:45:25 +00:00
Mikhail Naganov
9690a02f80 AudioEffect: fix racy access to callback data
Since the EffectCallback in android::AudioEffect can
keep an instance of the latter alive for a longer time
than Java AudioEffect is alive, the callback need to
ensure that it's not trying to use deallocated objects
and deleted JVM references.

Bug: 178363662
Test: manual using EffectsTest app
Test: atest CtsMediaTestCases:AudioEffectTest
Test: atest CtsMediaTestCases:BassBoostTest
Test: atest CtsMediaTestCases:DynamicsProcessingTest
Test: atest CtsMediaTestCases:EnvReverbTest
Test: atest CtsMediaTestCases:EqualizerTest
Test: atest CtsMediaTestCases:LoudnessEnhancerTest
Test: atest CtsMediaTestCases:PresetReverbTest
Test: atest CtsMediaTestCases:VisualizerTest
Change-Id: I8c36f5af4a1a2b14e81b1344570d2f8746ffa91e
2021-09-15 13:58:30 -07:00
Hongguang Chen
bcc2864d50 Merge "Update tuner OWNERS." am: 332cd02609
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1801122

Change-Id: I7bd2e583584e5685c77e5c94c4eb87b3e8775180
2021-08-19 21:06:49 +00:00
Hongguang
0daaeb1d8a Update tuner OWNERS.
Bug: 191825295
Test: N/A
Change-Id: I5cd78e277008897913dcd3a5ce4d382a66fa3d27
2021-08-19 02:43:19 +00:00
George Burgess IV
e485264ff5 MTP: fix a memory leak
We unconditionally leak every instance that we `new` of this. Move it to
the stack to fix this, since it doesn't need to be on the heap.

Bug: 188752500
Test: TreeHugger

Change-Id: I24ed3bb29c5a6912398a9e00e7748fd406cf6a62
2021-07-19 17:09:10 +00:00
Henry Fang
f3e53d082c fix memory leak in initilization and finalization
bug: 193107250
Test: Manual
Change-Id: I5b57ee6467d39765fab15d7a2b4b8e7c09ad8f3a
2021-07-08 19:56:26 -07:00
James Wei
4f1a6d6f7d MTP: Skip runtime thumbnail generation for Android Host
Android Host is not capable to deal with the long processing time for
runtime thumbnail generation.
Skip runtime thumbnail generation for Android Host
but keep no impact to other Host

Bug: 188752500
Test: atest MtpTests
Test: atest MtpServerTest
Test: atest MtpServiceTests
Test: manual test on Windows 10 File Explorer
Test: manual test on Android Host Files App
Change-Id: I24ed3bb29c5a6912398a9e00e7748fd406cf6a64
2021-06-21 21:36:14 +08:00
Andy Hung
8558709c73 Audio: Support FCC_LIMIT for 22.2 testing
Rename from FCC_8.

Test: SoundPool(Aac|Haptic|Midi|Ogg)Test
Bug: 189325443
Change-Id: I6c83d4bc2cbf4aaf72ac4648bbebaceaf9bb06a9
2021-06-08 11:15:36 -07:00
Svet Ganov
2eebf92965 Switch media fw permissions checks to AttributionSource
Attribution source is the abstraction to capture the data
flows for private data across apps. Checking permissions
for an attribution source does this for all apps in the
chain that would receive the data as well as the relevant
app ops are checked/noted/started as needed.

Teach speech recognition service about attribution
chains. If an implementation does nothing the OS
would enforce permisisons and do blame as always.
This apporach leads to double blaming and doesn't
support attribition chains where app calls into
the default recognizer which calls into the on
device recognizer (this nests recursively). If the
implementer takes advantage of the attribution chain
mechanims the permissions for the entire chain are
checked at mic access time and all apps are blamed
only once.

Fixed a few bugs around finishing ops for attribution
chains. Also ensured that any app death in a started
attribution chain would lead to finishing the op for
this app

bug: 158792096

Test: (added tests for speech reco)
      atest CtsMediaTestCases
      atest CtsPermissionTestCases
      atest CtsPermission2TestCases
      atest CtsPermission3TestCases
      atest CtsPermission4TestCases
      atest CtsPermission5TestCases
      atest CtsAppOpsTestCases
      atest CtsAppOps2TestCases

Merged-In: Ic92c7adc14bd2d135ac13b96f17a1b393dd562e4

Change-Id: Ic92c7adc14bd2d135ac13b96f17a1b393dd562e4
2021-06-01 23:43:29 +00:00
Lajos Molnar
16ceab17a0 media: propagate profiles to EncoderProfiles
Bug: 171673898
Test: atest CamcorderProfileTest
Change-Id: I486762863cd29239b44846b54b146458426b643b
2021-05-03 23:27:42 -07:00
Lajos Molnar
973b2e89bd media: pass full EncoderProfiles from XML
Get multiple audio/video codec profiles from MediaProfiles object
instead of just wrapping the old CamcorderProfiles objects.

Bug: 171673898
Test: atest CamcorderProfileTest
Change-Id: If56ac6c2a89992361f0491d8175af1f89dffd3d0
2021-05-03 23:27:42 -07:00
Santiago Seifert
9642d628ab Merge "Rename MediaExtractor symbols to log session id" into sc-dev 2021-05-01 10:51:09 +00:00
Santiago Seifert
14cdc32bd0 Rename MediaExtractor symbols to log session id
Test: atest CtsMediaHostTestCases
Bug: 167036690
Change-Id: I2e71d460e6907400daeba21fd6a76fa0ea5e0922
Merged-In: I2e71d460e6907400daeba21fd6a76fa0ea5e0922
2021-04-30 22:32:55 +00:00
Robert Shih
26cb27a912 Merge "libmedia_jni requiresSecureDecoder: throw on error" into sc-dev 2021-04-30 21:52:31 +00:00
Amy Zhang
75d890a7f3 Merge "Get media share memory handle only when the filter is not a passthrough media filter" into sc-dev 2021-04-30 00:02:05 +00:00
Amy Zhang
e6af84e4a0 Update TODO docs in TunerClient on resource id/handle mapping
The resource id/handle mapping is no longer needed in the TunerClient
once the TunerService migration is done.

The mapping should only be maintained in the TunerService

Test: make
Bug: 186785141
Change-Id: Idfb02fe5935d9b25aac749c0f77eda111e0959ea
2021-04-29 13:52:33 -07:00
Amy Zhang
168a40a6a7 Get media share memory handle only when the filter is not a passthrough
media filter

Previously we get the share memory handle on filter opening, which only
has the information on filter types.

Now we move the share memory handle to the filter config API call so
that only the non-passthrough filter will get the share memory handle.

Test: sample tis on cuttlefish
Bug: 185627837
Change-Id: I33fd4950ec12291f6ca31a36b081d66643d5c319
2021-04-29 13:25:23 -07:00
Robert Shih
5bb242afe0 libmedia_jni requiresSecureDecoder: throw on error
Bug: 164486735
Test: MediaDrmTest
Change-Id: I2a062e6bd73630621fd022fcb0d640f812a7a8eb
2021-04-28 10:17:44 -07:00
Amy Zhang
9e0575aa07 Merge "Use char16_t instead of int in FilterClient to pass 16-bit data defined in TunerHAL" into sc-dev 2021-04-20 17:04:52 +00:00
Amy Zhang
e17fcccb1c Use char16_t instead of int in FilterClient to pass 16-bit data defined in TunerHAL
char is char16_t in cpp backend when defined in AIDL interface.
Which matches uint16_t type defined in the Tuner HAL.
See: https://source.android.com/devices/architecture/aidl/aidl-backends#types

Test: make
Bug: 185627837
Change-Id: I287197c34ef5a892c05df3cb9226006fd2cf88dd
2021-04-19 16:06:57 -07:00
Amy Zhang
5c6694aa25 Merge "Fix TunerService/TunerClient implementation issues" into sc-dev 2021-04-19 20:18:30 +00:00
Amy Zhang
15823c22a7 Fix TunerService/TunerClient implementation issues
1. TunerJNI is setting Tuner 1.1 Frontend extended settings regardless of the tuner hal version

2. SectionSettings section bit copy issue

Test: make
Bug: 185627837
Change-Id: I7ab03e2c96b6abd1439f6a277450005e625c0015
2021-04-16 16:21:56 -07:00
Amy Zhang
2aa9fa55cc Force FilterClient to NOT reset the FMQ pointer when creating the MQ
Previously we created the Filter FMQ from the AIDL MQ Descriptor after
it is passed from the TunerService to the client side.
But the default creation would reset the mq pointer.
Since we only get the mq when read operation is executed on the filter,
the mq could have already been writtern. The default creation would
reset the pointer and erase the data.

Test: atest TunerTest
Bug: 185542142
Change-Id: I56a09e30b0cfbf9fadcaa7f0c7ef1ac6a6d601b1
2021-04-15 21:36:20 -07:00
Amy Zhang
64425453ab Init shared memory handle when opening Filter in the Tuner JNI
This CL also cleans up some local pointers

Test: atest android.media.tv.tuner.cts
Test: manual sampletis
Bug: 184782012
Change-Id: Ia30b82f9b5e1e984bedbe9abb8bf79d0cf4f5c24
2021-04-12 21:35:59 -07:00
Amy Zhang
93b3dd7fb0 Allow Descrambler.add/removePid to pass a nullable optional filter
Test: make
Bug: 184851519
Change-Id: I5457150579e57cc2c39a3bd390bbef62de73520b
Merged-In: Icf7d9526fa15dc11b23e9f73dbfceee748640772
2021-04-13 01:09:45 +00:00
Amy Zhang
316b045b9a Allow Descrambler.add/removePid to pass a nullable optional filter
Test: make
Bug: 184851519
Change-Id: Icf7d9526fa15dc11b23e9f73dbfceee748640772
2021-04-08 12:24:04 -07:00
Wonsik Kim
8798c8ccbc MediaCodec: add methods to query/subscribe vendor parameters
Bug: 183242434
Test: atest android.media.cts.MediaCodecTest
Change-Id: Iaef8f8aef564dc8cda84a83f6cc628d87649b43d
2021-03-24 09:39:02 -07:00
Wonsik Kim
197e1a7f5e DO NOT MERGE MediaCodec: add methods to query/subscribe vendor parameters
Bug: 183242434
Test: atest android.media.cts.MediaCodecTest
Change-Id: Iaef8f8aef564dc8cda84a83f6cc628d87649b43d
2021-03-24 02:51:59 +00:00
Guillaume Chelfi
c072caf19b Add tunnel mode video peek related APIs
Bug: 157501309
Test: atest android.media.cts.DecoderTest#testTunneledVideoPlayback
      atest android.media.cts.DecoderTest#testTunneledVideoFlush
CTS-Coverage-Bug: 157501309

Change-Id: I5107106bb64d96ac6cc7d8704955b2f4477b94a8
2021-03-22 18:46:44 +01:00
Treehugger Robot
7ff0c7c352 Merge "Reset min_sdk_version of libmedia_jni" am: 0afaa9d9f6 am: 80ff97c8a5 am: 3d01b54d52
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1640145

Change-Id: I793ab1a84edc7f71434378f364960332761c33c9
2021-03-19 13:09:24 +00:00
Treehugger Robot
0afaa9d9f6 Merge "Reset min_sdk_version of libmedia_jni" 2021-03-19 11:41:03 +00:00
Andy Hung
daa60c22d6 SoundPool: Avoid busy waiting during stream restart
A stream on the restart queue can cause the StreamManager to
busy-wait.  This was introduced by a fix
commit ba04dbe7732bc2d016bf81c81bd349d931de63f2.

Test: Verbose log on StreamManager.cpp, run SoundPool CTS tests.
Bug: 182923919
Merged-In: Iae794bc957869426a4e1e27cd3c088aa9dd83208
Change-Id: Iae794bc957869426a4e1e27cd3c088aa9dd83208
2021-03-17 10:45:07 -07:00
Andy Hung
95a83adc9c Merge "SoundPool: Avoid busy waiting during stream restart" into sc-dev 2021-03-17 16:10:46 +00:00
Jiyong Park
147c20f115 Reset min_sdk_version of libmedia_jni
libmedia_jni is the non-updatable part of the platform. However, it has
been built with `min_sdk_version: "29"` inherited from
libcodec2-internal-defaults and then again from libcodec2-impl-defaults.
The setting is for the codec2 cc_* modules that are part of the media
APEX.

So far, this however, hasn't caused a problem because the build system
ignored min_sdk_version for the platform variants. This will change
starting from I88f64c5a35f1b5276c3350e177b116932011a940. Then
libmedia_jni will actually be built with min_sdk_verison: 29, and it
will be enforced that any APIs above the API level 29 should be guarded
with __builtin_available.

Adding the guards will not only be cumbersome, but also wouldn't give
any benefit because libmedia_jni is tied to the platform. The check will
always be true.

Instead, this change resets the min_sdk_version of libmedia_jni, so that
it can keep the existing behavior.

Bug: N/A
Test: m libmedia_jni
Change-Id: Ie963d71f60cbfe849b5400a5ecf2d52119078554
2021-03-17 14:20:54 +09:00
Chih-yu Huang
09cf0e5cea Merge "Close the handle returned by WrapNativeCodec2GrallocHandle()" into sc-dev 2021-03-17 01:16:40 +00:00
Andy Hung
43da3d54c4 SoundPool: Improve single stream SoundPool handling
By design, the StreamManager ramps down volume
on a Stream stop to prevent pops and glitches.
When the SoundPool is configured only with a single stream,
there may be a short period of unavailability of that stream
while stop is called by the worker thread; an immediate
play after a stop may return 0 (failure).

To allow immediate play after stop for a *single* Stream configured
SoundPool, we lock the StreamManager worker thread so that the
stop call is processed and the stream is visible to the client for use.

We prefer not to keep this lock for the multiple Stream case as it
prevents concurrent initiation of sounds from multiple StreamManager
worker threads and such blocking is not appropriate for games.

Test: SoundPoolAacTest SoundPoolHapticTest
Test: SoundPoolMidiTest SoundPoolOggTest
Bug: 175097719
Bug: 177287876
Merged-In: Iec777d6319d5ed76000d4c5b12336b106dacede4
Change-Id: Iec777d6319d5ed76000d4c5b12336b106dacede4
2021-03-16 21:01:05 +00:00
Andy Hung
0821db29bf SoundPool: Avoid busy waiting during stream restart
A stream on the restart queue can cause the StreamManager to
busy-wait.  This was introduced by a fix
commit ba04dbe7732bc2d016bf81c81bd349d931de63f2.

Test: Verbose log on StreamManager.cpp, run SoundPool CTS tests.
Bug: 182923919
Change-Id: Iae794bc957869426a4e1e27cd3c088aa9dd83208
2021-03-16 12:13:35 -07:00
Andy Hung
7622c2f0a1 Merge "SoundPool: Improve single stream SoundPool handling" into sc-dev 2021-03-16 18:23:34 +00:00
Pierre Couillaud
ee14d5ea42 Tuner FW: clean up Dvr/Filter message-queue resources upon close
Bug: 182546718
Signed-off-by: Pierre Couillaud <pierre@broadcom.com>
Change-Id: I89374a334e86dd934a972989c318b5222f4ce769
Merged-In: Iea28f07a0800cbab88a1348fa7ae21ac17e1cfd8
2021-03-16 15:45:45 +00:00
Henry Fang
bc30a4b182 remove fmq reference when dvr and filter are closed.
bug: 182546718
Test: manaul
Change-Id: Iea28f07a0800cbab88a1348fa7ae21ac17e1cfd8
2021-03-16 04:22:51 +00:00
Andy Hung
fe4d13843a SoundPool: Improve single stream SoundPool handling
By design, the StreamManager ramps down volume
on a Stream stop to prevent pops and glitches.
When the SoundPool is configured only with a single stream,
there may be a short period of unavailability of that stream
while stop is called by the worker thread; an immediate
play after a stop may return 0 (failure).

To allow immediate play after stop for a *single* Stream configured
SoundPool, we lock the StreamManager worker thread so that the
stop call is processed and the stream is visible to the client for use.

We prefer not to keep this lock for the multiple Stream case as it
prevents concurrent initiation of sounds from multiple StreamManager
worker threads and such blocking is not appropriate for games.

Test: SoundPoolAacTest SoundPoolHapticTest
Test: SoundPoolMidiTest SoundPoolOggTest
Bug: 175097719
Bug: 177287876
Change-Id: Iec777d6319d5ed76000d4c5b12336b106dacede4
2021-03-15 11:50:06 -07:00
Chih-Yu Huang
ef546db381 Close the handle returned by WrapNativeCodec2GrallocHandle()
At ag/13824423 we fixed the description of
WrapNativeCodec2GrallocHandle() that the returned handle should be
closed and deleted. This CL closes and deletes the handle if the
ownership of the returned handle is not transfered to
C2GraphicAllocation successfully.

Bug: 181541291
Test: android.media.cts.AdaptivePlaybackTest

Change-Id: I18464f860a93a750db653eb615ae0c92a672535e
2021-03-15 00:48:37 +00:00
Andy Hung
7ced2d7c87 Merge "SoundPool: Fix clang-tidy" am: c337968e03 am: fa59a51450 am: efb2d5bdfe
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1625766

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie8b37b13c7138734741334407125dc3f7b6c0030
2021-03-12 19:33:25 +00:00