Просмотр исходного кода

Merge pull request #996 from twitchalerts/audio-subsystem-crash-fix

libobs: Fix a potential divide by zero crash
Jim 8 лет назад
Родитель
Сommit
48cc90d5bb
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      libobs/obs-source.c

+ 3 - 0
libobs/obs-source.c

@@ -1047,6 +1047,9 @@ void obs_source_video_tick(obs_source_t *source, float seconds)
 static inline uint64_t conv_frames_to_time(const size_t sample_rate,
 		const size_t frames)
 {
+	if (!sample_rate)
+		return 0;
+	
 	return (uint64_t)frames * 1000000000ULL / (uint64_t)sample_rate;
 }