OSDN Git Service

audio utils: fix resampler bug
authorEric Laurent <elaurent@google.com>
Fri, 2 May 2014 16:20:08 +0000 (09:20 -0700)
committerEric Laurent <elaurent@google.com>
Fri, 2 May 2014 16:24:04 +0000 (09:24 -0700)
input and output frame counts passed to speex resampler
where not initialized by resampler_resample_from_input().

Bug: 14240418.
Change-Id: Ieaaea5986667abd01400775f36d12d09a2670841

audio_utils/resampler.c

index f3d0062..7282aa9 100644 (file)
@@ -156,7 +156,6 @@ int resampler_resample_from_input(struct resampler_itfe *resampler,
                                   size_t *outFrameCount)
 {
     struct resampler *rsmp = (struct resampler *)resampler;
-    spx_uint32_t inFrames, outFrames;
 
     if (rsmp == NULL || in == NULL || inFrameCount == NULL ||
             out == NULL || outFrameCount == NULL) {
@@ -171,20 +170,17 @@ int resampler_resample_from_input(struct resampler_itfe *resampler,
         speex_resampler_process_int(rsmp->speex_resampler,
                                     0,
                                     in,
-                                    &inFrames,
+                                    (spx_uint32_t *)inFrameCount,
                                     out,
-                                    &outFrames);
+                                    (spx_uint32_t *)outFrameCount);
     } else {
         speex_resampler_process_interleaved_int(rsmp->speex_resampler,
                                                 in,
-                                                &inFrames,
+                                                (spx_uint32_t *)inFrameCount,
                                                 out,
-                                                &outFrames);
+                                                (spx_uint32_t *)outFrameCount);
     }
 
-    *inFrameCount = inFrames;
-    *outFrameCount = outFrames;
-
     ALOGV("resampler_resample_from_input() DONE in %zu out %zu", *inFrameCount, *outFrameCount);
 
     return 0;