瀏覽代碼

media-playback: Fix null pointer dereference

Rob Howell 4 月之前
父節點
當前提交
2b613f40b4
共有 1 個文件被更改,包括 1 次插入2 次删除
  1. 1 2
      shared/media-playback/media-playback/media.c

+ 1 - 2
shared/media-playback/media-playback/media.c

@@ -348,7 +348,6 @@ void mp_media_next_audio(mp_media_t *m)
 	struct mp_decode *d = &m->a;
 	struct obs_source_audio audio = {0};
 	AVFrame *f = d->frame;
-	int channels = f->ch_layout.nb_channels;
 
 	if (!mp_media_can_play_frame(m, d))
 		return;
@@ -361,7 +360,7 @@ void mp_media_next_audio(mp_media_t *m)
 		audio.data[i] = f->data[i];
 
 	audio.samples_per_sec = f->sample_rate * m->speed / 100;
-	audio.speakers = convert_speaker_layout(channels);
+	audio.speakers = convert_speaker_layout(f->ch_layout.nb_channels);
 	audio.format = convert_sample_format(f->format);
 	audio.frames = f->nb_samples;
 	audio.timestamp = m->full_decode ? d->frame_pts