mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 03:00:35 +00:00
audiomixer: Fix and simplify overlap calculation
This commit is contained in:
parent
a1f95f5625
commit
c29e04674a
1 changed files with 4 additions and 4 deletions
|
@ -1424,11 +1424,9 @@ gst_audio_mixer_mix_buffer (GstAudioMixer * audiomixer, GstCollectPads * pads,
|
||||||
else
|
else
|
||||||
out_start = 0;
|
out_start = 0;
|
||||||
|
|
||||||
if (audiomixer->offset + audiomixer->blocksize + adata->position / bpf <
|
|
||||||
adata->output_offset + adata->size / bpf + out_start)
|
|
||||||
overlap = audiomixer->blocksize - out_start;
|
|
||||||
else
|
|
||||||
overlap = adata->size / bpf - adata->position / bpf;
|
overlap = adata->size / bpf - adata->position / bpf;
|
||||||
|
if (overlap > audiomixer->blocksize - out_start)
|
||||||
|
overlap = audiomixer->blocksize - out_start;
|
||||||
|
|
||||||
inbuf = gst_collect_pads_peek (pads, collect_data);
|
inbuf = gst_collect_pads_peek (pads, collect_data);
|
||||||
g_assert (inbuf != NULL && inbuf == adata->buffer);
|
g_assert (inbuf != NULL && inbuf == adata->buffer);
|
||||||
|
@ -1441,6 +1439,8 @@ gst_audio_mixer_mix_buffer (GstAudioMixer * audiomixer, GstCollectPads * pads,
|
||||||
adata->output_offset += adata->size / bpf;
|
adata->output_offset += adata->size / bpf;
|
||||||
if (adata->position >= adata->size) {
|
if (adata->position >= adata->size) {
|
||||||
/* Buffer done, drop it */
|
/* Buffer done, drop it */
|
||||||
|
adata->position = 0;
|
||||||
|
adata->size = 0;
|
||||||
gst_buffer_replace (&adata->buffer, NULL);
|
gst_buffer_replace (&adata->buffer, NULL);
|
||||||
gst_buffer_unref (gst_collect_pads_pop (pads, collect_data));
|
gst_buffer_unref (gst_collect_pads_pop (pads, collect_data));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue