[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid.spec
^
|
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.83.tar.bz2/README
^
|
@@ -1,420 +0,0 @@
-PulseAudio Droid modules
-========================
-
-Building of droid modules is split to two packages
- * common (and common-devel) which contains shared library code for use in
- PulseAudio modules in this package and for inclusion in other projects
- * droid with actual PulseAudio modules
-
-Supported Android versions:
-
- * 4.1.x with Qualcomm extensions (tested with 4.1.2)
- * 4.2.x
- * 4.4.x
- * 5.x
- * 6.0.x
- * 7.x
- * 8.x
- * 9.x
-
-Headers for defining devices and strings for different droid versions are in
-src/common/droid-util-audio.h (legacy headers for Jolla 1 in droid-util-41qc.h).
-
-When new devices with relevant new enums appear, add enum check to configure.ac.
-CC_CHECK_DROID_ENUM macro will create macros HAVE_ENUM_FOO, STRING_ENTRY_IF_FOO
-and FANCY_ENTRY_IF_FOO if enum FOO exists in HAL audio.h.
-
-For example:
-
-# configure.ac:
- CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_DEVICE_OUT_IP])
- CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_DEVICE_OUT_OTHER_NEW])
-
-# and then in droid-util-audio.h add macros to proper tables:
- /* string_conversion_table_output_device[] */
- STRING_ENTRY_IF_OUT_IP
- STRING_ENTRY_IF_OUT_OTHER_NEW
-
- /* string_conversion_table_output_device_fancy[] */
- FANCY_ENTRY_IF_OUT_IP("output-ip")
- FANCY_ENTRY_IF_OUT_OTHER_NEW("output-other_new")
-
-In addition to the above macros there are also now defines
-HAVE_ENUM_AUDIO_DEVICE_OUT_IP and HAVE_ENUM_AUDIO_DEVICE_OUT_OTHER_NEW.
-
-The purpose of droid-modules is to "replace AudioFlinger". Many hardware
-adaptations use ALSA as the kernel interface, but there is no saying that
-someday vendor would create and use something proprietary or otherwise
-different from ALSA. Also the ALSA implementation in droid devices may contain
-funny ways to achieve things (notable example is voicecall) which might be
-difficult to do if interfacing directly with ALSA to replace AudioFlinger.
-Also using ALSA directly would mean that the whole HAL adaptation would need to
-be ported for each new device adaptation. With droid-modules this is much more
-simpler, with somewhat stable HAL (HALv3 as of now, also different vendors add
-their own incompatible extensions) API. In best scenarios using droid-modules
-with new device is just compiling against target.
-
-Components
-==========
-
-common
-------
-
-The common part of PulseAudio Droid modules contains library for handling
-most operations towards audio HAL.
-
-### Audio policy configuration parsing
-
-To populate our configuration structs there exists two parsers, legacy parser
-for old .conf format present in Android versions 7.0 and older and new xml
-format present from version 7.0 upwards. The legacy format is obsoleted in
-version 7.0 but by default still in use and most 7.0 adaptations probably
-contain the legacy format. But 8.0 adaptations and up start to include only
-the new style xml format configuration files.
-
-### Configuration files
-
-By default new style xml format is tried first and if it is not found old
-config is read next. If the configuration is in non-default location for
-some reason "config" module argument (available for all modules, card, sink,
-and source) can be used to point to the configuration file location.
-
-By default files are tried in following order,
-
- /odm/etc/audio_policy_configuration.xml (new xml format)
- /vendor/etc/audio/audio_policy_configuration.xml (new xml format)
- /vendor/etc/audio_policy_configuration.xml (new xml format)
- /vendor/etc/audio_policy.conf (legacy format)
- /system/etc/audio_policy_configuration.xml (new xml format)
- /system/etc/audio_policy.conf (legacy format)
-
-module-droid-card
------------------
-
-Ideally only module-droid-card is loaded and then droid-card loads
-configuration, creates profiles and loads sinks and sources based on the
-selected profile.
-
-default profile
----------------
-
-When module-droid-card is loaded with default arguments, droid-card will try
-to create a default profile (called surprisingly "default"). The default
-profile will try to merge useful output and input streams to one profile,
-to allow use of possible low latency or deep buffer outputs.
-
-For example configuration with
-
- audio_hw_modules {
- primary {
- outputs {
- primary {}
- deep_buffer {}
- }
- inputs {
- primary {}
- voice_rx {}
- }
- }
- other {
- ...
- }
- }
-
-The default profile would contain two sinks, sink.primary and sink.deep_buffer
-and one source, source.droid.
-
-Usually this default profile is everything that is needed in normal use, and
-additional profiles created should be needed only for testing things out etc.
-
-virtual profiles
-----------------
-
-In addition to aforementioned card profiles, droid-card creates some additional
-virtual profiles. These virtual profiles are used when enabling voicecall
-routings etc. When virtual profile is enabled, possible sinks and sources
-previously active profile had are not removed.
-
-As an illustration, following command line sequence enables voicecall mode and
-routes audio to internal handsfree (ihf - "handsfree speaker"):
-
-(Before starting, droid_card.primary is using profile primary-primary and
-sink.primary port output-speaker)
-
-pactl set-card-profile droid_card.primary voicecall
-pactl set-sink-port sink.primary output-parking
-pactl set-sink-port sink.primary output-speaker
-
-After this, when there is an active voicecall (created by ofono for example),
-voice audio starts to flow between modem and audio chip.
-
-To disable voicecall and return to media audio:
-
-pactl set-card-profile droid_card.primary primary-primary
-pactl set-sink-port sink.primary output-parking
-pactl set-sink-port sink.primary output-speaker
-
-With this example sequence sinks and sources are the ones from primary-primary
-card profile, and they are maintained for the whole duration of the voicecall
-and after.
-
-This sequence follows the droid HAL idea that when changing audio mode the mode
-change is done when next routing change happens. output-parking and
-input-parking ports are just convenience for PulseAudio, where setting already
-active port is a no-op (output/input-parking doesn't do any real routing
-changes).
-
-Current virtual profiles are:
- * voicecall
- * voicecall-record
- * communication
- * ringtone
-
-Communication profile is used for VoIP-like applications, to enable some
-voicecall related algorithms without being in voicecall. Ringtone profile
-should be used when ringtone is playing, to again enable possible loudness
-related optimizations etc. Voicecall-record profile can be enabled when
-voicecall profile is active.
-
-debugging profiles
-------------------
-
-If needed in favour of default profile one can opt to creating combinations
-of all output and input definitions in a module definition. This can be
-done by passing "default=false" to module-droid-card. Module argument
-module_id will then defines which module to load (by default "primary").
-Without default profile all input and output definitions are translated
-to PulseAudio card profiles. For example configuration with
-
- audio_hw_modules {
- primary {
- outputs {
- primary {}
- lpa {}
- }
- inputs {
- primary {}
- }
- }
- other {
- ...
- }
- }
-
-Would map to card profiles (<output>-<input>) primary-primary and lpa-primary.
-
-module-droid-sink and module-droid-source
------------------------------------------
-
-Normally user should not need to load droid-sink or droid-source modules by
-hand, but droid-card loads appropriate modules based on the active card
-profile.
-
-Output and input ports for droid-sink and droid-source are generated from the
-audio_policy.conf, where each device generates (usually) one port, for example:
-
- audio_hw_modules {
- primary {
- outputs {
- primary {
- devices = AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_WIRED_HEADPHONE
- }
- lpa {}
- }
- inputs {
- primary {
- devices = AUDIO_DEVICE_IN_BUILTIN_MIC
- }
- }
- }
- }
-
-Would create following ports for sink.primary:
- * output-speaker
- * output-earpiece
- * output-wired_headphone
- * output-speaker+wired_headphone
-
-And for source.primary:
- * input-builtin_mic
-
-Only exception to one device one port rule is if output device list has both
-OUT_SPEAKER and OUT_WIRED_HEADPHONE, then one additional combination port is
-generated. How the devices are called in sink and source ports are defined in
-droid-util-XXX.h
-
-Changing output routing is then as simple as
-
-pactl set-sink-port sink.primary output-wired_headphone
-
-Sink or source do not track possible headphone/other wired accessory plugging,
-but this needs to be handled elsewhere and then that other entity needs to
-control sinks and sources. (For example in SailfishOS this entity is OHM with
-accessory-plugin and pulseaudio-policy-enforcement module for actually making
-the port switching)
-
-Droid source automatic reconfiguration
---------------------------------------
-
-As droid HAL makes assumptions on (input) routing based on what the parameters
-for the stream are (device, sample rate, channels, format, etc.) normal
-PulseAudio sources are a bit inflexible as only sample rate can change after
-source creation and even then there are restrictions based on alternative
-sample rate value.
-
-To overcome this and to allow some more variables affecting the stream being
-passed to the input stream droid source is modified to reconfigure itself
-with the source-output that connects to it. This means, that just looking at
-inactive source from "pactl list" listing doesn't tell the whole story.
-
-Droid source is always reconfigured with the *last* source-output that
-connects to it, possibly already connected source-outputs will continue
-to read from the source but through resampler.
-
-For example,
-
- 1) source-output 44100Hz, stereo connects (so1)
- a) source is configured with 44100Hz, stereo
- b) so1 connects to the source without resampler
- 2) source-output 16000Hz, mono connects (so2)
- a) so1 is detached from the source
- b) source is configured with 16000Hz, mono
- c) so2 connects to the source without resampler
- d) resampler is created for so1, 16000Hz, mono -> 44100Hz stereo
- f) so1 is re-attached to the source through resampler
- 3) source-output 16000Hz, mono connects (so3)
- a) so1 and so2 are detached from the source
- b) so3 connects to the source without resampler
- c) so1 is re-attached to the source through resampler
- d) so2 is attached to the source
-
-Classifying sinks and sources
------------------------------
-
-Certain property values are set to all active sinks and sources based on their
-functionality to ease device classification.
-
-Currently following properties are set:
-
- * For droid sinks
- * droid.output.primary
- * droid.output.low_latency
- * droid.output.media_latency
- * droid.output.offload
- * For droid sources
- * droid.input.builtin
- * droid.input.external
-
-If the property is set and with value "true", the sink or source should be
-used for the property type. If the property is not defined or contains
-value "false" it shouldn't be used for the property type.
-
-For example, we might have sink.primary and sink.low_latency with following
-properties:
-
- * sink.primary
- * droid.output.primary "true"
- * droid.output.media_latency "true"
- * sink.low_latency
- * droid.output.low_latency "true"
-
-There also may be just one sink, with all the properties defined as "true"
-and so on.
-
-Right now there exists only one source (input device) which will always have
-both properties as true.
-
-Quirks
-------
-
-There are some adaptations that require hacks to get things working. These
-hacks can be enabled or disabled with module argument "quirks". Some quirks
-are enabled by default with some adaptations etc.
-
-Currently there are following quirks:
-
- * input_atoi
- * Enabled by default with Android versions 5 and up.
- * Due to how atoi works in bionic vs libc we need to pass the input
- route a bit funny. If input routing doesn't work switch this on or off.
- * set_parameters
- * Disabled by default.
- * Some adaptations need to use hw module's generic set_parameters call
- to change input routing. If input routing doesn't work switch this
- on or off. (mostly just older adaptations)
- * close_input
- * Enabled by default.
- * Close input stream when not in use instead of suspending the stream.
- Cannot be changed when multiple inputs are merged to single source.
- * unload_no_close
- * Disabled by default.
- * Don't call audio_hw_device_close() for the hw module when unloading.
- Mostly useful for tracking module unload issues.
- * no_hw_volume
- * Disabled by default.
- * Some broken implementations are incorrectly probed for supporting hw
- volume control. This is manifested by always full volume with volume
- control not affecting volume level. To fix this enable this quirk.
- * output_make_writable
- * Disabled by default.
- * Some implementations modify write buffer in-place when this should
- not be done. This can result in random segfaults when playing audio.
- As a workaround make the buffer memchunk writable before passing to
- audio HAL.
- * realcall
- * Disabled by default.
- * Some vendors apply custom realcall parameter to HAL device when
- doing voicecall routing. If there is no voicecall audio you can
- try enabling this quirk so that the realcall parameter is applied
- when switching to voicecall profile.
- * unload_call_exit
- * Disabled by default.
- * Some HAL module implementations get stuck in mutex or segfault when
- trying to unload the module. To avoid confusing segfaults call
- exit(0) instead of calling unload for the module.
- * output_fast
- * Enabled by default.
- * Create separate sink if AUDIO_OUTPUT_FLAG_FAST is found. If this sink
- is misbehaving try disabling this quirk.
- * output_deep_buffer
- * Enabled by default.
- * Create separate sink if AUDIO_OUTPUT_FLAG_DEEP_BUFFER is found. If
- this sink is misbehaving try disabling this quirk.
-
-For example, to disable input_atoi and enable close_input quirks, use module
-argument
-
- quirks=-input_atoi,+close_input
-
-Volume control during voicecall
--------------------------------
-
-When voicecall virtual profile is enabled, active droid-sink is internally
-switched to voicecall volume control mode. What this means is changing the sink
-volume or volume of normal streams connected to the sink do not change active
-voicecall volume. Special stream is needed to control the voicecall volume
-level. By default this stream is identified by stream property media.role,
-with value "phone". This can be changed by providing module arguments
-voice_property_key and voice_property_value to module-droid-card.
-
-Usually droid HAL has 6 volume levels for voicecall.
-
-Temporary sink audio routing
-----------------------------
-
-It is possible to add temporary route to sink audio routing with specific
-stream property. When stream with property key
-droid.device.additional-route connects to droid-sink, this extra route is set
-(if possible) as the enabled route for the duration of the stream.
-
-For example, if droid-sink has active port output-wired_headphone:
-
-paplay --property=droid.device.additional-route=AUDIO_DEVICE_OUT_SPEAKER a.wav
-
-As long as the new stream is connected to droid-sink, output routing is
-SPEAKER.
-
-module-droid-keepalive
-----------------------
-
-Module relocated to its own package pulseaudio-module-keepalive.
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.83.tar.bz2/src/droid/module-droid-card-symdef.h
^
|
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2013-2018 Jolla Ltd.
- *
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
- *
- * These PulseAudio Modules are free software; you can redistribute
- * it and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA.
- */
-#ifndef foomoduledroidcardsymdeffoo
-#define foomoduledroidcardsymdeffoo
-
-#include <pulsecore/core.h>
-#include <pulsecore/module.h>
-
-#define pa__init module_droid_card_LTX_pa__init
-#define pa__done module_droid_card_LTX_pa__done
-#define pa__get_author module_droid_card_LTX_pa__get_author
-#define pa__get_description module_droid_card_LTX_pa__get_description
-#define pa__get_usage module_droid_card_LTX_pa__get_usage
-#define pa__get_version module_droid_card_LTX_pa__get_version
-
-int pa__init(struct pa_module*m);
-void pa__done(struct pa_module*m);
-
-const char* pa__get_author(void);
-const char* pa__get_description(void);
-const char* pa__get_usage(void);
-const char* pa__get_version(void);
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.83.tar.bz2/src/droid/module-droid-sink-symdef.h
^
|
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2013-2018 Jolla Ltd.
- *
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
- *
- * These PulseAudio Modules are free software; you can redistribute
- * it and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA.
- */
-#ifndef foomoduledroidsinksymdeffoo
-#define foomoduledroidsinksymdeffoo
-
-#include <pulsecore/core.h>
-#include <pulsecore/module.h>
-
-#define pa__init module_droid_sink_LTX_pa__init
-#define pa__done module_droid_sink_LTX_pa__done
-#define pa__get_author module_droid_sink_LTX_pa__get_author
-#define pa__get_description module_droid_sink_LTX_pa__get_description
-#define pa__get_usage module_droid_sink_LTX_pa__get_usage
-#define pa__get_version module_droid_sink_LTX_pa__get_version
-
-int pa__init(struct pa_module*m);
-void pa__done(struct pa_module*m);
-
-const char* pa__get_author(void);
-const char* pa__get_description(void);
-const char* pa__get_usage(void);
-const char* pa__get_version(void);
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.83.tar.bz2/src/droid/module-droid-source-symdef.h
^
|
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2013-2018 Jolla Ltd.
- *
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
- *
- * These PulseAudio Modules are free software; you can redistribute
- * it and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA.
- */
-#ifndef foomoduledroidsourcesymdeffoo
-#define foomoduledroidsourcesymdeffoo
-
-#include <pulsecore/core.h>
-#include <pulsecore/module.h>
-
-#define pa__init module_droid_source_LTX_pa__init
-#define pa__done module_droid_source_LTX_pa__done
-#define pa__get_author module_droid_source_LTX_pa__get_author
-#define pa__get_description module_droid_source_LTX_pa__get_description
-#define pa__get_usage module_droid_source_LTX_pa__get_usage
-#define pa__get_version module_droid_source_LTX_pa__get_version
-
-int pa__init(struct pa_module*m);
-void pa__done(struct pa_module*m);
-
-const char* pa__get_author(void);
-const char* pa__get_description(void);
-const char* pa__get_usage(void);
-const char* pa__get_version(void);
-
-#endif
|
[-]
[+]
|
Added |
_service:tar_git:pulseaudio-modules-droid-14.2.92.tar.bz2/README.md
^
|
@@ -0,0 +1,442 @@
+PulseAudio Droid modules
+========================
+
+Building of droid modules is split to two packages
+* **common** (and **common-devel**) which contains shared library code for use in
+ PulseAudio modules in this package and for inclusion in other projects
+* **droid** with actual PulseAudio modules
+
+Supported Android versions:
+
+* 4.1.x with Qualcomm extensions (tested with 4.1.2)
+* 4.2.x
+* 4.4.x
+* 5.x
+* 6.0.x
+* 7.x
+* 8.x
+* 9.x
+* 10.x
+
+Headers for defining devices and strings for different droid versions are in
+src/common/droid-util-audio.h (legacy headers for Jolla 1 in droid-util-41qc.h).
+
+When new devices with relevant new enums appear, add enum check to configure.ac.
+CC_CHECK_DROID_ENUM macro will create macros HAVE_ENUM_FOO, STRING_ENTRY_IF_FOO
+and FANCY_ENTRY_IF_FOO if enum FOO exists in HAL audio.h.
+
+For example:
+
+ # configure.ac:
+ CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_DEVICE_OUT_IP])
+ CC_CHECK_DROID_ENUM([${DROIDHEADERS_CFLAGS}], [AUDIO_DEVICE_OUT_OTHER_NEW])
+
+ # and then in droid-util-audio.h add macros to proper tables:
+ /* string_conversion_table_output_device[] */
+ STRING_ENTRY_IF_OUT_IP
+ STRING_ENTRY_IF_OUT_OTHER_NEW
+
+ /* string_conversion_table_output_device_fancy[] */
+ FANCY_ENTRY_IF_OUT_IP("output-ip")
+ FANCY_ENTRY_IF_OUT_OTHER_NEW("output-other_new")
+
+In addition to the above macros there are also now defines
+HAVE_ENUM_AUDIO_DEVICE_OUT_IP and HAVE_ENUM_AUDIO_DEVICE_OUT_OTHER_NEW.
+
+The purpose of droid-modules is to "replace AudioFlinger". Many hardware
+adaptations use ALSA as the kernel interface, but there is no saying that
+someday vendor would create and use something proprietary or otherwise
+different from ALSA. Also the ALSA implementation in droid devices may contain
+funny ways to achieve things (notable example is voicecall) which might be
+difficult to do if interfacing directly with ALSA to replace AudioFlinger.
+Also using ALSA directly would mean that the whole HAL adaptation would need to
+be ported for each new device adaptation. With droid-modules this is much more
+simpler, with somewhat stable HAL (HALv3 as of now, also different vendors add
+their own incompatible extensions) API. In best scenarios using droid-modules
+with new device is just compiling against target.
+
+Components
+==========
+
+common
+------
+
+The common part of PulseAudio Droid modules contains library for handling
+most operations towards audio HAL.
+
+### Audio policy configuration parsing
+
+To populate our configuration structs there exists two parsers, legacy parser
+for old .conf format present in Android versions 7.0 and older and new xml
+format present from version 7.0 upwards. The legacy format is obsoleted in
+version 7.0 but by default still in use and most 7.0 adaptations probably
+contain the legacy format. But 8.0 adaptations and up start to include only
+the new style xml format configuration files.
+
+### Configuration files
+
+By default new style xml format is tried first and if it is not found old
+config is read next. If the configuration is in non-default location for
+some reason "config" module argument (available for all modules, card, sink,
+and source) can be used to point to the configuration file location.
+
+By default files are tried in following order,
+
+ /odm/etc/audio_policy_configuration.xml (new xml format)
+ /vendor/etc/audio/audio_policy_configuration.xml (new xml format)
+ /vendor/etc/audio_policy_configuration.xml (new xml format)
+ /vendor/etc/audio_policy.conf (legacy format)
+ /system/etc/audio_policy_configuration.xml (new xml format)
+ /system/etc/audio_policy.conf (legacy format)
+
+module-droid-card
+-----------------
+
+Ideally only module-droid-card is loaded and then droid-card loads
+configuration, creates profiles and loads sinks and sources based on the
+selected profile.
+
+default profile
+---------------
+
+When module-droid-card is loaded with default arguments, droid-card will try
+to create a default profile (called surprisingly "default"). The default
+profile will try to merge useful output and input streams to one profile,
+to allow use of possible low latency or deep buffer outputs.
+
+For example configuration with
+
+ audio_hw_modules {
+ primary {
+ outputs {
+ primary {}
+ deep_buffer {}
+ }
+ inputs {
+ primary {}
+ voice_rx {}
+ }
+ }
+ other {
+ ...
+ }
+ }
+
+The default profile would contain two sinks, sink.primary and sink.deep_buffer
+and one source, source.droid.
+
+Usually this default profile is everything that is needed in normal use, and
+additional profiles created should be needed only for testing things out etc.
+
+virtual profiles
+----------------
+
+In addition to aforementioned card profiles, droid-card creates some additional
+virtual profiles. These virtual profiles are used when enabling voicecall
+routings etc. When virtual profile is enabled, possible sinks and sources
+previously active profile had are not removed.
+
+As an illustration, following command line sequence enables voicecall mode and
+routes audio to internal handsfree (ihf - "handsfree speaker"):
+
+(Before starting, droid_card.primary is using profile primary-primary and
+sink.primary port output-speaker)
+
+ pactl set-card-profile droid_card.primary voicecall
+ pactl set-sink-port sink.primary output-parking
+ pactl set-sink-port sink.primary output-speaker
+
+After this, when there is an active voicecall (created by ofono for example),
+voice audio starts to flow between modem and audio chip.
+
+To disable voicecall and return to media audio:
+
+ pactl set-card-profile droid_card.primary primary-primary
+ pactl set-sink-port sink.primary output-parking
+ pactl set-sink-port sink.primary output-speaker
+
+With this example sequence sinks and sources are the ones from primary-primary
+card profile, and they are maintained for the whole duration of the voicecall
+and after.
+
+This sequence follows the droid HAL idea that when changing audio mode the mode
+change is done when next routing change happens. output-parking and
+input-parking ports are just convenience for PulseAudio, where setting already
+active port is a no-op (output/input-parking doesn't do any real routing
+changes).
+
+Current virtual profiles are:
+* voicecall
+* voicecall-record
+* communication
+* ringtone
+
+Communication profile is used for VoIP-like applications, to enable some
+voicecall related algorithms without being in voicecall. Ringtone profile
+should be used when ringtone is playing, to again enable possible loudness
+related optimizations etc. Voicecall-record profile can be enabled when
+voicecall profile is active.
+
+debugging profiles
+------------------
+
+If needed in favour of default profile one can opt to creating combinations
+of all output and input definitions in a module definition. This can be
+done by passing "default=false" to module-droid-card. Module argument
+module_id will then defines which module to load (by default "primary").
+Without default profile all input and output definitions are translated
+to PulseAudio card profiles. For example configuration with
+
+ audio_hw_modules {
+ primary {
+ outputs {
+ primary {}
+ lpa {}
+ }
+ inputs {
+ primary {}
+ }
+ }
+ other {
+ ...
+ }
+ }
+
+Would map to card profiles ([output]-[input]) primary-primary and lpa-primary.
+
+module-droid-sink and module-droid-source
+-----------------------------------------
+
+Normally user should not need to load droid-sink or droid-source modules by
+hand, but droid-card loads appropriate modules based on the active card
+profile.
+
+Output and input ports for droid-sink and droid-source are generated from the
+audio_policy_configuration.xml (where available) or audio_policy.conf (legacy),
+where each device generates (usually) one port, for example:
+
+ audio_hw_modules {
+ primary {
+ outputs {
+ primary {
+ devices = AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_WIRED_HEADPHONE
+ }
+ lpa {}
+ }
+ inputs {
+ primary {
+ devices = AUDIO_DEVICE_IN_BUILTIN_MIC
+ }
+ }
+ }
+ }
+
+Would create following ports for sink.primary:
+ * output-speaker
+ * output-earpiece
+ * output-wired_headphone
+ * output-speaker+wired_headphone
+
+And for source.primary:
+ * input-builtin_mic
+
+Only exception to one device one port rule is if output device list has both
+OUT_SPEAKER and OUT_WIRED_HEADPHONE, then one additional combination port is
+generated. How the devices are called in sink and source ports are defined in
+droid-util-XXX.h
+
+Changing output routing is then as simple as
+
+ pactl set-sink-port sink.primary output-wired_headphone
+
+Sink or source do not track possible headphone/other wired accessory plugging,
+but this needs to be handled elsewhere and then that other entity needs to
+control sinks and sources. (For example in SailfishOS this entity is OHM with
+accessory-plugin and pulseaudio-policy-enforcement module for actually making
+the port switching)
+
+Droid source automatic reconfiguration
+--------------------------------------
+
+As droid HAL makes assumptions on (input) routing based on what the parameters
+for the stream are (device, sample rate, channels, format, etc.) normal
+PulseAudio sources are a bit inflexible as only sample rate can change after
+source creation and even then there are restrictions based on alternative
+sample rate value.
+
+To overcome this and to allow some more variables affecting the stream being
+passed to the input stream droid source is modified to reconfigure itself
+with the source-output that connects to it. This means, that just looking at
+inactive source from "pactl list" listing doesn't tell the whole story.
+
+Droid source is always reconfigured with the *last* source-output that
+connects to it, possibly already connected source-outputs will continue
+to read from the source but through resampler.
+
+For example,
+
+1) source-output 44100Hz, stereo connects (so1)
+ 1) source is configured with 44100Hz, stereo
+ 2) so1 connects to the source without resampler
+2) source-output 16000Hz, mono connects (so2)
+ 1) so1 is detached from the source
+ 2) source is configured with 16000Hz, mono
+ 3) so2 connects to the source without resampler
+ 4) resampler is created for so1, 16000Hz, mono -> 44100Hz stereo
+ 5) so1 is re-attached to the source through resampler
+3) source-output 16000Hz, mono connects (so3)
+ 1) so1 and so2 are detached from the source
+ 2) so3 connects to the source without resampler
+ 3) so1 is re-attached to the source through resampler
+ 4) so2 is attached to the source
+
+Classifying sinks and sources
+-----------------------------
+
+Certain property values are set to all active sinks and sources based on their
+functionality to ease device classification.
+
+Currently following properties are set:
+
+* For droid sinks
+ * droid.output.primary
+ * droid.output.low_latency
+ * droid.output.media_latency
+ * droid.output.offload
+* For droid sources
+ * droid.input.builtin
+ * droid.input.external
+
+If the property is set and with value "true", the sink or source should be
+used for the property type. If the property is not defined or contains
+value "false" it shouldn't be used for the property type.
+
+For example, we might have sink.primary and sink.low_latency with following
+properties:
+
+* sink.primary
+ * droid.output.primary "true"
+ * droid.output.media_latency "true"
+* sink.low_latency
+ * droid.output.low_latency "true"
+
+There also may be just one sink, with all the properties defined as "true"
+and so on.
+
+Right now there exists only one source (input device) which will always have
+both properties as true.
+
+Quirks
+------
+
+There are some adaptations that require hacks to get things working. These
+hacks can be enabled or disabled with module argument "quirks". Some quirks
+are enabled by default with some adaptations etc.
+
+Currently there are following quirks:
+
+* input_atoi
+ * Enabled by default with Android versions 5 and up.
+ * Due to how atoi works in bionic vs libc we need to pass the input
+ route a bit funny. If input routing doesn't work switch this on or off.
+* set_parameters
+ * Disabled by default.
+ * Some adaptations need to use hw module's generic set_parameters call
+ to change input routing. If input routing doesn't work switch this
+ on or off. (mostly just older adaptations)
+* close_input
+ * Enabled by default.
+ * Close input stream when not in use instead of suspending the stream.
+ Cannot be changed when multiple inputs are merged to single source.
+* unload_no_close
+ * Disabled by default.
+ * Don't call audio_hw_device_close() for the hw module when unloading.
+ Mostly useful for tracking module unload issues.
+* no_hw_volume
+ * Disabled by default.
+ * Some broken implementations are incorrectly probed for supporting hw
+ volume control. This is manifested by always full volume with volume
+ control not affecting volume level. To fix this enable this quirk.
+* output_make_writable
+ * Disabled by default.
+ * Some implementations modify write buffer in-place when this should
+ not be done. This can result in random segfaults when playing audio.
+ As a workaround make the buffer memchunk writable before passing to
+ audio HAL.
+* realcall
+ * Disabled by default.
+ * Some vendors apply custom realcall parameter to HAL device when
+ doing voicecall routing. If there is no voicecall audio you can
+ try enabling this quirk so that the realcall parameter is applied
+ when switching to voicecall profile.
+* unload_call_exit
+ * Disabled by default.
+ * Some HAL module implementations get stuck in mutex or segfault when
+ trying to unload the module. To avoid confusing segfaults call
+ exit(0) instead of calling unload for the module.
+* output_fast
+ * Enabled by default.
+ * Create separate sink if AUDIO_OUTPUT_FLAG_FAST is found. If this sink
+ is misbehaving try disabling this quirk.
+* output_deep_buffer
+ * Enabled by default.
+ * Create separate sink if AUDIO_OUTPUT_FLAG_DEEP_BUFFER is found. If
+ this sink is misbehaving try disabling this quirk.
+* audio_cal_wait
+ * Disabled by default.
+ * Certain devices do audio calibration during hw module open and
+ writing audio too early will break the calibration. In these cases
+ this quirk can be enabled and 10 seconds of sleep is added after
+ opening hw module.
+* standby_set_route
+ * Disabled by default.
+ * Some devices don't like to receive set_parameters() call while they
+ are in write(), even if it seems the mutexes are correctly in place.
+ Standby is another synchronization point which seems to work better.
+ If there are hiccups like long delays when setting route during
+ voice call start try enabling this quirk.
+* speaker_before_voice
+ * Disabled by default.
+ * Set route to speaker before changing audio mode to AUDIO_MODE_IN_CALL.
+ Some devices don't get routing right if the route is something else
+ (like AUDIO_DEVICE_OUT_WIRED_HEADSET) before calling set_mode().
+ If routing is wrong when call starts with wired accessory connected
+ try enabling this quirk.
+
+For example, to disable input_atoi and enable close_input quirks, use module
+argument
+
+ quirks=-input_atoi,+close_input
+
+Volume control during voicecall
+-------------------------------
+
+When voicecall virtual profile is enabled, active droid-sink is internally
+switched to voicecall volume control mode. What this means is changing the sink
+volume or volume of normal streams connected to the sink do not change active
+voicecall volume. Special stream is needed to control the voicecall volume
+level. By default this stream is identified by stream property media.role,
+with value "phone". This can be changed by providing module arguments
+voice_property_key and voice_property_value to module-droid-card.
+
+Usually droid HAL has 6 volume levels for voicecall.
+
+Temporary sink audio routing
+----------------------------
+
+It is possible to add temporary route to sink audio routing with specific
+stream property. When stream with property key
+droid.device.additional-route connects to droid-sink, this extra route is set
+(if possible) as the enabled route for the duration of the stream.
+
+For example, if droid-sink has active port output-wired_headphone:
+
+ paplay --property=droid.device.additional-route=AUDIO_DEVICE_OUT_SPEAKER a.wav
+
+As long as the new stream is connected to droid-sink, output routing is
+SPEAKER.
+
+module-droid-keepalive
+----------------------
+
+Module relocated to its own package pulseaudio-module-keepalive.
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.92.tar.bz2/src/common/config-parser-xml.c
^
|
@@ -42,6 +42,7 @@
#include <pulse/xmalloc.h>
#include <pulsecore/core-util.h>
#include <pulsecore/core-error.h>
+#include <pulsecore/strbuf.h>
#include "droid/conversion.h"
#include "droid/sllist.h"
@@ -70,6 +71,7 @@
/* ELEMENT_profile */
#define ELEMENT_routes "routes"
#define ELEMENT_route "route"
+#define ELEMENT_include "xi:include"
#define ATTRIBUTE_version "version"
#define ATTRIBUTE_name "name"
@@ -83,6 +85,7 @@
#define ATTRIBUTE_sink "sink"
#define ATTRIBUTE_sources "sources"
#define ATTRIBUTE_type "type"
+#define ATTRIBUTE_href "href"
#define PORT_TYPE_sink "sink"
#define PORT_TYPE_source "source"
@@ -133,6 +136,7 @@
static void parse_item(struct parser_data *data, const char *str);
static bool parse_module(struct parser_data *data, const char *element_name, const XML_Char **attributes);
static bool parse_global_configuration(struct parser_data *data, const char *element_name, const XML_Char **attributes);
+static bool parse_module_include(struct parser_data *data, const char *element_name, const XML_Char **attributes);
static const struct element_parser element_parse_route = {
ELEMENT_route,
@@ -214,12 +218,20 @@
&element_parse_item
};
+static const struct element_parser element_parse_module_include = {
+ ELEMENT_include,
+ parse_module_include,
+ NULL,
+ &element_parse_attached_devices,
+ NULL
+};
+
static const struct element_parser element_parse_module = {
ELEMENT_module,
parse_module,
NULL,
NULL,
- &element_parse_attached_devices
+ &element_parse_module_include
};
static const struct element_parser element_parse_modules = {
@@ -309,9 +321,17 @@
struct module *next;
};
+struct includes {
+ char *href;
+ struct module *module;
+
+ struct includes *next;
+};
+
struct audio_policy_configuration {
struct global_configuration *global;
struct module *modules;
+ struct includes *includes;
};
struct parser_data {
@@ -319,7 +339,6 @@
const char *fn;
unsigned lineno;
- const struct element_parser *root;
const struct element_parser *current;
struct element_parser_stack *stack;
@@ -327,6 +346,7 @@
struct module *current_module;
struct mix_port *current_mix_port;
struct device_port *current_device_port;
+ struct includes *current_include;
};
@@ -412,9 +432,15 @@
pa_xfree(m);
}
+static void includes_free(struct includes *i) {
+ pa_assert(i);
+
+ pa_xfree(i->href);
+ pa_xfree(i);
+}
+
static void audio_policy_configuration_free(struct audio_policy_configuration *xml_config) {
struct global_configuration *global;
- struct module *m;
pa_assert(xml_config);
@@ -426,9 +452,16 @@
}
while (xml_config->modules) {
+ struct module *m;
SLLIST_STEAL_FIRST(m, xml_config->modules);
module_free(m);
- };
+ }
+
+ while (xml_config->includes) {
+ struct includes *i;
+ SLLIST_STEAL_FIRST(i, xml_config->includes);
+ includes_free(i);
+ }
pa_xfree(xml_config);
}
@@ -572,10 +605,37 @@
return true;
}
+static bool parse_module_include(struct parser_data *data, const char *element_name, const XML_Char **attributes) {
+ struct includes *i;
+ char *href = NULL;
+
+ if (!get_element_attr(data, attributes, true, ATTRIBUTE_href, &href)) {
+ pa_log("[%s:%u] Include but no href.", data->fn, data->lineno);
+ return false;
+ }
+
+ /* We ignore xpointer attribute for now and just use the module element
+ * we are currently in when parsing the included file. */
+
+ i = pa_xmalloc0(sizeof(*i));
+ i->module = data->current_module;
+ i->href = href;
+
+ SLLIST_APPEND(struct includes, data->conf->includes, i);
+
+ return true;
+}
+
static bool parse_module(struct parser_data *data, const char *element_name, const XML_Char **attributes) {
struct module *m;
char *halVersion = NULL;
+ if (data->current_include && data->current_include->module) {
+ /* We are processing included file, get our module definition from cache. */
+ data->current_module = data->current_include->module;
+ return true;
+ }
+
m = pa_xmalloc0(sizeof(*m));
get_element_attr(data, attributes, false, ATTRIBUTE_name, &m->name);
@@ -834,7 +894,7 @@
return parsed;
}
-static bool parse_file(struct parser_data *data, const char *filename) {
+static bool parse_file(struct parser_data *data, const struct element_parser *root, const char *filename) {
char buf[BUFSIZ];
FILE *f = NULL;
XML_Parser parser = NULL;
@@ -858,6 +918,8 @@
if (!data->conf)
data->conf = pa_xnew0(struct audio_policy_configuration, 1);
+ data->current = root;
+
XML_SetUserData(parser, data);
XML_SetElementHandler(parser, xml_start_element, xml_end_element);
XML_SetCharacterDataHandler(parser, xml_character_data_handler);
@@ -1020,6 +1082,31 @@
return config;
}
+/* Take base filename and relative path to filename and construct new
+ * path replacing file part from the base filename with new filename.
+ * For example, base_file="x/y/file.xml", filename="a/other.xml"
+ * result "x/y/a/other.xml"
+ */
+static char *build_path(const char *base_file, const char *filename) {
+ char *fn = NULL;
+ pa_strbuf *buf;
+ char *end;
+ int len;
+
+ pa_assert(base_file);
+ pa_assert(filename);
+
+ if ((end = strrchr(base_file, '/'))) {
+ buf = pa_strbuf_new();
+ len = end - base_file + 1;
+ pa_strbuf_putsn(buf, base_file, len);
+ pa_strbuf_puts(buf, filename);
+ fn = pa_strbuf_to_string_free(buf);
+ }
+
+ return fn;
+}
+
pa_droid_config_audio *pa_parse_droid_audio_config_xml(const char *filename) {
pa_droid_config_audio *config = NULL;
struct parser_data data;
@@ -1029,12 +1116,30 @@
memset(&data, 0, sizeof(data));
- data.root = &element_parse_root;
- data.current = data.root;
-
- if (!(ret = parse_file(&data, filename)))
+ if (!(ret = parse_file(&data, &element_parse_root, filename)))
goto done;
+ if (data.conf->includes) {
+ /* Only handle module includes for now. */
+ SLLIST_FOREACH(data.current_include, data.conf->includes) {
+ char *fn = NULL;
+
+ if (!data.current_include->module)
+ continue;
+
+ if (data.current_include->href[0] != '/')
+ fn = build_path(filename, data.current_include->href);
+
+ ret = parse_file(&data, &element_parse_modules, fn ? fn : data.current_include->href);
+
+ pa_assert(!data.current_module);
+ pa_xfree(fn);
+
+ if (!ret)
+ goto done;
+ }
+ }
+
config = convert_config(data.conf);
done:
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.92.tar.bz2/src/common/droid-util.c
^
|
@@ -27,6 +27,10 @@
#include <signal.h>
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <grp.h>
#ifdef HAVE_VALGRIND_MEMCHECK_H
#include <valgrind/memcheck.h>
@@ -37,6 +41,7 @@
#include <pulse/volume.h>
#include <pulse/xmalloc.h>
#include <pulse/direction.h>
+#include <pulse/util.h>
#include <pulsecore/core.h>
#include <pulsecore/core-error.h>
@@ -82,19 +87,35 @@
{ "unload_call_exit", QUIRK_UNLOAD_CALL_EXIT },
{ "output_fast", QUIRK_OUTPUT_FAST },
{ "output_deep_buffer", QUIRK_OUTPUT_DEEP_BUFFER },
+ { "audio_cal_wait", QUIRK_AUDIO_CAL_WAIT },
+ { "standby_set_route", QUIRK_STANDBY_SET_ROUTE },
+ { "speaker_before_voice", QUIRK_SPEAKER_BEFORE_VOICE },
};
+#define QUIRK_AUDIO_CAL_WAIT_S (10)
+#define QUIRK_AUDIO_CAL_FILE "/data/vendor/audio/cirrus_sony.cal"
+#define QUIRK_AUDIO_CAL_GROUP "audio"
+#define QUIRK_AUDIO_CAL_MODE (0664)
#define DEFAULT_PRIORITY (100)
#define DEFAULT_AUDIO_FORMAT (AUDIO_FORMAT_PCM_16_BIT)
-static const char * const droid_combined_auto_outputs[3] = { "primary", "low_latency", NULL };
-static const char * const droid_combined_auto_inputs[2] = { "primary", NULL };
+#ifndef AUDIO_PARAMETER_VALUE_ON
+#define AUDIO_PARAMETER_VALUE_ON "on"
+#endif
+
+#ifndef AUDIO_PARAMETER_VALUE_OFF
+#define AUDIO_PARAMETER_VALUE_OFF "off"
+#endif
+
+#define AUDIO_PARAMETER_BT_SCO_ON "BT_SCO=" AUDIO_PARAMETER_VALUE_ON
+#define AUDIO_PARAMETER_BT_SCO_OFF "BT_SCO=" AUDIO_PARAMETER_VALUE_OFF
static void droid_port_free(pa_droid_port *p);
static int input_stream_set_route(pa_droid_hw_module *hw_module, pa_droid_stream *s);
+static int droid_set_parameters(pa_droid_hw_module *hw, const char *parameters);
static pa_droid_profile *profile_new(pa_droid_profile_set *ps,
const pa_droid_config_hw_module *module,
@@ -688,30 +709,20 @@
pa_assert(hw);
- if (hw->quirks) {
- for (i = 0; i < sizeof(valid_quirks) / sizeof(struct droid_quirk); i++) {
- if (hw->quirks->enabled[i]) {
- pa_log_debug("Enabled quirks:");
- for (i = 0; i < sizeof(valid_quirks) / sizeof(struct droid_quirk); i++)
- if (hw->quirks->enabled[i])
- pa_log_debug(" %s", valid_quirks[i].name);
- return;
- }
+ for (i = 0; i < sizeof(valid_quirks) / sizeof(struct droid_quirk); i++) {
+ if (hw->quirks.enabled[i]) {
+ pa_log_debug("Enabled quirks:");
+ for (i = 0; i < sizeof(valid_quirks) / sizeof(struct droid_quirk); i++)
+ if (hw->quirks.enabled[i])
+ pa_log_debug(" %s", valid_quirks[i].name);
+ return;
}
}
}
-static pa_droid_quirks *get_quirks(pa_droid_quirks *q) {
- if (!q)
- q = pa_xnew0(pa_droid_quirks, 1);
-
- return q;
-}
-
static pa_droid_quirks *set_default_quirks(pa_droid_quirks *q) {
- q = NULL;
+ pa_assert(q);
- q = get_quirks(q);
q->enabled[QUIRK_CLOSE_INPUT] = true;
q->enabled[QUIRK_OUTPUT_FAST] = true;
q->enabled[QUIRK_OUTPUT_DEEP_BUFFER] = true;
@@ -732,19 +743,23 @@
return q;
}
-bool pa_droid_quirk_parse(pa_droid_hw_module *hw, const char *quirks) {
+bool pa_droid_quirk_parse(pa_droid_quirks *quirks, const char *quirks_def) {
char *quirk = NULL;
char *d;
const char *state = NULL;
- pa_assert(hw);
pa_assert(quirks);
- hw->quirks = get_quirks(hw->quirks);
+ memset(quirks, 0, sizeof(*quirks));
+ set_default_quirks(quirks);
- while ((quirk = pa_split(quirks, ",", &state))) {
+ if (!quirks_def)
+ return true;
+
+ while ((quirk = pa_split(quirks_def, ",", &state))) {
uint32_t i;
bool enable = false;
+ bool found = false;
if (strlen(quirk) < 2)
goto error;
@@ -759,17 +774,22 @@
goto error;
for (i = 0; i < sizeof(valid_quirks) / sizeof(struct droid_quirk); i++) {
- if (pa_streq(valid_quirks[i].name, d))
- hw->quirks->enabled[valid_quirks[i].value] = enable;
+ if (pa_streq(valid_quirks[i].name, d)) {
+ quirks->enabled[valid_quirks[i].value] = enable;
+ found = true;
+ }
}
+ if (!found)
+ goto error;
+
pa_xfree(quirk);
}
return true;
error:
- pa_log("Incorrect quirk definition \"%s\" (\"%s\")", quirk ? quirk : "<null>", quirks);
+ pa_log("Incorrect quirk definition \"%s\" (\"%s\")", quirk ? quirk : "<null>", quirks_def);
pa_xfree(quirk);
return false;
@@ -862,7 +882,68 @@
return pa_sprintf_malloc("droid-hardware-module-%s", module_id);
}
-static pa_droid_hw_module *droid_hw_module_open(pa_core *core, const pa_droid_config_audio *config, const char *module_id) {
+static void quirk_audio_cal(pa_droid_hw_module *hw, uint32_t flags) {
+ struct group *grp;
+
+ pa_assert(hw);
+
+ if (!pa_droid_quirk(hw, QUIRK_AUDIO_CAL_WAIT))
+ return;
+
+ if (access(QUIRK_AUDIO_CAL_FILE, F_OK) == 0) {
+ if (flags & AUDIO_OUTPUT_FLAG_PRIMARY) {
+ pa_log_info("Waiting for audio calibration to load.");
+ /* 1 second is enough, so let's double that. */
+ pa_msleep(2 * PA_MSEC_PER_SEC);
+ }
+ return;
+ }
+
+ pa_log_info("Waiting for audio calibration to finish... (%d seconds)", QUIRK_AUDIO_CAL_WAIT_S);
+
+ /* First wait until the calibration file appears on file system. */
+ for (int i = 0; i < QUIRK_AUDIO_CAL_WAIT_S; i++) {
+ pa_log_debug("%d...", QUIRK_AUDIO_CAL_WAIT_S - i);
+ pa_msleep(PA_MSEC_PER_SEC);
+ if (access(QUIRK_AUDIO_CAL_FILE, F_OK) == 0) {
+ pa_log_debug("Calibration file " QUIRK_AUDIO_CAL_FILE " appeared, wait one second more.");
+ /* Then wait for a bit more. */
+ pa_msleep(PA_MSEC_PER_SEC);
+ break;
+ }
+ }
+
+ if (access(QUIRK_AUDIO_CAL_FILE, F_OK) != 0)
+ goto fail;
+
+ if (!(grp = getgrnam(QUIRK_AUDIO_CAL_GROUP))) {
+ pa_log("couldn't get gid for " QUIRK_AUDIO_CAL_GROUP);
+ goto fail;
+ }
+
+ if (chown(QUIRK_AUDIO_CAL_FILE, getuid(), grp->gr_gid) < 0) {
+ pa_log("chown failed for " QUIRK_AUDIO_CAL_FILE);
+ goto fail;
+ }
+
+ if (chmod(QUIRK_AUDIO_CAL_FILE, QUIRK_AUDIO_CAL_MODE) < 0) {
+ pa_log("chmod failed for " QUIRK_AUDIO_CAL_FILE);
+ goto fail;
+ }
+
+ pa_log_info("Done waiting for audio calibration.");
+
+ return;
+
+fail:
+ if (access(QUIRK_AUDIO_CAL_FILE, F_OK) == 0)
+ unlink(QUIRK_AUDIO_CAL_FILE);
+
+ pa_log("Audio calibration file generation failed! (" QUIRK_AUDIO_CAL_FILE " doesn't exist)");
+}
+
+static pa_droid_hw_module *droid_hw_module_open(pa_core *core, const pa_droid_config_audio *config,
+ const char *module_id, const pa_droid_quirks *quirks) {
const pa_droid_config_hw_module *module;
pa_droid_hw_module *hw = NULL;
struct hw_module_t *hwmod = NULL;
@@ -923,7 +1004,10 @@
hw->shared_name = shared_name_get(hw->module_id);
hw->outputs = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
hw->inputs = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
- hw->quirks = set_default_quirks(hw->quirks);
+ if (quirks)
+ memcpy(&hw->quirks, quirks, sizeof(*quirks));
+ else
+ set_default_quirks(&hw->quirks);
hw->sink_put_hook_slot = pa_hook_connect(&core->hooks[PA_CORE_HOOK_SINK_PUT], PA_HOOK_EARLY-10,
sink_put_hook_cb, hw);
@@ -944,20 +1028,59 @@
return NULL;
}
-pa_droid_hw_module *pa_droid_hw_module_get(pa_core *core, const pa_droid_config_audio *config, const char *module_id) {
- pa_droid_hw_module *hw;
+static pa_droid_hw_module *droid_hw_module_shared_get(pa_core *core, const char *module_id) {
+ pa_droid_hw_module *hw = NULL;
char *shared_name;
pa_assert(core);
pa_assert(module_id);
shared_name = shared_name_get(module_id);
+
if ((hw = pa_shared_get(core, shared_name)))
hw = pa_droid_hw_module_ref(hw);
- else
- hw = droid_hw_module_open(core, config, module_id);
pa_xfree(shared_name);
+
+ return hw;
+}
+
+pa_droid_hw_module *pa_droid_hw_module_get2(pa_core *core, pa_modargs *ma, const char *module_id) {
+ pa_droid_hw_module *hw = NULL;
+ pa_droid_config_audio *config = NULL;
+ pa_droid_quirks quirks;
+
+ pa_assert(core);
+ pa_assert(ma);
+ pa_assert(module_id);
+
+ /* First let's find out if hw module has already been opened. */
+
+ if ((hw = droid_hw_module_shared_get(core, module_id)))
+ return hw;
+
+ /* No hw module object in shared object db, let's parse quirks and config and
+ * open the module now. */
+
+ if (!pa_droid_quirk_parse(&quirks, pa_modargs_get_value(ma, "quirks", NULL)))
+ return NULL;
+
+ if (!(config = pa_droid_config_load(ma)))
+ return NULL;
+
+ hw = droid_hw_module_open(core, config, module_id, &quirks);
+
+ pa_droid_config_free(config);
+
+ return hw;
+}
+
+pa_droid_hw_module *pa_droid_hw_module_get(pa_core *core, const pa_droid_config_audio *config, const char *module_id) {
+ pa_droid_hw_module *hw;
+
+ if (!(hw = droid_hw_module_shared_get(core, module_id)))
+ hw = droid_hw_module_open(core, config, module_id, NULL);
+
return hw;
}
@@ -1011,8 +1134,6 @@
pa_idxset_free(hw->inputs, NULL);
}
- pa_xfree(hw->quirks);
-
pa_xfree(hw);
}
@@ -1270,6 +1391,8 @@
goto fail;
}
+ pa_log_info("Open output stream %s", module_output_name);
+
if (!stream_config_fill(module_output, devices, &sample_spec, &channel_map, &config_out))
goto fail;
@@ -1301,6 +1424,8 @@
goto fail;
}
+ quirk_audio_cal(module, module_output->flags);
+
s = droid_stream_new(module, module_output);
s->output = output = droid_output_stream_new();
output->stream = stream;
@@ -1316,7 +1441,7 @@
s->buffer_size = output->stream->common.get_buffer_size(&output->stream->common);
- pa_log_info("Opened droid output stream %p with device: %u flags: %u sample rate: %u channels: %u (%u) format: %u (%u) buffer size: %u (%llu usec)",
+ pa_log_info("Opened droid output stream %p with device: %u flags: %u sample rate: %u channels: %u (%u) format: %u (%u) buffer size: %zu (%" PRIu64 " usec)",
(void *) s,
devices,
output->flags,
@@ -1750,11 +1875,30 @@
pa_mutex_lock(s->module->output_mutex);
if (output->flags & AUDIO_OUTPUT_FLAG_PRIMARY || pa_droid_hw_primary_output_stream(s->module) == NULL) {
+ int set_bt_sco = -1;
+
parameters = pa_sprintf_malloc("%s=%u;", AUDIO_PARAMETER_STREAM_ROUTING, device);
+ /* Set BT_SCO parameter for Bluetooth voice/voip call routes. */
+ if (device != output->device &&
+ (device | output->device) & (AUDIO_DEVICE_OUT_BLUETOOTH_SCO |
+ AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET |
+ AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT)) {
+
+ set_bt_sco = (device & (AUDIO_DEVICE_OUT_BLUETOOTH_SCO |
+ AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET |
+ AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT)) ? 1 : 0;
+ }
+
+ if (set_bt_sco == 1)
+ droid_set_parameters(s->module, AUDIO_PARAMETER_BT_SCO_ON);
+
pa_log_debug("output stream %p set_parameters(%s) %#010x", (void *) s, parameters, device);
ret = output->stream->common.set_parameters(&output->stream->common, parameters);
+ if (set_bt_sco == 0)
+ droid_set_parameters(s->module, AUDIO_PARAMETER_BT_SCO_OFF);
+
if (ret < 0) {
if (ret == -ENOSYS)
pa_log_warn("output set_parameters(%s) not allowed while stream is active", parameters);
@@ -1773,6 +1917,13 @@
if (slave == s)
continue;
+ if (pa_droid_quirk(s->module, QUIRK_STANDBY_SET_ROUTE)) {
+ /* Some devices don't like to receive set_parameters() call while they
+ * are in write(), even if it seems the mutexes are correctly in place.
+ * Standby is another synchronization point which seems to work better. */
+ slave->output->stream->common.standby(&slave->output->stream->common);
+ }
+
pa_log_debug("slave output stream %p set_parameters(%s)", (void *) slave, parameters);
ret = slave->output->stream->common.set_parameters(&slave->output->stream->common, parameters);
@@ -1891,16 +2042,14 @@
return ret;
}
-int pa_droid_set_parameters(pa_droid_hw_module *hw, const char *parameters) {
+static int droid_set_parameters(pa_droid_hw_module *hw, const char *parameters) {
int ret;
pa_assert(hw);
pa_assert(parameters);
pa_log_debug("hw %p set_parameters(%s)", (void *) hw, parameters);
- pa_mutex_lock(hw->hw_mutex);
ret = hw->device->set_parameters(hw->device, parameters);
- pa_mutex_unlock(hw->hw_mutex);
if (ret < 0)
pa_log("hw module %p set_parameters(%s) failed: %d", (void *) hw, parameters, ret);
@@ -1908,6 +2057,19 @@
return ret;
}
+int pa_droid_set_parameters(pa_droid_hw_module *hw, const char *parameters) {
+ int ret;
+
+ pa_assert(hw);
+ pa_assert(parameters);
+
+ pa_mutex_lock(hw->hw_mutex);
+ ret = droid_set_parameters(hw, parameters);
+ pa_mutex_unlock(hw->hw_mutex);
+
+ return ret;
+}
+
bool pa_droid_stream_is_primary(pa_droid_stream *s) {
pa_assert(s);
pa_assert(s->output || s->input);
@@ -2059,11 +2221,32 @@
pa_log_info("Set mode to %s.", audio_mode_to_string(mode));
+ if (pa_droid_quirk(hw_module, QUIRK_SPEAKER_BEFORE_VOICE) &&
+ hw_module->state.mode != mode && mode == AUDIO_MODE_IN_CALL) {
+ pa_droid_stream *primary_output;
+
+ /* Set route to speaker before changing audio mode to AUDIO_MODE_IN_CALL.
+ * Some devices don't get routing right if the route is something else
+ * (like AUDIO_DEVICE_OUT_WIRED_HEADSET) before calling set_mode().*/
+ if ((primary_output = pa_droid_hw_primary_output_stream(hw_module)))
+ pa_droid_stream_set_route(primary_output, AUDIO_DEVICE_OUT_SPEAKER);
+ }
+
pa_droid_hw_module_lock(hw_module);
if (hw_module->device->set_mode(hw_module->device, mode) < 0) {
ret = false;
pa_log_warn("Failed to set mode.");
} else {
+ if (hw_module->state.mode != mode && mode == AUDIO_MODE_IN_CALL) {
+ pa_droid_stream *primary_output;
+
+ /* Always start call mode with earpiece. This helps some devices which cannot
+ * start call directly with headset and doesn't cause any harm with devices
+ * which can either. */
+ if ((primary_output = pa_droid_hw_primary_output_stream(hw_module)))
+ pa_droid_stream_set_route(primary_output, AUDIO_DEVICE_OUT_EARPIECE);
+ }
+
hw_module->state.mode = mode;
}
pa_droid_hw_module_unlock(hw_module);
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.92.tar.bz2/src/common/include/droid/droid-util.h
^
|
@@ -30,6 +30,7 @@
#include <pulsecore/mutex.h>
#include <pulsecore/strlist.h>
#include <pulsecore/atomic.h>
+#include <pulsecore/modargs.h>
#include <droid/version.h>
#include <droid/droid-config.h>
@@ -67,6 +68,26 @@
PA_DROID_HOOK_MAX
} pa_droid_hook_t;
+enum pa_droid_quirk_type {
+ QUIRK_INPUT_ATOI,
+ QUIRK_SET_PARAMETERS,
+ QUIRK_CLOSE_INPUT,
+ QUIRK_UNLOAD_NO_CLOSE,
+ QUIRK_NO_HW_VOLUME,
+ QUIRK_OUTPUT_MAKE_WRITABLE,
+ QUIRK_REALCALL,
+ QUIRK_UNLOAD_CALL_EXIT,
+ QUIRK_OUTPUT_FAST,
+ QUIRK_OUTPUT_DEEP_BUFFER,
+ QUIRK_AUDIO_CAL_WAIT,
+ QUIRK_STANDBY_SET_ROUTE,
+ QUIRK_SPEAKER_BEFORE_VOICE,
+ QUIRK_COUNT
+};
+
+struct pa_droid_quirks {
+ bool enabled[QUIRK_COUNT];
+};
struct pa_droid_hw_module {
PA_REFCNT_DECLARE;
@@ -95,7 +116,7 @@
pa_atomic_t active_outputs;
- pa_droid_quirks *quirks;
+ pa_droid_quirks quirks;
/* Mode and input control */
struct _state {
@@ -217,27 +238,12 @@
#define PA_DROID_OUTPUT_PARKING "output-parking"
#define PA_DROID_INPUT_PARKING "input-parking"
-enum pa_droid_quirk_type {
- QUIRK_INPUT_ATOI,
- QUIRK_SET_PARAMETERS,
- QUIRK_CLOSE_INPUT,
- QUIRK_UNLOAD_NO_CLOSE,
- QUIRK_NO_HW_VOLUME,
- QUIRK_OUTPUT_MAKE_WRITABLE,
- QUIRK_REALCALL,
- QUIRK_UNLOAD_CALL_EXIT,
- QUIRK_OUTPUT_FAST,
- QUIRK_OUTPUT_DEEP_BUFFER,
- QUIRK_COUNT
-};
-
-struct pa_droid_quirks {
- bool enabled[QUIRK_COUNT];
-};
-
/* Open hardware module */
/* 'config' can be NULL if it is assumed that hw module with module_id already is open. */
pa_droid_hw_module *pa_droid_hw_module_get(pa_core *core, const pa_droid_config_audio *config, const char *module_id);
+/* First try to get already open hw module and if none found parse config and quirks from modargs
+ * and do initial open. */
+pa_droid_hw_module *pa_droid_hw_module_get2(pa_core *core, pa_modargs *ma, const char *module_id);
pa_droid_hw_module *pa_droid_hw_module_ref(pa_droid_hw_module *hw);
void pa_droid_hw_module_unref(pa_droid_hw_module *hw);
@@ -245,11 +251,11 @@
bool pa_droid_hw_module_try_lock(pa_droid_hw_module *hw);
void pa_droid_hw_module_unlock(pa_droid_hw_module *hw);
-bool pa_droid_quirk_parse(pa_droid_hw_module *hw, const char *quirks);
+bool pa_droid_quirk_parse(pa_droid_quirks *quirks, const char *quirks_def);
void pa_droid_quirk_log(pa_droid_hw_module *hw);
static inline bool pa_droid_quirk(pa_droid_hw_module *hw, enum pa_droid_quirk_type quirk) {
- return hw->quirks && hw->quirks->enabled[quirk];
+ return hw && hw->quirks.enabled[quirk];
}
bool pa_droid_hw_set_mode(pa_droid_hw_module *hw_module, audio_mode_t mode);
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.92.tar.bz2/src/droid/Makefile.am
^
|
@@ -19,8 +19,6 @@
module-droid-source.la \
module-droid-card.la
-noinst_HEADERS = module-droid-sink-symdef.h module-droid-source-symdef.h module-droid-card-symdef.h
-
libdroid_sink_la_SOURCES = droid-sink.c droid-sink.h
libdroid_sink_la_LDFLAGS = -avoid-version -Wl,-z,noexecstack -lhybris-common
libdroid_sink_la_LIBADD = $(top_builddir)/src/common/libdroid-util.la $(AM_LIBADD)
@@ -34,14 +32,14 @@
module_droid_sink_la_SOURCES = module-droid-sink.c
module_droid_sink_la_LDFLAGS = -module -avoid-version -Wl,-z,noexecstack -lhybris-common
module_droid_sink_la_LIBADD = -lm libdroid-sink.la $(AM_LIBADD)
-module_droid_sink_la_CFLAGS = $(AM_CFLAGS)
+module_droid_sink_la_CFLAGS = $(AM_CFLAGS) -DPA_MODULE_NAME=module_droid_sink
module_droid_source_la_SOURCES = module-droid-source.c
module_droid_source_la_LDFLAGS = -module -avoid-version -Wl,-z,noexecstack -lhybris-common
module_droid_source_la_LIBADD = -lm libdroid-source.la $(AM_LIBADD)
-module_droid_source_la_CFLAGS = $(AM_CFLAGS)
+module_droid_source_la_CFLAGS = $(AM_CFLAGS) -DPA_MODULE_NAME=module_droid_source
module_droid_card_la_SOURCES = module-droid-card.c
module_droid_card_la_LDFLAGS = -module -avoid-version -Wl,-z,noexecstack -lhybris-common
module_droid_card_la_LIBADD = -lm libdroid-sink.la libdroid-source.la $(top_builddir)/src/common/libdroid-util.la $(AM_LIBADD)
-module_droid_card_la_CFLAGS = $(AM_CFLAGS)
+module_droid_card_la_CFLAGS = $(AM_CFLAGS) -DPA_MODULE_NAME=module_droid_card
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.92.tar.bz2/src/droid/droid-sink.c
^
|
@@ -54,6 +54,7 @@
#include <pulsecore/time-smoother.h>
#include <pulsecore/hashmap.h>
#include <pulsecore/core-subscribe.h>
+#include <pulse/util.h>
#include <pulse/version.h>
#include "droid-sink.h"
@@ -79,6 +80,7 @@
pa_usec_t write_time;
pa_usec_t write_threshold;
audio_devices_t prewrite_devices;
+ bool prewrite_always;
uint32_t prewrite_silence;
pa_hook_slot *sink_put_hook_slot;
pa_hook_slot *sink_unlink_hook_slot;
@@ -94,7 +96,6 @@
bool use_voice_volume;
char *voice_property_key;
char *voice_property_value;
- pa_sink_input *voice_control_sink_input;
pa_hook_slot *sink_input_volume_changed_hook_slot;
pa_hook_slot *sink_input_put_hook_slot;
@@ -129,6 +130,8 @@
static void parameter_free(droid_parameter_mapping *m);
static void userdata_free(struct userdata *u);
static void set_voice_volume(struct userdata *u, pa_sink_input *i);
+static void apply_volume(pa_sink *s);
+static pa_sink_input *find_volume_control_sink_input(struct userdata *u);
static void set_primary_devices(struct userdata *u, audio_devices_t devices) {
pa_assert(u);
@@ -289,7 +292,7 @@
pa_memblockq_drop(u->memblockq, c.length);
pa_memblock_unref(c.memblock);
u->write_time = 0;
- pa_log("failed to write stream (%d)", wrote);
+ pa_log("failed to write stream (%zd)", wrote);
return -1;
}
@@ -391,6 +394,9 @@
if (pa_rtpoll_timer_elapsed(u->rtpoll)) {
pa_usec_t sleept = 0;
+ if (u->use_hw_volume)
+ pa_sink_volume_change_apply(u->sink, NULL);
+
thread_render(u);
thread_write(u);
@@ -398,6 +404,9 @@
sleept = u->buffer_time;
pa_rtpoll_set_timer_relative(u->rtpoll, sleept);
+
+ if (u->use_hw_volume)
+ pa_sink_volume_change_apply(u->sink, NULL);
}
} else
pa_rtpoll_set_timer_disabled(u->rtpoll);
@@ -455,9 +464,11 @@
pa_log_info("Resuming...");
+ apply_volume(u->sink);
+
if (u->prewrite_silence &&
(u->primary_devices | u->extra_devices) & u->prewrite_devices &&
- pa_droid_output_stream_any_active(u->stream) == 0) {
+ (u->prewrite_always || pa_droid_output_stream_any_active(u->stream) == 0)) {
for (i = 0; i < u->prewrite_silence; i++)
thread_write_silence(u);
}
@@ -523,14 +534,6 @@
*((pa_usec_t*) data) = pa_droid_stream_get_latency(u->stream);
return 0;
}
-
-#if PULSEAUDIO_VERSION < 12
- case PA_SINK_MESSAGE_SET_STATE: {
- int r;
- if ((r = sink_set_state_in_io_thread_cb(u->sink, PA_PTR_TO_UINT(data), 0)) < 0)
- return r;
- }
-#endif
}
return pa_sink_process_msg(o, code, data, offset, chunk);
@@ -561,30 +564,39 @@
return 0;
}
-static void sink_set_volume_cb(pa_sink *s) {
+static void apply_volume(pa_sink *s) {
struct userdata *u = s->userdata;
pa_cvolume r;
+ float val;
+
+ if (u->use_voice_volume)
+ return;
+
+ if (!u->use_hw_volume)
+ return;
/* Shift up by the base volume */
pa_sw_cvolume_divide_scalar(&r, &s->real_volume, s->base_volume);
- if (r.channels == 1) {
- float val = pa_sw_volume_to_linear(r.values[0]);
- pa_log_debug("Set %s hw volume %f", s->name, val);
- pa_droid_hw_module_lock(u->hw_module);
- if (u->stream->output->stream->set_volume(u->stream->output->stream, val, val) < 0)
- pa_log_warn("Failed to set hw volume.");
- pa_droid_hw_module_unlock(u->hw_module);
- } else if (r.channels == 2) {
- float val[2];
- for (unsigned i = 0; i < 2; i++)
- val[i] = pa_sw_volume_to_linear(r.values[i]);
- pa_log_debug("Set %s hw volume %f : %f", s->name, val[0], val[1]);
- pa_droid_hw_module_lock(u->hw_module);
- if (u->stream->output->stream->set_volume(u->stream->output->stream, val[0], val[1]) < 0)
- pa_log_warn("Failed to set hw volume.");
- pa_droid_hw_module_unlock(u->hw_module);
- }
+ /* So far every hal implementation doing volume control expects
+ * both channels to have equal value, so we can just average the value
+ * from all channels. */
+ val = pa_sw_volume_to_linear(pa_cvolume_avg(&r));
+
+ pa_log_debug("Set %s volume -> %f", s->name, val);
+ pa_droid_hw_module_lock(u->hw_module);
+ if (u->stream->output->stream->set_volume(u->stream->output->stream, val, val) < 0)
+ pa_log_warn("Failed to set volume.");
+ pa_droid_hw_module_unlock(u->hw_module);
+}
+
+static void sink_set_volume_cb(pa_sink *s) {
+ (void) s;
+ /* noop */
+}
+
+static void sink_write_volume_cb(pa_sink *s) {
+ apply_volume(s);
}
/* Called from main thread */
@@ -631,8 +643,10 @@
u->use_hw_volume ? "hardware" : "software", u->sink->name);
}
- if (u->use_hw_volume)
+ if (u->use_hw_volume) {
pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb);
+ pa_sink_set_write_volume_callback(u->sink, sink_write_volume_cb);
+ }
}
static void set_sink_name(pa_modargs *ma, pa_sink_new_data *data, const char *module_id) {
@@ -696,13 +710,8 @@
if (!u->use_voice_volume)
return PA_HOOK_OK;
- if (!u->voice_control_sink_input && sink_input_is_voice_control(u, sink_input))
- u->voice_control_sink_input = sink_input;
-
- if (u->voice_control_sink_input != sink_input)
- return PA_HOOK_OK;
-
- set_voice_volume(u, sink_input);
+ if (sink_input_is_voice_control(u, sink_input))
+ set_voice_volume(u, sink_input);
return PA_HOOK_OK;
}
@@ -734,29 +743,21 @@
pa_assert(!u->sink_input_volume_changed_hook_slot);
- if (u->use_hw_volume)
- pa_sink_set_set_volume_callback(u->sink, NULL);
-
u->sink_input_volume_changed_hook_slot = pa_hook_connect(&u->core->hooks[PA_CORE_HOOK_SINK_INPUT_VOLUME_CHANGED],
PA_HOOK_LATE+10, (pa_hook_cb_t) sink_input_volume_changed_hook_cb, u);
if ((i = find_volume_control_sink_input(u))) {
- u->voice_control_sink_input = i;
set_voice_volume(u, i);
}
} else {
pa_assert(u->sink_input_volume_changed_hook_slot);
- u->voice_control_sink_input = NULL;
pa_hook_slot_free(u->sink_input_volume_changed_hook_slot);
u->sink_input_volume_changed_hook_slot = NULL;
pa_log_debug("Using %s volume control with %s",
u->use_hw_volume ? "hardware" : "software", u->sink->name);
-
- if (u->use_hw_volume)
- pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb);
}
}
@@ -767,8 +768,7 @@
const char *media_str;
audio_devices_t devices;
- if (u->use_voice_volume && !u->voice_control_sink_input && sink_input_is_voice_control(u, sink_input)) {
- u->voice_control_sink_input = sink_input;
+ if (u->use_voice_volume && sink_input_is_voice_control(u, sink_input)) {
set_voice_volume(u, sink_input);
}
@@ -803,9 +803,6 @@
const char *media_str;
audio_devices_t devices;
- if (u->voice_control_sink_input == sink_input)
- u->voice_control_sink_input = NULL;
-
/* Dynamic routing changes do not apply during active voice call. */
if (u->use_voice_volume)
return PA_HOOK_OK;
@@ -991,6 +988,9 @@
/* Argument is string of for example "deep_buffer=AUDIO_DEVICE_OUT_SPEAKER:1,primary=FOO:5" */
while ((entry = pa_split(prewrite_resume, ",", &state))) {
+ audio_devices_t prewrite_devices = 0;
+ bool prewrite_always = false;
+ char *tmp;
entry_len = strlen(entry);
devices_index = strcspn(entry, "=");
@@ -1011,17 +1011,23 @@
devices[value_index] = '\0';
value = devices + value_index + 1;
- if (!parse_device_list(devices, &u->prewrite_devices)) {
- u->prewrite_devices = 0;
+ if (!parse_device_list(devices, &prewrite_devices))
goto error;
+
+ if ((tmp = strstr(value, "/always"))) {
+ prewrite_always = true;
+ *tmp = '\0';
}
if (strlen(value) == 0 || pa_atou(value, &b) < 0)
goto error;
if (pa_streq(stream, name)) {
- pa_log_info("Using requested prewrite size for %s: %u (%u * %u).",
+ pa_log_info("Using requested prewrite%s size for %s: %zu (%u * %zu).",
+ prewrite_always ? "_always" : "",
name, u->buffer_size * b, b, u->buffer_size);
+ u->prewrite_devices = prewrite_devices;
+ u->prewrite_always = prewrite_always;
u->prewrite_silence = b;
pa_xfree(entry);
return true;
@@ -1060,7 +1066,6 @@
pa_channel_map channel_map;
bool namereg_fail = false;
pa_usec_t latency;
- pa_droid_config_audio *config = NULL; /* Only used when sink is created without card */
uint32_t sink_buffer = 0;
const char *prewrite_resume = NULL;
bool mix_route = false;
@@ -1167,21 +1172,10 @@
}
/* Sink wasn't created from inside card module, so we'll need to open
- * hw module ourself.
- *
- * First let's find out if hw module has already been opened, or if we need to
- * do it ourself. */
- if (!(u->hw_module = pa_droid_hw_module_get(u->core, NULL, module_id))) {
- /* No hw module object in shared object db, let's open the module now. */
- if (!(config = pa_droid_config_load(ma)))
- goto fail;
+ * hw module ourself. */
- if (!(u->hw_module = pa_droid_hw_module_get(u->core, config, module_id)))
- goto fail;
-
- pa_droid_config_free(config);
- config = NULL;
- }
+ if (!(u->hw_module = pa_droid_hw_module_get2(u->core, ma, module_id)))
+ goto fail;
}
/* Default routing */
@@ -1209,9 +1203,9 @@
u->buffer_size = pa_droid_stream_buffer_size(u->stream);
if (sink_buffer) {
u->buffer_size = pa_droid_buffer_size_round_up(sink_buffer, u->buffer_size);
- pa_log_info("Using buffer size %u (requested %u).", u->buffer_size, sink_buffer);
+ pa_log_info("Using buffer size %zu (requested %u).", u->buffer_size, sink_buffer);
} else
- pa_log_info("Using buffer size %u.", u->buffer_size);
+ pa_log_info("Using buffer size %zu.", u->buffer_size);
if ((prewrite_resume = pa_modargs_get_value(ma, "prewrite_on_resume", NULL))) {
if (!parse_prewrite_on_resume(u, prewrite_resume, output->name)) {
@@ -1285,9 +1279,7 @@
u->sink->userdata = u;
u->sink->parent.process_msg = sink_process_msg;
-#if PULSEAUDIO_VERSION >= 12
u->sink->set_state_in_io_thread = sink_set_state_in_io_thread_cb;
-#endif
u->sink->set_port = sink_set_port_cb;
@@ -1308,7 +1300,7 @@
/* HAL latencies are in milliseconds. */
latency = pa_droid_stream_get_latency(u->stream);
pa_sink_set_fixed_latency(u->sink, latency);
- pa_log_debug("Set fixed latency %llu usec", latency);
+ pa_log_debug("Set fixed latency %" PRIu64 " usec", latency);
pa_sink_set_max_request(u->sink, u->buffer_size);
if (u->sink->active_port)
@@ -1335,7 +1327,6 @@
return u->sink;
fail:
- pa_droid_config_free(config);
pa_xfree(thread_name);
if (u)
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.92.tar.bz2/src/droid/droid-source.c
^
|
@@ -51,6 +51,7 @@
#include <pulsecore/rtpoll.h>
#include <pulsecore/time-smoother.h>
#include <pulsecore/resampler.h>
+#include <pulse/util.h>
#include <pulse/version.h>
#include "droid-source.h"
@@ -173,7 +174,7 @@
pa_memblock_release(chunk.memblock);
if (readd < 0) {
- pa_log("Failed to read from stream. (err %i)", readd);
+ pa_log("Failed to read from stream. (err %zd)", readd);
goto end;
}
@@ -324,23 +325,6 @@
return 0;
}
-/* Called from IO context */
-static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
-#if PULSEAUDIO_VERSION < 12
- struct userdata *u = PA_SOURCE(o)->userdata;
-
- switch (code) {
- case PA_SOURCE_MESSAGE_SET_STATE: {
- int r;
- if ((r = source_set_state_in_io_thread_cb(u->source, PA_PTR_TO_UINT(data), 0)) < 0)
- return r;
- }
- }
-#endif
-
- return pa_source_process_msg(o, code, data, offset, chunk);
-}
-
static int source_set_port_cb(pa_source *s, pa_device_port *p) {
struct userdata *u = s->userdata;
pa_droid_port_data *data;
@@ -430,9 +414,9 @@
if (u->source_buffer_size) {
u->buffer_size = pa_droid_buffer_size_round_up(u->source_buffer_size, u->buffer_size);
- pa_log_info("Using buffer size %u (requested %u).", u->buffer_size, u->source_buffer_size);
+ pa_log_info("Using buffer size %zu (requested %zu).", u->buffer_size, u->source_buffer_size);
} else
- pa_log_info("Using buffer size %u.", u->buffer_size);
+ pa_log_info("Using buffer size %zu.", u->buffer_size);
if (pa_thread_mq_get())
pa_source_set_fixed_latency_within_thread(u->source, pa_bytes_to_usec(u->buffer_size, pa_droid_stream_sample_spec(u->stream)));
@@ -574,7 +558,6 @@
pa_channel_map channel_map;
const char *format;
bool namereg_fail = false;
- pa_droid_config_audio *config = NULL; /* Only used when source is created without card */
uint32_t source_buffer = 0;
pa_assert(m);
@@ -650,20 +633,10 @@
pa_assert_se((u->hw_module = pa_droid_hw_module_get(u->core, NULL, card_data->module_id)));
} else {
/* Source wasn't created from inside card module, so we'll need to open
- * hw module ourself.
- *
- * First let's find out if hw module has already been opened, or if we need to
- * do it ourself. */
- if (!(u->hw_module = pa_droid_hw_module_get(u->core, NULL, module_id))) {
- if (!(config = pa_droid_config_load(ma)))
- goto fail;
-
- if (!(u->hw_module = pa_droid_hw_module_get(u->core, config, module_id)))
- goto fail;
+ * hw module ourself. */
- pa_droid_config_free(config);
- config = NULL;
- }
+ if (!(u->hw_module = pa_droid_hw_module_get2(u->core, ma, module_id)))
+ goto fail;
}
/* Default routing */
@@ -740,10 +713,8 @@
u->source->userdata = u;
- u->source->parent.process_msg = source_process_msg;
-#if PULSEAUDIO_VERSION >= 12
+ u->source->parent.process_msg = pa_source_process_msg;
u->source->set_state_in_io_thread = source_set_state_in_io_thread_cb;
-#endif
source_set_mute_control(u);
@@ -788,7 +759,6 @@
return u->source;
fail:
- pa_droid_config_free(config);
pa_xfree(thread_name);
if (u)
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.92.tar.bz2/src/droid/module-droid-card.c
^
|
@@ -64,8 +64,6 @@
#include "droid-sink.h"
#include "droid-source.h"
-#include "module-droid-card-symdef.h"
-
PA_MODULE_AUTHOR("Juho Hämäläinen");
PA_MODULE_DESCRIPTION("Droid card");
PA_MODULE_VERSION(PACKAGE_VERSION);
@@ -543,7 +541,7 @@
pa_log_debug("Leave virtual profile %s", current->droid_profile->name);
if (next->mode != current->mode) {
- park_profile(current->droid_profile);
+ park_profile(card_get_droid_profile(u->real_profile));
pa_droid_hw_set_mode(u->hw_module, next->mode);
}
@@ -596,7 +594,7 @@
}
if (next->mode != current->mode) {
- park_profile(current->droid_profile);
+ park_profile(card_get_droid_profile(u->real_profile));
pa_droid_hw_set_mode(u->hw_module, next->mode);
}
@@ -724,11 +722,9 @@
struct userdata *u = NULL;
pa_modargs *ma = NULL;
pa_card_new_data data;
- pa_droid_config_audio *config = NULL;
const char *module_id;
bool namereg_fail = false;
bool default_profile = true;
- const char *quirks;
pa_card_profile *voicecall = NULL;
pa_assert(m);
@@ -751,26 +747,8 @@
module_id = pa_modargs_get_value(ma, "module_id", DEFAULT_MODULE_ID);
- /* First let's find out if hw module has already been opened, or if we need to
- * do it ourself. */
- if (!(u->hw_module = pa_droid_hw_module_get(u->core, NULL, module_id))) {
- /* No hw module object in shared object db, let's open the module now. */
- if (!(config = pa_droid_config_load(ma)))
- goto fail;
-
- if (!(u->hw_module = pa_droid_hw_module_get(u->core, config, module_id)))
- goto fail;
-
- pa_droid_config_free(config);
- config = NULL;
- }
-
- if ((quirks = pa_modargs_get_value(ma, "quirks", NULL))) {
- if (!pa_droid_quirk_parse(u->hw_module, quirks)) {
- pa_log("Failed to parse quirks.");
- goto fail;
- }
- }
+ if (!(u->hw_module = pa_droid_hw_module_get2(u->core, ma, module_id)))
+ goto fail;
pa_droid_quirk_log(u->hw_module);
@@ -872,8 +850,6 @@
return 0;
fail:
- pa_droid_config_free(config);
-
if (ma)
pa_modargs_free(ma);
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.92.tar.bz2/src/droid/module-droid-sink.c
^
|
@@ -41,8 +41,6 @@
#include <droid/conversion.h>
#include "droid-sink.h"
-#include "module-droid-sink-symdef.h"
-
PA_MODULE_AUTHOR("Juho Hämäläinen");
PA_MODULE_DESCRIPTION("Droid sink");
PA_MODULE_USAGE("master_sink=<sink to connect to> "
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-14.2.92.tar.bz2/src/droid/module-droid-source.c
^
|
@@ -40,8 +40,6 @@
#include <droid/droid-util.h>
#include "droid-source.h"
-#include "module-droid-source-symdef.h"
-
PA_MODULE_AUTHOR("Juho Hämäläinen");
PA_MODULE_DESCRIPTION("Droid source");
PA_MODULE_USAGE("master_source=<source to connect to> "
|