Fixes a pretty bad stereo bug in test_opus
authorJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Sat, 13 Aug 2011 05:44:09 +0000 (01:44 -0400)
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Sat, 13 Aug 2011 05:44:09 +0000 (01:44 -0400)
src/test_opus.c

index c1db8d7..d1476d6 100644 (file)
@@ -339,9 +339,9 @@ int main(int argc, char *argv[])
             if (feof(fin))
                 break;
         } else {
-            err = fread(in, sizeof(short), frame_size*channels, fin);
+            err = fread(in, sizeof(short)*channels, frame_size, fin);
             curr_read = err;
-            if (curr_read < frame_size*channels)
+            if (curr_read < frame_size)
             {
                 int i;
                 for (i=curr_read*channels;i<frame_size*channels;i++)
@@ -384,7 +384,7 @@ int main(int argc, char *argv[])
                 }
                 if (output_samples>0)
                 {
-                    fwrite(out+skip, sizeof(short), output_samples-skip*channels, fout);
+                    fwrite(out+skip, sizeof(short)*channels, output_samples-skip, fout);
                     skip = 0;
                 }
             }