aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-26 14:12:10 +0200
committerMax Kellermann <max@duempel.org>2013-10-26 14:12:10 +0200
commit2098b94b47a60f6265dd5afb61757e9f6b7f9a6e (patch)
treeb038337e4d72840e70d7cfab044cbd405e7fbcae
parent59ad6265a170d8105183ac65bd6663d53124d360 (diff)
downloadmpd-2098b94b47a60f6265dd5afb61757e9f6b7f9a6e.tar.gz
mpd-2098b94b47a60f6265dd5afb61757e9f6b7f9a6e.tar.xz
mpd-2098b94b47a60f6265dd5afb61757e9f6b7f9a6e.zip
DecoderThread: move code to DecoderControl::CycleMixRamp()
-rw-r--r--src/DecoderControl.cxx7
-rw-r--r--src/DecoderControl.hxx7
-rw-r--r--src/DecoderThread.cxx4
3 files changed, 12 insertions, 6 deletions
diff --git a/src/DecoderControl.cxx b/src/DecoderControl.cxx
index ff6d1ad2d..cbe93361e 100644
--- a/src/DecoderControl.cxx
+++ b/src/DecoderControl.cxx
@@ -144,8 +144,11 @@ decoder_control::MixRampEnd(char *_mixramp_end)
}
void
-decoder_control::MixRampPrevEnd(char *_mixramp_prev_end)
+decoder_control::CycleMixRamp()
{
+ g_free(mixramp_start);
+ mixramp_start = nullptr;
g_free(mixramp_prev_end);
- mixramp_prev_end = _mixramp_prev_end;
+ mixramp_prev_end = mixramp_end;
+ mixramp_end = nullptr;
}
diff --git a/src/DecoderControl.hxx b/src/DecoderControl.hxx
index 47fb81c9a..c27177cbd 100644
--- a/src/DecoderControl.hxx
+++ b/src/DecoderControl.hxx
@@ -364,7 +364,12 @@ public:
void MixRampStart(char *_mixramp_start);
void MixRampEnd(char *_mixramp_end);
- void MixRampPrevEnd(char *_mixramp_prev_end);
+
+ /**
+ * Move mixramp_end to mixramp_prev_end and clear
+ * mixramp_start/mixramp_end.
+ */
+ void CycleMixRamp();
};
#endif
diff --git a/src/DecoderThread.cxx b/src/DecoderThread.cxx
index 7de6bf0d3..a018b3502 100644
--- a/src/DecoderThread.cxx
+++ b/src/DecoderThread.cxx
@@ -412,9 +412,7 @@ decoder_task(void *arg)
switch (dc.command) {
case DecoderCommand::START:
- dc.MixRampStart(nullptr);
- dc.MixRampPrevEnd(dc.mixramp_end);
- dc.mixramp_end = nullptr; /* Don't free, it's copied above. */
+ dc.CycleMixRamp();
dc.replay_gain_prev_db = dc.replay_gain_db;
dc.replay_gain_db = 0;