[pulseaudio-discuss] [PATCH 05/13] loopback: Don't track max_request and min_memblockq_length
Georg Chini
georg at chini.tk
Wed Feb 25 10:43:17 PST 2015
They are unused now.
---
src/modules/module-loopback.c | 52 -------------------------------------------
1 file changed, 52 deletions(-)
diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
index 372c3ed..f9255ee 100644
--- a/src/modules/module-loopback.c
+++ b/src/modules/module-loopback.c
@@ -85,7 +85,6 @@ struct userdata {
pa_usec_t latency;
bool in_pop;
- size_t min_memblockq_length;
struct {
int64_t send_counter;
@@ -97,9 +96,6 @@ struct userdata {
size_t sink_input_buffer;
pa_usec_t sink_latency;
pa_usec_t sink_timestamp;
-
- size_t min_memblockq_length;
- size_t max_request;
} latency_snapshot;
};
@@ -124,7 +120,6 @@ enum {
SINK_INPUT_MESSAGE_POST = PA_SINK_INPUT_MESSAGE_MAX,
SINK_INPUT_MESSAGE_REWIND,
SINK_INPUT_MESSAGE_LATENCY_SNAPSHOT,
- SINK_INPUT_MESSAGE_MAX_REQUEST_CHANGED
};
enum {
@@ -235,14 +230,9 @@ static void adjust_rates(struct userdata *u) {
(double) latency_difference / PA_USEC_PER_MSEC,
(int32_t)(old_rate - base_rate));
- pa_log_debug("Should buffer %zu bytes, buffered at minimum %zu bytes",
- u->latency_snapshot.max_request*2,
- u->latency_snapshot.min_memblockq_length);
-
/* Calculate new rate */
new_rate = rate_controller(base_rate, u->adjust_time, latency_difference);
-
/* Set rate */
pa_sink_input_set_rate(u->sink_input, new_rate);
pa_log_debug("[%s] Updated sampling rate to %lu Hz.", u->sink_input->sink->name, (unsigned long) new_rate);
@@ -463,20 +453,6 @@ static void source_output_suspend_cb(pa_source_output *o, bool suspended) {
}
/* Called from output thread context */
-static void update_min_memblockq_length(struct userdata *u) {
- size_t length;
-
- pa_assert(u);
- pa_sink_input_assert_io_context(u->sink_input);
-
- length = pa_memblockq_get_length(u->memblockq);
-
- if (u->min_memblockq_length == (size_t) -1 ||
- length < u->min_memblockq_length)
- u->min_memblockq_length = length;
-}
-
-/* Called from output thread context */
static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk) {
struct userdata *u;
@@ -498,8 +474,6 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk
chunk->length = PA_MIN(chunk->length, nbytes);
pa_memblockq_drop(u->memblockq, chunk->length);
- update_min_memblockq_length(u);
-
return 0;
}
@@ -541,8 +515,6 @@ static int sink_input_process_msg_cb(pa_msgobject *obj, int code, void *data, in
else
pa_memblockq_flush_write(u->memblockq, true);
- update_min_memblockq_length(u);
-
/* Is this the end of an underrun? Then let's start things
* right-away */
if (!u->in_pop &&
@@ -570,15 +542,11 @@ static int sink_input_process_msg_cb(pa_msgobject *obj, int code, void *data, in
u->recv_counter -= offset;
- update_min_memblockq_length(u);
-
return 0;
case SINK_INPUT_MESSAGE_LATENCY_SNAPSHOT: {
size_t length;
- update_min_memblockq_length(u);
-
length = pa_memblockq_get_length(u->sink_input->thread_info.render_memblockq);
u->latency_snapshot.recv_counter = u->recv_counter;
@@ -588,23 +556,6 @@ static int sink_input_process_msg_cb(pa_msgobject *obj, int code, void *data, in
u->latency_snapshot.sink_latency = pa_sink_get_latency_within_thread(u->sink_input->sink);
u->latency_snapshot.sink_timestamp = pa_rtclock_now();
- u->latency_snapshot.max_request = pa_sink_input_get_max_request(u->sink_input);
-
- u->latency_snapshot.min_memblockq_length = u->min_memblockq_length;
- u->min_memblockq_length = (size_t) -1;
-
- return 0;
- }
-
- case SINK_INPUT_MESSAGE_MAX_REQUEST_CHANGED: {
- /* This message is sent from the IO thread to the main
- * thread! So don't be confused. All the user cases above
- * are executed in thread context, but this one is not! */
-
- pa_assert_ctl_context();
-
- if (u->time_event)
- adjust_rates(u);
return 0;
}
}
@@ -627,8 +578,6 @@ static void sink_input_attach_cb(pa_sink_input *i) {
pa_memblockq_set_prebuf(u->memblockq, pa_sink_input_get_max_request(i)*2);
pa_memblockq_set_maxrewind(u->memblockq, pa_sink_input_get_max_rewind(i));
-
- u->min_memblockq_length = (size_t) -1;
}
/* Called from output thread context */
@@ -666,7 +615,6 @@ static void sink_input_update_max_request_cb(pa_sink_input *i, size_t nbytes) {
pa_memblockq_set_prebuf(u->memblockq, nbytes*2);
pa_log_info("Max request changed");
- pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(u->sink_input), SINK_INPUT_MESSAGE_MAX_REQUEST_CHANGED, NULL, 0, NULL, NULL);
}
/* Called from main thread */
--
2.1.4
More information about the pulseaudio-discuss
mailing list