[pulseaudio-discuss] [PATCH 5/6] pactl, cli-command: Fixed use of int32, int64 should be used for latency offset.

Chris Billington chrisjbillington at gmail.com
Fri Jan 22 17:31:37 PST 2016


A few int32s were used when parsing command line input and passing on to
set_port_latency_offset. Latency offsets can be int64s, so this has been fixed.
---
 src/pulsecore/cli-command.c | 4 ++--
 src/utils/pactl.c           | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
index 9a73605..cd88c47 100644
--- a/src/pulsecore/cli-command.c
+++ b/src/pulsecore/cli-command.c
@@ -1735,7 +1735,7 @@ static int pa_cli_command_port_offset(pa_core *c, pa_tokenizer *t, pa_strbuf *bu
     const char *n, *p, *l;
     pa_device_port *port;
     pa_card *card;
-    int32_t offset;
+    int64_t offset;
 
     pa_core_assert_ref(c);
     pa_assert(t);
@@ -1757,7 +1757,7 @@ static int pa_cli_command_port_offset(pa_core *c, pa_tokenizer *t, pa_strbuf *bu
         return -1;
     }
 
-    if (pa_atoi(l, &offset) < 0) {
+    if (pa_atol(l, &offset) < 0) {
         pa_strbuf_puts(buf, "Failed to parse the latency offset.\n");
         return -1;
     }
diff --git a/src/utils/pactl.c b/src/utils/pactl.c
index e9bf005..8715126 100644
--- a/src/utils/pactl.c
+++ b/src/utils/pactl.c
@@ -65,7 +65,7 @@ static uint32_t
 
 static bool short_list_format = false;
 static uint32_t module_index;
-static int32_t latency_offset;
+static int64_t latency_offset;
 static bool suspend;
 static pa_cvolume volume;
 static enum volume_flags {
@@ -130,6 +130,8 @@ static enum {
     SET_SOURCE_OUTPUT_MUTE,
     SET_SINK_FORMATS,
     SET_PORT_LATENCY_OFFSET,
+    SET_SINK_LATENCY_OFFSET,
+    SET_SOURCE_LATENCY_OFFSET,
     SUBSCRIBE
 } action = NONE;
 
@@ -2041,7 +2043,7 @@ int main(int argc, char *argv[]) {
 
             card_name = pa_xstrdup(argv[optind+1]);
             port_name = pa_xstrdup(argv[optind+2]);
-            if (pa_atoi(argv[optind + 3], &latency_offset) < 0) {
+            if (pa_atol(argv[optind + 3], &latency_offset) < 0) {
                 pa_log(_("Could not parse latency offset"));
                 goto quit;
             }
-- 
2.5.0



More information about the pulseaudio-discuss mailing list