From 2098b94b47a60f6265dd5afb61757e9f6b7f9a6e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 26 Oct 2013 14:12:10 +0200 Subject: DecoderThread: move code to DecoderControl::CycleMixRamp() --- src/DecoderControl.cxx | 7 +++++-- src/DecoderControl.hxx | 7 ++++++- src/DecoderThread.cxx | 4 +--- 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; -- cgit v1.2.3