mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[pulseaudio] For source, default timeout should be disconnection ASAP (#15314)
* [pulseaudio] For source, default timeout should be disconnection ASAP To avoid weird behaviour, such as pulseaudio server storing audio data between inputstream get/read and then sending the backlog all at once when finally reading, we must disconnect immediately thereafter. --------- Signed-off-by: Gwendal Roulleau <gwendal.roulleau@gmail.com> Co-authored-by: Gwendal Roulleau <gwendal.roulleau@gmail.com>
This commit is contained in:
parent
e057e79d2a
commit
f98ed3fc22
@ -162,13 +162,13 @@ public class PulseAudioAudioSource extends PulseaudioSimpleProtocolStream implem
|
||||
// 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));
|
||||
}
|
||||
}
|
||||
|
@ -637,7 +637,6 @@ public class PulseaudioClient {
|
||||
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;
|
||||
|
@ -101,8 +101,13 @@ public abstract class PulseaudioSimpleProtocolStream {
|
||||
}
|
||||
int idleTimeout = pulseaudioHandler.getIdleTimeout();
|
||||
if (idleTimeout > -1) {
|
||||
if (idleTimeout == 0) {
|
||||
this.disconnect();
|
||||
} else {
|
||||
logger.debug("Scheduling next disconnect");
|
||||
scheduledDisconnection = scheduler.schedule(this::disconnect, idleTimeout, TimeUnit.MILLISECONDS);
|
||||
scheduledDisconnection = scheduler.schedule(this::disconnect, idleTimeout,
|
||||
TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
|
@ -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
|
||||
@ -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
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user