From 3b3fcf2bfa6015d890d42b5a528f7fe7476632f7 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 25 Nov 2014 13:15:09 -0600 Subject: More fixes to problems noted by cppcheck. Some are kind of risky; some are real bugs. --- nuttx/audio/pcm_decode.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'nuttx/audio') diff --git a/nuttx/audio/pcm_decode.c b/nuttx/audio/pcm_decode.c index 14e228a6d..b8808a2cb 100644 --- a/nuttx/audio/pcm_decode.c +++ b/nuttx/audio/pcm_decode.c @@ -442,8 +442,8 @@ static void pcm_subsample_configure(FAR struct pcm_decode_s *priv, if (priv->subsample == AUDIO_SUBSAMPLE_NONE) { - /* Ignore request to stop fast forwarding if we are already - * fast forwarding. + /* Ignore request to stop fast forwarding if we are already playing + * normally. */ if (subsample != AUDIO_SUBSAMPLE_NONE) @@ -460,24 +460,11 @@ static void pcm_subsample_configure(FAR struct pcm_decode_s *priv, } } - /* 2. Were already fast forwarding and we have been asked to change the - * sub-sampling rate. - */ - - else if (subsample != AUDIO_SUBSAMPLE_NONE) - { - /* Just save the current subsample setting. It will take effect - * on the next audio buffer that we receive. - */ - - priv->subsample = subsample; - } - - /* 3. We were already fast forwarding and we have been asked to return to + /* 2. We were already fast forwarding and we have been asked to return to * normal play. */ - else if (subsample != AUDIO_SUBSAMPLE_NONE) + else if (subsample == AUDIO_SUBSAMPLE_NONE) { audvdbg("Stop sub-sampling\n"); @@ -489,6 +476,19 @@ static void pcm_subsample_configure(FAR struct pcm_decode_s *priv, priv->skip = 0; priv->subsample = AUDIO_SUBSAMPLE_NONE; } + + /* 3. Were already fast forwarding and we have been asked to change the + * sub-sampling rate. + */ + + else if (priv->subsample != subsample) + { + /* Just save the new subsample setting. It will take effect on the + * next audio buffer that we receive. + */ + + priv->subsample = subsample; + } } #endif -- cgit v1.2.3