]> git.sesse.net Git - nageru/blobdiff - resampler.cpp
Make the resampler zero out samples on underrun instead of just leaving junk.
[nageru] / resampler.cpp
index efa0f178da950680fa55a5c2594b95abc754841c..ee0ab8788ef0acefb5b1099d43d776d2e9f142c7 100644 (file)
@@ -19,6 +19,7 @@
 #include "resampler.h"
 
 #include <stdio.h>
+#include <string.h>
 #include <math.h>
 #include <zita-resampler/vresampler.h>
 
@@ -114,6 +115,7 @@ void Resampler::get_output_samples(double pts, float *samples, ssize_t num_sampl
                        // or we're dropping a lot of data.
                        fprintf(stderr, "PANIC: Out of input samples to resample, still need %d output samples!\n",
                                int(vresampler.out_count));
+                       memset(vresampler.out_data, 0, vresampler.out_count * sizeof(float));
                        break;
                }