[PATCH] tsched_buffer_size parameter support for alsa-sink

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: xingchao <wangxingchao2011@xxxxxxxxx>

module-udev-detect only support limited parrameters now, this make other
modules loaded according udev lack enough parameters. for example,
module-alsa-card is loaded by module-udev-detect, it will create alsa-sink
with only 3 parameters from module-udev-detect.

Signed-off-by: xingchao <wangxingchao2011 at gmail.com>
---
 src/modules/module-udev-detect.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/modules/module-udev-detect.c b/src/modules/module-udev-detect.c
index 63ad195..a17143a 100644
--- a/src/modules/module-udev-detect.c
+++ b/src/modules/module-udev-detect.c
@@ -44,6 +44,7 @@ PA_MODULE_DESCRIPTION("Detect available audio hardware and load matching drivers
 PA_MODULE_VERSION(PACKAGE_VERSION);
 PA_MODULE_LOAD_ONCE(TRUE);
 PA_MODULE_USAGE(
+        "tsched_buffer_size=<buffer size when using timer based scheduling> "
         "tsched=<enable system timer based scheduling mode?> "
         "ignore_dB=<ignore dB information from the device?> "
         "sync_volume=<syncronize sw and hw voluchanges in IO-thread?>");
@@ -65,6 +66,7 @@ struct userdata {
     pa_bool_t ignore_dB:1;
     pa_bool_t sync_volume:1;
 
+    size_t tsched_size;
     struct udev* udev;
     struct udev_monitor *monitor;
     pa_io_event *udev_io;
@@ -74,6 +76,7 @@ struct userdata {
 };
 
 static const char* const valid_modargs[] = {
+    "tsched_buffer_size",
     "tsched",
     "ignore_dB",
     "sync_volume",
@@ -388,6 +391,7 @@ static void card_changed(struct userdata *u, struct udev_device *dev) {
                                 "card_name=\"%s\" "
                                 "namereg_fail=false "
                                 "tsched=%s "
+                                "tsched_buffer_size=%d "
                                 "ignore_dB=%s "
                                 "sync_volume=%s "
                                 "card_properties=\"module-udev-detect.discovered=1\"",
@@ -395,6 +399,7 @@ static void card_changed(struct userdata *u, struct udev_device *dev) {
                                 n,
                                 d->card_name,
                                 pa_yes_no(u->use_tsched),
+				u->tsched_size,
                                 pa_yes_no(u->ignore_dB),
                                 pa_yes_no(u->sync_volume));
     pa_xfree(n);
@@ -665,6 +670,7 @@ int pa__init(pa_module *m) {
     struct udev_enumerate *enumerate = NULL;
     struct udev_list_entry *item = NULL, *first = NULL;
     int fd;
+    size_t tsched_size;
     pa_bool_t use_tsched = TRUE, ignore_dB = FALSE, sync_volume = m->core->sync_volume;
 
 
@@ -680,6 +686,12 @@ int pa__init(pa_module *m) {
     u->devices = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
     u->inotify_fd = -1;
 
+    if (pa_modargs_get_value_u32(ma, "tsched_buffer_size", &tsched_size) < 0) {
+        pa_log("Failed to parse tsched_buffer_size = argument.");
+        goto fail;
+    }
+    u->tsched_size = tsched_size;
+
     if (pa_modargs_get_value_boolean(ma, "tsched", &use_tsched) < 0) {
         pa_log("Failed to parse tsched= argument.");
         goto fail;
-- 
1.7.1




[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux