[pulseaudio-discuss] [PATCH 11/22] source/sink: Don't let pa_{sink, source}_getLatency_within_thread() return -1 if process_msg() fails
Georg Chini
georg at chini.tk
Mon Feb 13 12:02:08 UTC 2017
Returning -1 on error does not make sense for a function that may return
negative values. Also no caller checks the return value anyway, so it
looks like a better idea to just return the offset when the message
processing fails.
---
src/pulsecore/sink.c | 3 +--
src/pulsecore/source.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 02b186f..7ba9009 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -1549,8 +1549,7 @@ int64_t pa_sink_get_latency_within_thread(pa_sink *s, bool allow_negative) {
/* FIXME: We probably should make this a proper vtable callback instead of going through process_msg() */
- if (o->process_msg(o, PA_SINK_MESSAGE_GET_LATENCY, &usec, 0, NULL) < 0)
- return -1;
+ o->process_msg(o, PA_SINK_MESSAGE_GET_LATENCY, &usec, 0, NULL);
/* If allow_negative is false, the call should only return positive values, */
usec += s->thread_info.port_latency_offset;
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 21123fd..4b9dc18 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -1144,8 +1144,7 @@ int64_t pa_source_get_latency_within_thread(pa_source *s, bool allow_negative) {
/* FIXME: We probably should make this a proper vtable callback instead of going through process_msg() */
- if (o->process_msg(o, PA_SOURCE_MESSAGE_GET_LATENCY, &usec, 0, NULL) < 0)
- return -1;
+ o->process_msg(o, PA_SOURCE_MESSAGE_GET_LATENCY, &usec, 0, NULL);
/* If allow_negative is false, the call should only return positive values, */
usec += s->thread_info.port_latency_offset;
--
2.10.1
More information about the pulseaudio-discuss
mailing list