summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/sink-input.c
diff options
context:
space:
mode:
authorArun Raghavan <arun.raghavan@collabora.co.uk>2011-03-03 19:02:45 +0530
committerArun Raghavan <arun.raghavan@collabora.co.uk>2011-05-02 11:55:38 +0530
commitf94bcae6bd6a3021a9474de5703360817f1ec1a8 (patch)
treea49650a00a0a6cafd592c86425c4922225c2c242 /src/pulsecore/sink-input.c
parent4c9d53f3f50162e19ad7934e62c8f35453bdbfbc (diff)
core: Suspend monitor when a sink enters passthrough mode
In most cases it is expected that clients cannot consume compressed data from monitor sources, so we suspend the monitor source when the sink goes into passthrough mode. Eventually, when the extended API includes client notifications for changed formats, we should emit a notification on the monitor so that clients can decide what they want to do when this happens (disconnect or consume the data anyway).
Diffstat (limited to 'src/pulsecore/sink-input.c')
-rw-r--r--src/pulsecore/sink-input.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index 6e1b81f4..d77eb2ca 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -599,6 +599,10 @@ void pa_sink_input_unlink(pa_sink_input *i) {
if (i->sink->asyncmsgq)
pa_assert_se(pa_asyncmsgq_send(i->sink->asyncmsgq, PA_MSGOBJECT(i->sink), PA_SINK_MESSAGE_REMOVE_INPUT, i, 0, NULL) == 0);
+
+ /* We suspend the monitor if there was a passthrough sink, unsuspend now if required */
+ if (!pa_format_info_is_pcm(i->format) && i->sink->monitor_source)
+ pa_source_suspend(i->sink->monitor_source, FALSE, PA_SUSPEND_PASSTHROUGH);
}
reset_callbacks(i);
@@ -689,6 +693,10 @@ void pa_sink_input_put(pa_sink_input *i) {
set_real_ratio(i, &i->volume);
}
+ /* If we're entering passthrough mode, disable the monitor */
+ if (!pa_format_info_is_pcm(i->format) && i->sink->monitor_source)
+ pa_source_suspend(i->sink->monitor_source, TRUE, PA_SUSPEND_PASSTHROUGH);
+
i->thread_info.soft_volume = i->soft_volume;
i->thread_info.muted = i->muted;
@@ -1380,6 +1388,10 @@ int pa_sink_input_start_move(pa_sink_input *i) {
pa_assert_se(pa_asyncmsgq_send(i->sink->asyncmsgq, PA_MSGOBJECT(i->sink), PA_SINK_MESSAGE_START_MOVE, i, 0, NULL) == 0);
+ /* We suspend the monitor if there was a passthrough sink, unsuspend now if required */
+ if (!pa_format_info_is_pcm(i->format) && i->sink->monitor_source)
+ pa_source_suspend(i->sink->monitor_source, FALSE, PA_SUSPEND_PASSTHROUGH);
+
pa_sink_update_status(i->sink);
pa_cvolume_remap(&i->volume_factor_sink, &i->sink->channel_map, &i->channel_map);
i->sink = NULL;
@@ -1621,6 +1633,10 @@ int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, pa_bool_t save) {
pa_assert_se(pa_asyncmsgq_send(i->sink->asyncmsgq, PA_MSGOBJECT(i->sink), PA_SINK_MESSAGE_FINISH_MOVE, i, 0, NULL) == 0);
+ /* If we're entering passthrough mode, disable the monitor */
+ if (!pa_format_info_is_pcm(i->format) && i->sink->monitor_source)
+ pa_source_suspend(i->sink->monitor_source, TRUE, PA_SUSPEND_PASSTHROUGH);
+
pa_log_debug("Successfully moved sink input %i to %s.", i->index, dest->name);
/* Notify everyone */