@@ -1089,7 +1089,8 @@ static size_t audio_pcm_hw_run_out(HWVoiceOut *hw, size_t live)
size_t clipped = 0;
while (live) {
- size_t size, decr, proc;
+ size_t size = live * hw->info.bytes_per_frame;
+ size_t decr, proc;
void *buf = hw->pcm_ops->get_buffer_out(hw, &size);
if (size == 0) {
@@ -130,13 +130,11 @@ static void *line_out_get_buffer(HWVoiceOut *hw, size_t *size)
}
if (out->frame) {
- *size = audio_rate_get_bytes(
- &hw->info, &out->rate,
- (out->fsize - out->fpos) * hw->info.bytes_per_frame);
- } else {
- audio_rate_start(&out->rate);
- *size = LINE_OUT_SAMPLES << 2;
+ *size = MIN((out->fsize - out->fpos) << 2, *size);
}
+
+ *size = audio_rate_get_bytes(&hw->info, &out->rate, *size);
+
return out->frame + out->fpos;
}