output/Source: reset the ReplayGain serials ion OpenFilter()

Each close/open cycle resets the Filter's state, because a new Filter
instance is being created.  That results in the serials
(replay_gain_serial and other_replay_gain_serial) being out of sync
with the internal ReplayGainFilter state.

So instead of initializing those serials once, we need to initialize
them each time we create new ReplayGainFilter instances, i.e. in
OpenFilter().

 https://bugs.musicpd.org/view.php?id=4632
This commit is contained in:
Max Kellermann 2017-01-23 17:55:04 +01:00
parent d91d5a3ab5
commit 5e93cfdd9e
3 changed files with 9 additions and 4 deletions

1
NEWS
View File

@ -1,6 +1,7 @@
ver 0.20.3 (not yet released)
* protocol
- "playlistadd" creates new playlist if it does not exist, as documented
* replay gain: don't reset ReplayGain levels when unpausing playback
* silence surround channels when converting from stereo
* use shortcuts such as "dsd64" in log messages

View File

@ -95,13 +95,17 @@ try {
assert(audio_format.IsValid());
/* the replay_gain filter cannot fail here */
if (prepared_replay_gain_filter != nullptr)
if (prepared_replay_gain_filter != nullptr) {
replay_gain_serial = 0;
replay_gain_filter_instance =
prepared_replay_gain_filter->Open(audio_format);
}
if (prepared_other_replay_gain_filter != nullptr)
if (prepared_other_replay_gain_filter != nullptr) {
other_replay_gain_serial = 0;
other_replay_gain_filter_instance =
prepared_other_replay_gain_filter->Open(audio_format);
}
filter_instance = prepared_filter->Open(audio_format);
} catch (...) {

View File

@ -64,13 +64,13 @@ class AudioOutputSource {
* The serial number of the last replay gain info. 0 means no
* replay gain info was available.
*/
unsigned replay_gain_serial = 0;
unsigned replay_gain_serial;
/**
* The serial number of the last replay gain info by the
* "other" chunk during cross-fading.
*/
unsigned other_replay_gain_serial = 0;
unsigned other_replay_gain_serial;
/**
* The replay_gain_filter_plugin instance of this audio