Преглед изворни кода

libobs: Make sure to offset unpause audio data

When an unpause occurs, it takes an audio segment and splits it at the
exact point corresponding to the pause timestamp, and then it's supposed
to only send the ending part of the split.  However, the audio pointers
were not being incremented, therefore it was sending the front of the
audio segment to instead of the back of the audio segment by mistake.
jp9000 пре 6 година
родитељ
комит
1a72b04951
1 измењених фајлова са 6 додато и 0 уклоњено
  1. 6 0
      libobs/obs-encoder.c

+ 6 - 0
libobs/obs-encoder.c

@@ -1185,6 +1185,12 @@ static void unpause_audio(struct pause_data *pause, struct audio_data *data,
 	uint64_t cutoff_frames = pause->ts_end - data->timestamp;
 	cutoff_frames = ns_to_audio_frames(sample_rate, cutoff_frames);
 
+	for (size_t i = 0; i < MAX_AV_PLANES; i++) {
+		if (!data->data[i])
+			break;
+		data->data[i] += cutoff_frames * sizeof(float);
+	}
+
 	data->timestamp = pause->ts_start;
 	data->frames = data->frames - (uint32_t)cutoff_frames;
 	pause->ts_start = 0;