Commit 73ca791a authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Create StreamRestore channel if none exists

backport plasma/plasma-pa@5bdd1368
parent 88ba6bae
Pipeline #95889 passed with stage
in 36 seconds
......@@ -94,6 +94,13 @@ qint64 StreamRestore::volume() const
void StreamRestore::setVolume(qint64 volume)
{
pa_cvolume vol = d->m_cache.valid ? d->m_cache.volume : d->m_volume;
// If no channel exists force one. We need one to be able to control the volume
// See https://bugs.kde.org/show_bug.cgi?id=407397
if (vol.channels == 0) {
vol.channels = 1;
}
for (int i = 0; i < vol.channels; ++i) {
vol.values[i] = volume;
}
......@@ -184,6 +191,13 @@ void StreamRestorePrivate::writeChanges(const pa_cvolume &volume, bool muted, co
info.device = deviceData.isEmpty() ? nullptr : deviceData.constData();
info.mute = muted;
// If no channel exists force one. We need one to be able to control the volume
// See https://bugs.kde.org/show_bug.cgi?id=407397
if (info.channel_map.channels == 0) {
info.channel_map.channels = 1;
info.channel_map.map[0] = PA_CHANNEL_POSITION_MONO;
}
m_cache.valid = true;
m_cache.volume = volume;
m_cache.muted = muted;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment