diff options
author | Georg Chini <georg@chini.tk> | 2017-04-11 21:49:11 +0200 |
---|---|---|
committer | Georg Chini <georg@chini.tk> | 2017-04-11 21:49:11 +0200 |
commit | d3d980ff497b8678fa54df9190a63f5563366d5d (patch) | |
tree | bde4306e858e4e700da96be28a6f317f7197516d /src | |
parent | 96cae04cedd1e0e4fd996cf9ea4f7519a21fdc71 (diff) |
loopback: Reset sink input rate when source or sink changes
If source or sink are changed, the current sink input rate may be different
from the default rate. Switch sink input rate back to default to avoid the
influence of the previous combination of source and sink.
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/module-loopback.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c index 2242c62c..2a0d7075 100644 --- a/src/modules/module-loopback.c +++ b/src/modules/module-loopback.c @@ -644,6 +644,11 @@ static void source_output_moving_cb(pa_source_output *o, pa_source *dest) { pa_asyncmsgq_send(u->sink_input->sink->asyncmsgq, PA_MSGOBJECT(u->sink_input), SINK_INPUT_MESSAGE_SOURCE_CHANGED, NULL, 0, NULL); else u->output_thread_info.push_called = false; + + /* The sampling rate may be far away from the default rate if we are still + * recovering from a previous source or sink change, so reset rate to + * default before moving the source. */ + pa_sink_input_set_rate(u->sink_input, u->source_output->sample_spec.rate); } /* Called from main thread */ @@ -1008,6 +1013,11 @@ static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) { u->output_thread_info.pop_called = false; u->output_thread_info.first_pop_done = false; + + /* Sample rate may be far away from the default rate if we are still + * recovering from a previous source or sink change, so reset rate to + * default before moving the sink. */ + pa_sink_input_set_rate(u->sink_input, u->source_output->sample_spec.rate); } /* Called from main thread */ |