mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
null-sink: Change block size to 50 msec when norewinds is set
playing sound through null sink takes almost 2 seconds at first time playback when norewinds is set. Because block_usec is set 2 seconds at initializing time. The value will be changed 50 msec after calling update_request_latency callback. Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/406>
This commit is contained in:
parent
0fc54f9e7a
commit
1e7adb4fdb
1 changed files with 9 additions and 10 deletions
|
|
@ -57,8 +57,8 @@ PA_MODULE_USAGE(
|
|||
"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)
|
||||
#define BLOCK_USEC (2 * PA_USEC_PER_SEC)
|
||||
#define BLOCK_USEC_NOREWINDS (50 * PA_USEC_PER_MSEC)
|
||||
|
||||
struct userdata {
|
||||
pa_core *core;
|
||||
|
|
@ -318,6 +318,7 @@ int pa__init(pa_module*m) {
|
|||
u->core = m->core;
|
||||
u->module = m;
|
||||
u->rtpoll = pa_rtpoll_new();
|
||||
u->block_usec = BLOCK_USEC;
|
||||
|
||||
if (pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll) < 0) {
|
||||
pa_log("pa_thread_mq_init() failed.");
|
||||
|
|
@ -381,13 +382,15 @@ int pa__init(pa_module*m) {
|
|||
pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
|
||||
pa_sink_set_rtpoll(u->sink, u->rtpoll);
|
||||
|
||||
u->block_usec = BLOCK_USEC;
|
||||
nbytes = pa_usec_to_bytes(u->block_usec, &u->sink->sample_spec);
|
||||
|
||||
if(pa_modargs_get_value_boolean(ma, "norewinds", &u->norewinds) < 0){
|
||||
pa_log("Invalid argument, norewinds expects a boolean value.");
|
||||
}
|
||||
|
||||
if (u->norewinds)
|
||||
u->block_usec = BLOCK_USEC_NOREWINDS;
|
||||
|
||||
nbytes = pa_usec_to_bytes(u->block_usec, &u->sink->sample_spec);
|
||||
|
||||
if(u->norewinds){
|
||||
pa_sink_set_max_rewind(u->sink, 0);
|
||||
} else {
|
||||
|
|
@ -401,11 +404,7 @@ int pa__init(pa_module*m) {
|
|||
goto fail;
|
||||
}
|
||||
|
||||
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_set_latency_range(u->sink, 0, u->block_usec);
|
||||
|
||||
pa_sink_put(u->sink);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue