libobs: Clamp audio NaN to 0.0f
Add comparison check so that NaN is caught. Comparisons with NaN always result in false. NaNs cause problems later in audio encoder. Note: may break with -ffast-math compiler flag. Fixes #4885.
This commit is contained in:
parent
56264befab
commit
06f66f3120
@ -145,6 +145,7 @@ static inline void clamp_audio_output(struct audio_output *audio, size_t bytes)
|
||||
|
||||
while (mix_data < mix_end) {
|
||||
float val = *mix_data;
|
||||
val = (val == val) ? val : 0.0f;
|
||||
val = (val > 1.0f) ? 1.0f : val;
|
||||
val = (val < -1.0f) ? -1.0f : val;
|
||||
*(mix_data++) = val;
|
||||
|
Loading…
x
Reference in New Issue
Block a user