There were three issues with the implementation
of Audio Playback Capture patches on secondary outputs.
1) Patch tracks were always forced to be ready, even if there were not
enough audio to be played. That led to playing partial buffers if the
source output had smaller (time wise) buffer than the secondary output.
This is fixed by avoiding setting CBLK_FORCEREADY on every buffer push
from the primary output thread.
2) After 1 is fixed, the patch tracks now behave like regular (non fast)
tracks. This means that the track only starts when it is full.
That leads to overrun on startup as the primary and secondary outputs
usually do not have the same write period.
What makes the issue worst is that Remote submix has a fixed buffer in bytes,
so its write period changes depending on sample rate contrary to the
primary HAL which pulls with fixed time periods (usually 20/40ms).
This patch solution is to introduce a ready threshold. The track will be
considered ready to be active if there are more than frames in its buffer.
To avoid changing previous latency behaviour except for APC,
legacy tracks have this threshold set to their buffer size and
non APC patch tracks have it set to 1, similar to setting
CBLK_FORCEREADY.
3) The patch track buffer size calculation of the patch track did not take
into account primary and secondary output could be of different sampling
rate.
This mean that the patch track buffer was usually too small as the
secondary output usually had smaller sampling rate (Live caption
requests 16kHz) than the track (music usually plays in 48kHz).
This made the two problems even worst.
This was easily fixed by scaling the buffer size with each side sample rate.
Bug: 136691300
Test: play audio
adb shell audiorecorder --target /data/file1.raw
# Check that the recorded file has no underrun
Change-Id: Ib2846b2827afd1b953d4a25acb18c7cadf57cd3e
Signed-off-by: Kevin Rocard <krocard@google.com>
As python 2 is beeing deprecated, this CL updates all the tool
scripts to python3.
It also fix some issues revealed by pylint.
Test: lunch audio_configurable target & build
Change-Id: I69a201190c688be3825cbdaa238046367a5d09c7
Signed-off-by: Francois Gaffie <francois.gaffie@renault.com>
If no default device is available from configuration.xml, and if
the engine fallbacks on it anyway, it tries to get its type without checking
the pointer validity.
This CL fix the potential segfault and assert with explicit error message.
Test: build
Change-Id: Icf8d7f5ef998dad6f4033d934b48d408030c7e17
Signed-off-by: François Gaffie <francois.gaffie@renault.com>
To avoid bypassing PATH restrictions, this CL fixes the python
binary dependancy by retrieving the path from the host binaries.
Test: build
Change-Id: Ib3356ee1a69d1a5e5a9f9d22b46e3e70c28fa991
Signed-off-by: François Gaffie <francois.gaffie@renault.com>
into libdatasource, which contains:
DataSourceFactory
(Clear)FileSource
(Clear)MediaHTTP
DataURISource
HTTPBase
NuCachedSource2
This is needed to break a circular dependency in an upcoming CL.
Test: build, boot
Change-Id: I34d9937235c78f18f51b18945342a0743e209577
Merged-In: I34d9937235c78f18f51b18945342a0743e209577
Do not consider Accessibility services when determining
lastest active capture client. As an Accessibility service
capturing does not silence other captures, it should not
prevent another client from being selected as the latest active.
Bug: 135806801
Test: Start capture with Recorder app, activate Voice Access
Change-Id: I864be785752f27201d45ce24f95013de6391dbd6
Merged-In: I864be785752f27201d45ce24f95013de6391dbd6
Call initialize() after constructing AudioPolicyManager
from factory to avoid calling virtual methods from constructor.
Bug: 136491567
Test: make
Change-Id: Ie0b591d90e643b1fd1c326f9731dc656b38230dc
Merged-In: Ie0b591d90e643b1fd1c326f9731dc656b38230dc
Add missing calls to ATRACE for direct writes and frames ready
on direct thread.
Test: <start direct output>
external/chromium-trace/systrace.py audio
Merged-In: Iee6ea72442f9902819628735e19cce0ba1546165
Change-Id: Iee6ea72442f9902819628735e19cce0ba1546165
Do not consider Assistant capturing with HOTWORD source
when determining lastest active capture client. As assistant
capturing for HOTWORD does not silence other captures, it should not
prevent another client from being selected as the latest active.
Bug: 135806801
Test: Start capture with Recorder app, place in background and trigger
false OK G detection
Change-Id: Ic17bfd70675ef749d6a678d067112b1dbd205746
Merged-In: Ic17bfd70675ef749d6a678d067112b1dbd205746
* changes:
Use PassthruPatchRecord for DIRECT to DIRECT connections
Add PassthruPatchRecord for low latency software patches
Abstract access to HAL stream via Source in RecordThread
Move PlaybackThread::Track::writeFrames to PatchRecord
audioflinger: Add tracing of buffer frames to PatchTrack/Record
libaudioprocessing: Extract vendor-available part of AudioMixer
AudioMixer: Cleanups
libaudioprocessing: Trivial dependency cleanups
When both input and output connected by a software patch
are in 'DIRECT' mode (no framework processing), use
PassthruPatchRecord as it helps to reduce the latency
significantly by avoiding intermediate buffering.
Remove 'std::nothrow' from tracks creation in PatchPanel
for consistency with other code.
Bug: 117564323
Test: with MSD module
Merged-In: I52ec5b02a207548ebc4073c1033e396f444c041c
Change-Id: I52ec5b02a207548ebc4073c1033e396f444c041c
Implement a subclass of PatchRecord that uses PatchTrack's
thread for reading from HAL. This eliminates the need for
buffering that adds latency.
The only modification needed for PatchTrack is to indicate
unlimited amount of available frames to the playback thread.
This is to prevent PatchTrack from being deactivated by
DirectOutputThread due to lack of frames available.
RecordThread believes it reads audio data on its thread,
and manages timestamps as usual. The data that it "reads"
and passes to PassthruPatchRecord is discarded by the latter.
Bug: 117564323
Test: with MSD module
Merged-In: I376656e3c791e91e2196331ecdf2b425697c4e18
Change-Id: I376656e3c791e91e2196331ecdf2b425697c4e18
This allows to replace direct reading from HAL with obtaining
audio data from another source.
It should be possible to encapsulate reading from FastCapture
in the same manner, but it's not required for direct inputs.
Test: make
Merged-In: I3f005583410cc9c5d4b07c127d95e236abb4a85f
Change-Id: I3f005583410cc9c5d4b07c127d95e236abb4a85f
This code logically belongs to PatchRecord because it emulates
obtaining recorded data from a client.
Test: make
Merged-In: Icba4e33d9d0ca57e6ad964aaf3209e7db766f284
Change-Id: Icba4e33d9d0ca57e6ad964aaf3209e7db766f284
Seeing requested / obtained buffer frame counts in trace
helps to identify discontinuities in software patch pipeline.
There is no need to trace requested frame count for PatchRecord
as it always requests as much as possible ("-1" frameCount).
Bug: 117564323
Test: with software patch active,
external/chromium-trace/systrace.py audio
Merged-In: I78400f6cc1d1940b3290fb23bb1aacfbffe042e5
Change-Id: I78400f6cc1d1940b3290fb23bb1aacfbffe042e5
Split AudioMixer into the base part which doesn't rely on
the framework and can be used in vendor code and the derived part
which is intended to be used by Audioflinger.
Test: A/B compare output from test scripts, manual testing on the phone
Merged-In: I24c390f67f20baa8109902099359ca6e34eebcfd
Change-Id: I24c390f67f20baa8109902099359ca6e34eebcfd
- Remove unused dependencies on libnbaio and libnblog;
- Move dependencies on libaudiohal and libsonic to libaudioprocessing
as AudioMixer implementation does not use them.
Test: make
Merged-In: I258a450725bdacb4fcf437b6f86582d51d40e622
Change-Id: I258a450725bdacb4fcf437b6f86582d51d40e622
During the transition to Treble, "device connect" / "disconnect"
parameter was erroneously attributed to audio streams. This
issue got fixed in Audio HAL V4.0, but AudioParameter file
was still using incorrect name for the constant.
Test: make
Change-Id: I4056ad9e98af6dadd017d22bc4bde031cac75631
Merged-In: I4056ad9e98af6dadd017d22bc4bde031cac75631
Add AUDIO_OUTPUT_FLAG_MMAP_NOIRQ flag in the relavant flags to check
for if the relavant profiles are present or not
Bug: 136493985
Test: make
authored-by: Samyak Jain <samyjain@codeaurora.org>
Change-Id: I8b8b9fdfca2bb6e5f824f3b79ac42b7de5545706
Merged-In: I8b8b9fdfca2bb6e5f824f3b79ac42b7de5545706
The error must not be ignored as otherwise the Java layer
thinks that recording has started successfully.
Bug: 136279123
Test: reproduce AudioRecordingConfigurationTest failure on cuttlefish,
check test failure output, the failure must be
"junit.framework.AssertionFailedError: expected:<3> but was:<1>"
Change-Id: I82bc3a43bf679cfb03d4246d07615d3fd4dac409
Merged-In: I82bc3a43bf679cfb03d4246d07615d3fd4dac409
The deprecated method AudioManager.isBluetoothA2dpOn() calls
getDeviceConnectionState on APM with an empty address, which
caused HwModuleCollection::getDeviceDescriptor to set an empty
address on the DeviceDescriptor for the currently connected
A2DP device. This method is called by MediaRouter.
When the address was reset, the java listener for audio device
connection monitoring was reporting the connection of an A2DP
device with an empty address, which in turn caused AvrcpManager
to behave as if the audio device connection failed.
If MediaRouter called isBluetoothA2dpOn() before AvrcpManager
received its called for device connection, the error would occur.
Bug: 132416679
Test: call isBluetoothA2dpOn() and check for valid address in dumpsys media.audio_policy
Test: atest AudioServiceHostTest#testInjectForRecord ; atest AudioHostTest ; atest AudioPlaybackCaptureTest
Change-Id: I1370edbbca46657506a990855d06a176f07c54d3
Merged-In: I1370edbbca46657506a990855d06a176f07c54d3
Android provides 2 audio policy engines:
libaudiopolicyenginedefault and
libaudiopolicyengineconfigurable. This change makes the engine
to be loaded dynamically based on the configuration (currently
the engine name is hardcoded into AudioPolicyConfig). Dynamic
loading allows building and installing of both libraries without
any conflicts.
Technical changes:
- AudioPolicyManagerInterface renamed to EngineInterface
for clarity;
- For the purpose of dynamic loading, APM does not depend
anymore on the EngineInstance class. The class got removed
from the default AP engine, but left in the configurable engine
because it is also used by its plugins;
- Added EngineLibrary class to encapsulate dynamic loading
of the AP engine. The class name EngineInstance is repurposed
for a smart pointer to EngineInterface;
- services/audiopolicy/managerdefault/Android.mk converted
into Android.bp;
- Added engine loading failure test;
Bug: 132639720
Test: sanity tests for audio; audiopolicy_tests
Change-Id: I0581569a172f810e030aec879225e817bfa7851a
Merged-In: I0581569a172f810e030aec879225e817bfa7851a
Remove the "template" configuration file and the header file.
Bug: 132435217
Test: make
Change-Id: I0b8ae921ac046e11b020d5766a60f9b341e1d6ee
Merged-In: I0b8ae921ac046e11b020d5766a60f9b341e1d6ee
The usages were only checking that the property is set
to catch attempts to update to Q while still using legacy
configurations.
Bug: 132435217
Test: build various devices
Change-Id: Ib8bda8ab7f791ac5cd3875816de46a42f0a4cbb6
Merged-In: Ib8bda8ab7f791ac5cd3875816de46a42f0a4cbb6
Make a copy of output format in NDK and camera's heic encoder.
(MediaCodec.java JNI is already making a copy, so copy out of
MediaCodec.cpp to avoid unnecessary dup)
bug:141140020
Change-Id: I8afb1e48b73f0fb2fa584bdee2b93985b48a5e91
(cherry picked from commit 860eff192e)
The cameraservice is only registered to service manager after onFirstRef
is returned. To reduce the probability of getBinderService() call
returning null, move pingCameraServiceProxy to end of onFirstRef().
Also add debug messages in onFirstRef and main() for better diagnoses.
Test: Camera CTS
Bug: 140414594
Change-Id: I52defd1c138ade57ebc5181c42aff30921fbeaeb
Apps cannot connect to hidden secure cameras. Do not include them in the
number of cameras reported by camera1 api.
Bug: 141247926
Test: Without CL -> mark all cameras as hidden secure cameras;
atest FastBasicsTest.java#testCamera1 fails
With CL -> mark all cameras as hidden secure cameras;
atest FastBasicsTest.java#testCamera1 passes
Test: camera CTS
Merged-In: I9d1721fd5e94fa7f692c3da52aa667ae9247d368
Change-Id: I229a336bed6b2695e16c1457cb8f74c26b07f7e8
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
Prevent selection of DIRECT and MMAP_NOIRQ output profiles
if these flags were not requested.
Test: atest audiopolicy_tests
Change-Id: I6940caed519b6237ea3038e646a84e4403a0c1ed
Merged-In: I6940caed519b6237ea3038e646a84e4403a0c1ed
Previously, Audio HAL implementers need all HW A/V sync profiles
declared after non HW A/V sync profiles in their audio policy
configurations, otherwise a HW A/V sync profile match could be
found for a non HW A/V sync (e.g. direct only) request, the
Audio HAL output stream would be opened with the HW A/V sync
flag, and Audio HALs typically fail to process the stream as
they are setup to parse in-band HW A/V sync headers (even if
they don't receive keyStreamHwAvSync AudioParameter).
Test: atest audiopolicy_tests
AudioPolicyManagerTVTest#MatchOutputNoHwAvSync fails w/o IOProfile change,
passes with the change.
Bug: 140447125
Merged-In: Icfc806497b5b23013e63621a585c28d1d7a9882a
Change-Id: Icfc806497b5b23013e63621a585c28d1d7a9882a
Since these were combined into libhidlbase.
Bug: 135686713
Test: build only (libhwbinder/libhidltransport are empty)
Change-Id: I6cc85a91afb603e31b85090917f9f3b59d82a4d1
Refactor the calls to other system services to an interface
to allow more testing.
Add test for callbacks to BatteryStatsService and
SchedulingPolicyService.
bug: 138381810
bug: 139440234
test: presubmit
Change-Id: I04408ad5a126e9f4083b5806b228449cb432acf6
* changes:
Switch av1 implementations from aom to gav1
stagefright: Use libgav1 for AV1 decoding
codec2: Add log message for the AV1 decoder
codec2: Implement gav1 decoder component
codec2: libgav1 integration part 1
This CL contains stuff that are pretty much copied over from the
libaom component. It makes it easier to review the series of CLs.
All the libgav1 specific functions will follow in a subsequent CL.
Test: all AV1 CTS tests still pass.
Bug: 131989882
Bug: 130249450
Merged-In: Iaafbf5379577bd42c7de64c7ec96d5b0fbb45b18
Change-Id: Iaafbf5379577bd42c7de64c7ec96d5b0fbb45b18
Bug: 134042971
Test: NTS case AUDIO-026-DDP51-TC3-NonTunnel / Tunnel verify volume starts at 0 when fading in
Change-Id: I8ee4444e3ceb2d8a0ceb979fada10c644b5db35c
- Fix ResourceManagerSerivce handling of adding same-type
resource in multiple calls, combine entries with the same
<type, subtype>. This is not required in existing usage,
bug could be required if we allow same type to be added
incrementally (eg. memory usage).
- Add api for removing some resources. Currently we can
add resources in multiple calls, but removeResource always
remove all resources of that client. We need this to toggle
battery stat On/Off based on actual usage of the codec.
- Add unit tests for the above.
bug: 138381810
test: ResourceManagerService_test; CTS ResourceManangerTest.
Change-Id: Icdba6c6b4c517755291668c52764169aac3071ea
We can't track video stats accurately if it's reported from
app side MediaCodec. If the app dies, video stats get stuck
in On state forever. This can be easily triggered by forcefully
kill and app that uses MediaCodec from app side (instead of
through mediaserver's Recorder or Player service), eg.
launch GoogleCamera app and switch to Video tab, and kill it
from adb shell.
In order to track MediaCodec usage from apps we need to move
the battery stats reporting from MediaCodec into ResourceManager.
bug: 138381810
test:
1. test if app uses MediaCodec directly and it dies off, the video
off is received: launch GoogleCamera app, swipe to Video tab,
"dumpsys batterystats --history" and see +video; now adb shell
kill GoogleCamera, dumpsys should show -video.
2. test app that uses MediaCodec through mediaserver: use Chrome
(which uses MediaPlayer) to play some website with video, kills
Chrome from adb shell, and check -video is received.
In anycase it shouldn't stuck in On state.
3. ResourceManagerService_test
Change-Id: I164b31681c4e72e8cce02342641dbec14b8df374
(cherry picked from commit 47db2ff19c)
Also remove the expected argument in addProviderLocked method as
we now can query from device manifest for instance names.
Test: manually modify Pixel3 manifest to test, CTS
Bug: 136010319
Merged-In: Ib57fd84ad8f22aac2a82920e03148cff2592daae
Change-Id: Ib57fd84ad8f22aac2a82920e03148cff2592daae
Do not consider Accessibility services when determining
lastest active capture client. As an Accessibility service
capturing does not silence other captures, it should not
prevent another client from being selected as the latest active.
Bug: 135806801
Test: Start capture with Recorder app, activate Voice Access
Change-Id: I864be785752f27201d45ce24f95013de6391dbd6
Replace the item MIME type with value supported
by the dynamic depth specification.
Bug: 138399780
Test: runtest -x
cts/tests/camera/src/android/hardware/camera2/cts/ImageReaderTest.java
-m testDynamicDepth
Change-Id: Ib51dd69e6de7da3269eccfa6b671fe95a269b4d6
This is no longer necessary because the headers are exported by the
libicuuc library which is a dependency of libxml2.
Bug: 134379140
Change-Id: I01dfe41c6584d71de47a5a76e1f7cc718083ca8c
Test: m libaudiopolicyengine_config
Exempt-From-Owner-Approval: cherry pick from qt-dev-plus-aosp.
(cherry picked from commit 2142c72cd7)
Do not consider Assistant capturing with HOTWORD source
when determining lastest active capture client. As assistant
capturing for HOTWORD does not silence other captures, it should not
prevent another client from being selected as the latest active.
Bug: 135806801
Test: Start capture with Recorder app, place in background and trigger
false OK G detection
Change-Id: Ic17bfd70675ef749d6a678d067112b1dbd205746
This change moves almost everything from libaadio.so to
separate libaaudio_internal.so library. This is done to
avoid exporting symbols which apps are not allowed to use
but have them available for platform libraries by exporting
them from libaaudio_internal.so
Bug: http://b/69603741
Test: make
Merged-In: If93118ed2c266faf2964abf21e17b0b13df493d2
Change-Id: If93118ed2c266faf2964abf21e17b0b13df493d2
This change moves almost everything from libaadio.so to
separate libaaudio_internal.so library. This is done to
avoid exporting symbols which apps are not allowed to use
but have them available for platform libraries by exporting
them from libaaudio_internal.so
Bug: http://b/69603741
Test: make
Merged-In: If93118ed2c266faf2964abf21e17b0b13df493d2
Change-Id: If93118ed2c266faf2964abf21e17b0b13df493d2
Force close mmap input streams when a capture device is
connected to force disconnect callback to client.
Bug: 137311579
Test: capture with oboetester and connect headset
Change-Id: Iafe939247fa565e2424b40afacdb79a31b8955b7
(cherry picked from commit 7bd2939d6c)
(cherry picked from commit c833ccc86b)
Force close mmap input streams when a capture device is
connected to force disconnect callback to client.
Bug: 137311579
Test: capture with oboetester and connect headset
Change-Id: Iafe939247fa565e2424b40afacdb79a31b8955b7
(cherry picked from commit 7bd2939d6c)
Force close mmap input streams when a capture device is
connected to force disconnect callback to client.
Bug: 137311579
Test: capture with oboetester and connect headset
Change-Id: Iafe939247fa565e2424b40afacdb79a31b8955b7
This is no longer necessary because the headers are exported by the
libicuuc library which is a dependency of libxml2.
Bug: 134379140
Change-Id: I01dfe41c6584d71de47a5a76e1f7cc718083ca8c
Test: m libaudiopolicyengine_config
This is to reduce application confusion when switching between back and
front cameras.
Test: Observe dumpsys on a phone with NIR camera device
Bug: 133141567
Change-Id: I0c11b99fc3a0304d54562548d109df8c56ba1db1