OutputThread: handle failing ReplayGainFilter::Open()

Since opening the PcmVolume object can now fail, this case must be
handled.
This commit is contained in:
Max Kellermann 2013-12-24 10:52:30 +01:00
parent 8edde7a4b3
commit 1732166328

View File

@ -96,10 +96,16 @@ ao_filter_open(struct audio_output *ao, AudioFormat &format,
assert(format.IsValid()); assert(format.IsValid());
/* the replay_gain filter cannot fail here */ /* the replay_gain filter cannot fail here */
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) if (ao->replay_gain_filter != nullptr)
ao->replay_gain_filter->Open(format, error_r); ao->replay_gain_filter->Close();
if (ao->other_replay_gain_filter != nullptr) return AudioFormat::Undefined();
ao->other_replay_gain_filter->Open(format, error_r); }
const AudioFormat af = ao->filter->Open(format, error_r); const AudioFormat af = ao->filter->Open(format, error_r);
if (!af.IsDefined()) { if (!af.IsDefined()) {