Changeset View
Changeset View
Standalone View
Standalone View
files/allow-disabling-rewinds-12.2.patch
- This file was added.
| diff -ruN pulseaudio-12.2/src/modules/module-null-sink.c pulseaudio-12.2-new/src/modules/module-null-sink.c | |||||
| --- pulseaudio-12.2/src/modules/module-null-sink.c 2018-07-16 17:40:33.000000000 +0300 | |||||
| +++ pulseaudio-12.2-new/src/modules/module-null-sink.c 2020-07-28 15:35:36.011256277 +0300 | |||||
| @@ -51,10 +51,12 @@ | |||||
| "format=<sample format> " | |||||
| "rate=<sample rate> " | |||||
| "channels=<number of channels> " | |||||
| - "channel_map=<channel map>"); | |||||
| + "channel_map=<channel map>" | |||||
| + "norewinds=<disable rewinds>"); | |||||
| #define DEFAULT_SINK_NAME "null" | |||||
| #define BLOCK_USEC (PA_USEC_PER_SEC * 2) | |||||
| +#define NOREWINDS_MAX_LATENCY_USEC (50*PA_USEC_PER_MSEC) | |||||
| struct userdata { | |||||
| pa_core *core; | |||||
| @@ -67,6 +69,8 @@ | |||||
| pa_usec_t block_usec; | |||||
| pa_usec_t timestamp; | |||||
| + | |||||
| + bool norewinds; | |||||
| }; | |||||
| static const char* const valid_modargs[] = { | |||||
| @@ -76,6 +80,7 @@ | |||||
| "rate", | |||||
| "channels", | |||||
| "channel_map", | |||||
| + "norewinds", | |||||
| NULL | |||||
| }; | |||||
| @@ -130,7 +135,13 @@ | |||||
| u->block_usec = s->thread_info.max_latency; | |||||
| nbytes = pa_usec_to_bytes(u->block_usec, &s->sample_spec); | |||||
| - pa_sink_set_max_rewind_within_thread(s, nbytes); | |||||
| + | |||||
| + if(u->norewinds){ | |||||
| + pa_sink_set_max_rewind_within_thread(s, 0); | |||||
| + } else { | |||||
| + pa_sink_set_max_rewind_within_thread(s, nbytes); | |||||
| + } | |||||
| + | |||||
| pa_sink_set_max_request_within_thread(s, nbytes); | |||||
| } | |||||
| @@ -293,6 +304,8 @@ | |||||
| pa_sink_new_data_done(&data); | |||||
| goto fail; | |||||
| } | |||||
| + | |||||
| + | |||||
| u->sink = pa_sink_new(m->core, &data, PA_SINK_LATENCY|PA_SINK_DYNAMIC_LATENCY); | |||||
| pa_sink_new_data_done(&data); | |||||
| @@ -312,7 +325,17 @@ | |||||
| u->block_usec = BLOCK_USEC; | |||||
| nbytes = pa_usec_to_bytes(u->block_usec, &u->sink->sample_spec); | |||||
| - pa_sink_set_max_rewind(u->sink, nbytes); | |||||
| + | |||||
| + if(pa_modargs_get_value_boolean(ma, "norewinds", &u->norewinds) < 0){ | |||||
| + pa_log("Invalid argument, norewinds expects a boolean value."); | |||||
| + } | |||||
| + | |||||
| + if(u->norewinds){ | |||||
| + pa_sink_set_max_rewind(u->sink, 0); | |||||
| + } else { | |||||
| + pa_sink_set_max_rewind(u->sink, nbytes); | |||||
| + } | |||||
| + | |||||
| pa_sink_set_max_request(u->sink, nbytes); | |||||
| if (!(u->thread = pa_thread_new("null-sink", thread_func, u))) { | |||||
| @@ -320,7 +343,11 @@ | |||||
| goto fail; | |||||
| } | |||||
| - pa_sink_set_latency_range(u->sink, 0, BLOCK_USEC); | |||||
| + if(u->norewinds){ | |||||
| + pa_sink_set_latency_range(u->sink, 0, NOREWINDS_MAX_LATENCY_USEC); | |||||
| + } else { | |||||
| + pa_sink_set_latency_range(u->sink, 0, BLOCK_USEC); | |||||
| + } | |||||
| pa_sink_put(u->sink); | |||||
Copyright © 2015-2021 Solus Project. The Solus logo is Copyright © 2016-2021 Solus Project. All Rights Reserved.