This module contains the Anbox Android Audio HAL source code. It is part of the Anbox Android delivery for Android.
This is the first version of the module for android. It generates the library "audio.primary.goldfish.so" used to implement vendor-specific functionalities for the Android default Audio service.
The configuration file audio_policy.conf should be on the "hardware/libhardware_legacy" folder. It defines the default configuration states (input, output...) of the driver. More details can be found in audio_policy.conf. The output/Input parameter in audio_policy.conf should be set as follow:
outputs {
primary {
sampling_rates 44100
channel_masks AUDIO_CHANNEL_OUT_STEREO
formats AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_OUT_SPEAKER
flags AUDIO_OUTPUT_FLAG_PRIMARY
}
}
inputs {
primary {
sampling_rates 48000
channel_masks AUDIO_CHANNEL_IN_MONO
formats AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_IN_BUILTIN_MIC
}
}
Warning: Our audio chip only support 48kHz or 44.1kHz, in order to get high quality recording, so we choose 48kHz.If you want to change inputs sampling_rates, you must modify alsa_helper.h,it should be on the "anbox/src/anbox/audio/" folder. source codes as follow: /**
primary {
sampling_rates 48000
channel_masks AUDIO_CHANNEL_IN_MONO
formats AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_IN_BUILTIN_MIC
}
Please see the release notes for more details.
This module can not be used alone. It is part of the Anbox android delivery for Android. It provides the audio library used by the default implementation of android. And it need to connect with
local socket server which is start with anbox session-manager. which has to be added in CMakeLists.txt as follow:
include_directories(
...
/usr/include/alsa/
)
add_library(anbox-protobuf
STATIC
...
target_link_libraries(anbox-protobuf
${PROTOBUF_LITE_LIBRARIES}
/usr/lib/aarch64-linux-gnu/libasound.so
)
set(SOURCES
...
anbox/audio/alsa_helper.h
anbox/audio/alsa_helper.cpp
anbox/platform/alsa/audio_source.h
anbox/platform/alsa/audio_source.cpp
)
This directory contains the sources and the associated Android makefile to generate the audio.primary.goldfish.so library.
the graphics that explains the details of audio playback is as follows:
______________
| | pthread_mutex_lock(&out->lock)
| out_write | pthread_mutex_unlock(&out->lock)
|______________|
|
|write to queue head
|
|<---live--------->|head
_______|__________________v________________________
| |111111111111111111| | Circular Queue
|_______|___________________________________________|
|tail
|
| read from queue tail
|
|
__V________________
| | pthread_mutex_lock(&out->lock)
thread| out_write_worker | pthread_mutex_unlock(&out->lock)
|___________________| write
|
|local socket connect
|
|
__V________________
| |
|anbox socket server|
|___________________|
|
|
|
__V________________
| |
|host audio driver |
|___________________|
the graphics that explains the details of audio recording is as follows:
______________
| | pthread_mutex_lock(&in->lock)
| in_read | pthread_mutex_unlock(&in->lock)
|_____^________|
|
| read from queue tail
|
tail |<---live--------->|
_______|__________________v_________________________
| |111111111111111111| | Circular Queue
|_______|__________________^_________________________|
|head
|
|write to queue head
|
|
_______________|__
| | pthread_mutex_lock(&in->lock)
thread| in_read_worker | pthread_mutex_unlock(&in->lock)
|____^______________| read
|
|local socket connect
|
|
___________________
| |
|anbox socket server|
|____^______________|
|
|
|
_____|_____________
| |
|host audio driver |
|___________________|
This module is distributed under the Apache License, Version 2.0 found in the LICENSEfile.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。