File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
shared-module/audiofilters Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -240,8 +240,21 @@ audioio_get_buffer_result_t audiofilters_filter_get_buffer(audiofilters_filter_o
240
240
}
241
241
}
242
242
243
- // If we have a sample, filter it
244
- if (self -> sample != NULL ) {
243
+ if (self -> sample == NULL ) {
244
+ if (self -> samples_signed ) {
245
+ memset (word_buffer , 0 , length * (self -> bits_per_sample / 8 ));
246
+ } else {
247
+ // For unsigned samples set to the middle which is "quiet"
248
+ if (MP_LIKELY (self -> bits_per_sample == 16 )) {
249
+ memset (word_buffer , 32768 , length * (self -> bits_per_sample / 8 ));
250
+ } else {
251
+ memset (hword_buffer , 128 , length * (self -> bits_per_sample / 8 ));
252
+ }
253
+ }
254
+
255
+ length = 0 ;
256
+ } else {
257
+ // we have a sample to play and filter
245
258
// Determine how many bytes we can process to our buffer, the less of the sample we have left and our buffer remaining
246
259
uint32_t n = MIN (self -> sample_buffer_length , length );
247
260
You can’t perform that action at this time.
0 commit comments