Skip to content

Commit

Permalink
ao_audiotrack: change buffer sizing logic
Browse files Browse the repository at this point in the history
Previously number of channels was being ignored.

The buffer will now be between 75ms and 150ms

Signed-off-by: Aman Karmani <aman@tmm1.net>
  • Loading branch information
tmm1 authored and sfan5 committed Oct 21, 2021
1 parent fa691e0 commit 06392e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions audio/out/ao_audiotrack.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,8 @@ static int init(struct ao *ao)
return -1;
}

int min = 0.200 * p->samplerate * af_fmt_to_bytes(ao->format);
int max = min * 3 / 2;
int min = 0.075 * p->samplerate * af_fmt_to_bytes(ao->format) * ao->channels.num;
int max = min * 2;
p->size = MPCLAMP(buffer_size * 2, min, max);
MP_VERBOSE(ao, "Setting bufferSize = %d (driver=%d, min=%d, max=%d)\n", p->size, buffer_size, min, max);
ao->device_buffer = p->size / af_fmt_to_bytes(ao->format);
Expand Down

0 comments on commit 06392e7

Please sign in to comment.