提交 e93aeaef 编写于 作者: J jp9000

libobs: Fix potential crash when transitioning

Sometimes the A and B sources of a transition would a large difference
in their timestamps, and the calculation of where to start the audio
data for one of the sources could be above the tick size, which could
cause a crash.
上级 4b158802
......@@ -738,6 +738,10 @@ static void process_audio(obs_source_t *transition, obs_source_t *child,
ts = child->audio_ts;
obs_source_get_audio_mix(child, &child_audio);
pos = (size_t)ns_to_audio_frames(sample_rate, ts - min_ts);
if (pos > AUDIO_OUTPUT_FRAMES)
return;
for (size_t mix_idx = 0; mix_idx < MAX_AUDIO_MIXES; mix_idx++) {
struct audio_output_data *output = &audio->output[mix_idx];
......@@ -746,8 +750,6 @@ static void process_audio(obs_source_t *transition, obs_source_t *child,
if ((mixers & (1 << mix_idx)) == 0)
continue;
pos = (size_t)ns_to_audio_frames(sample_rate, ts - min_ts);
for (size_t ch = 0; ch < channels; ch++) {
float *out = output->data[ch];
float *in = input->data[ch];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册