aboutsummaryrefslogtreecommitdiffstats
path: root/src/OutputThread.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-12-24 10:52:30 +0100
committerMax Kellermann <max@duempel.org>2013-12-24 10:52:33 +0100
commit1732166328f3e2db3d959b60bbe46f85d36d8e77 (patch)
tree364cc503f318d7cc6ea604160d0d825fd52e4aa9 /src/OutputThread.cxx
parent8edde7a4b3d652d0ac6ac3770369ddababe310a3 (diff)
downloadmpd-1732166328f3e2db3d959b60bbe46f85d36d8e77.tar.gz
mpd-1732166328f3e2db3d959b60bbe46f85d36d8e77.tar.xz
mpd-1732166328f3e2db3d959b60bbe46f85d36d8e77.zip
OutputThread: handle failing ReplayGainFilter::Open()
Since opening the PcmVolume object can now fail, this case must be handled.
Diffstat (limited to 'src/OutputThread.cxx')
-rw-r--r--src/OutputThread.cxx14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/OutputThread.cxx b/src/OutputThread.cxx
index c65309503..1a8c70196 100644
--- a/src/OutputThread.cxx
+++ b/src/OutputThread.cxx
@@ -96,10 +96,16 @@ ao_filter_open(struct audio_output *ao, AudioFormat &format,
assert(format.IsValid());
/* the replay_gain filter cannot fail here */
- if (ao->replay_gain_filter != nullptr)
- ao->replay_gain_filter->Open(format, error_r);
- if (ao->other_replay_gain_filter != nullptr)
- ao->other_replay_gain_filter->Open(format, error_r);
+ if (ao->replay_gain_filter != nullptr &&
+ !ao->replay_gain_filter->Open(format, error_r).IsDefined())
+ return AudioFormat::Undefined();
+
+ if (ao->other_replay_gain_filter != nullptr &&
+ !ao->other_replay_gain_filter->Open(format, error_r).IsDefined()) {
+ if (ao->replay_gain_filter != nullptr)
+ ao->replay_gain_filter->Close();
+ return AudioFormat::Undefined();
+ }
const AudioFormat af = ao->filter->Open(format, error_r);
if (!af.IsDefined()) {