Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pulseaudio] For source, default timeout should be disconnection ASAP #15314

Merged
merged 2 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ private synchronized void startPipeWriteSynchronized() {
// task has been ended while writing
return;
}
logger.warn("InterruptedIOException while writing to from pulse source pipe: {}",
logger.warn("InterruptedIOException while writing from pulse source to pipe: {}",
getExceptionMessage(e));
} catch (IOException e) {
logger.warn("IOException while writing to from pulse source pipe: {}",
logger.warn("IOException while writing from pulse source to pipe: {}",
getExceptionMessage(e));
} catch (RuntimeException e) {
logger.warn("RuntimeException while writing to pulse source pipe: {}",
logger.warn("RuntimeException while writing from pulse source to pipe: {}",
getExceptionMessage(e));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,6 @@ private String sendRawRequest(String command) {
lc++;
if (retRead > 0) {
String line = new String(buff, 0, retRead);
// System.out.println("'"+line+"'");
if (line.endsWith(">>> ") && lc > 1) {
result += line.substring(0, line.length() - 4);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,13 @@ private void scheduleDisconnectIfNoClient() {
}
int idleTimeout = pulseaudioHandler.getIdleTimeout();
if (idleTimeout > -1) {
logger.debug("Scheduling next disconnect");
scheduledDisconnection = scheduler.schedule(this::disconnect, idleTimeout, TimeUnit.MILLISECONDS);
if (idleTimeout == 0) {
this.disconnect();
} else {
logger.debug("Scheduling next disconnect");
scheduledDisconnection = scheduler.schedule(this::disconnect, idleTimeout,
TimeUnit.MILLISECONDS);
}
}
}
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ thing-type.config.pulseaudio.sink.name.description = The name of one specific de
thing-type.config.pulseaudio.sink.simpleProtocolSOTimeout.label = Simple Protocol SO Timeout
thing-type.config.pulseaudio.sink.simpleProtocolSOTimeout.description = Socket SO timeout when connecting to pulseaudio server though module-simple-protocol-tcp. You can tune this option if the socket disconnect frequently.
thing-type.config.pulseaudio.sink.simpleProtocolSinkIdleTimeout.label = Idle Timeout
thing-type.config.pulseaudio.sink.simpleProtocolSinkIdleTimeout.description = Timeout in ms after which the connection will be closed when no stream is running. This ensures that your speaker is not on all the time and the pulseaudio sink can go to idle mode. -1 for no disconnection.
thing-type.config.pulseaudio.sink.simpleProtocolSinkIdleTimeout.description = Timeout in ms after which the connection will be closed when no stream is running. This ensures that your speaker is not on all the time and the pulseaudio sink can go to idle mode. -1 for no disconnection (improve latency). 0 for immediate disconnection.
thing-type.config.pulseaudio.sink.simpleProtocolSinkPort.label = Simple Protocol Port
thing-type.config.pulseaudio.sink.simpleProtocolSinkPort.description = Default Port to allocate for use by module-simple-protocol-tcp on the pulseaudio server
thing-type.config.pulseaudio.sinkInput.additionalFilters.label = Additional Filters
Expand All @@ -75,7 +75,7 @@ thing-type.config.pulseaudio.source.simpleProtocolSourceFormat.option.s24be = PC
thing-type.config.pulseaudio.source.simpleProtocolSourceFormat.option.s32le = PCM signed 32-bit little-endian
thing-type.config.pulseaudio.source.simpleProtocolSourceFormat.option.s32be = PCM signed 32-bit big-endian
thing-type.config.pulseaudio.source.simpleProtocolSourceIdleTimeout.label = Idle Timeout
thing-type.config.pulseaudio.source.simpleProtocolSourceIdleTimeout.description = Timeout in ms after which the connection will be closed when no stream is running. This ensures that your speaker is not on all the time and the pulseaudio source can go to idle mode. -1 for no disconnection.
thing-type.config.pulseaudio.source.simpleProtocolSourceIdleTimeout.description = Timeout in ms after which the connection will be closed when no stream is running. This ensures that your mic is not on all the time and the pulseaudio source can go to idle mode. -1 for no disconnection. 0 for immediate disconnection (recommended value to avoid capturing unwanted buffered audio).
thing-type.config.pulseaudio.source.simpleProtocolSourcePort.label = Simple Protocol Port
thing-type.config.pulseaudio.source.simpleProtocolSourcePort.description = Default Port to allocate to be used by module-simple-protocol-tcp on the pulseaudio server
thing-type.config.pulseaudio.source.simpleProtocolSourceRate.label = Simple Protocol Rate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
<parameter name="simpleProtocolSinkIdleTimeout" type="integer" required="false">
<label>Idle Timeout</label>
<description>Timeout in ms after which the connection will be closed when no stream is running. This ensures that
your speaker is not on all the time and the pulseaudio sink can go to idle mode. -1 for no disconnection.
your speaker is not on all the time and the pulseaudio sink can go to idle mode. -1 for no disconnection (improve
latency). 0 for immediate disconnection.
</description>
<default>30000</default>
</parameter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@
<default>4710</default>
</parameter>
<parameter name="simpleProtocolSourceIdleTimeout" type="integer" required="false">
<advanced>true</advanced>
<label>Idle Timeout</label>
<description>Timeout in ms after which the connection will be closed when no stream is running. This ensures that
your speaker is not on all the time and the pulseaudio source can go to idle mode. -1 for no disconnection.
your mic is not on all the time and the pulseaudio source can go to idle mode. -1 for no disconnection. 0 for
immediate disconnection (recommended value to avoid capturing unwanted buffered audio)
</description>
<default>30000</default>
<default>0</default>
</parameter>
<parameter name="simpleProtocolSourceFormat" type="text">
<label>Simple Protocol Format</label>
Expand Down