wineoss.drv: Don't skip over position updates of less than one fragment.

This commit is contained in:
Andrew Eikum 2015-04-01 12:20:41 -05:00 committed by Alexandre Julliard
parent 74471e857c
commit 932f392e08
1 changed files with 9 additions and 5 deletions

View File

@ -1393,7 +1393,7 @@ static void oss_write_data(ACImpl *This)
{ {
ssize_t written_bytes; ssize_t written_bytes;
UINT32 written_frames, in_oss_frames, write_limit, max_period, write_offs_frames, new_frames; UINT32 written_frames, in_oss_frames, write_limit, max_period, write_offs_frames, new_frames;
size_t to_write_frames, to_write_bytes, advanced; SIZE_T to_write_frames, to_write_bytes, advanced;
audio_buf_info bi; audio_buf_info bi;
BYTE *buf; BYTE *buf;
@ -1409,9 +1409,7 @@ static void oss_write_data(ACImpl *This)
bi.bytes, This->oss_bufsize_bytes); bi.bytes, This->oss_bufsize_bytes);
This->oss_bufsize_bytes = bi.bytes; This->oss_bufsize_bytes = bi.bytes;
in_oss_frames = 0; in_oss_frames = 0;
}else if(This->oss_bufsize_bytes - bi.bytes <= bi.fragsize) }else
in_oss_frames = 0;
else
in_oss_frames = (This->oss_bufsize_bytes - bi.bytes) / This->fmt->nBlockAlign; in_oss_frames = (This->oss_bufsize_bytes - bi.bytes) / This->fmt->nBlockAlign;
write_limit = 0; write_limit = 0;
@ -1433,6 +1431,8 @@ static void oss_write_data(ACImpl *This)
This->lcl_offs_frames %= This->bufsize_frames; This->lcl_offs_frames %= This->bufsize_frames;
This->held_frames -= advanced; This->held_frames -= advanced;
This->in_oss_frames = in_oss_frames; This->in_oss_frames = in_oss_frames;
TRACE("advanced by %lu, lcl_offs: %u, held: %u, in_oss: %u\n",
advanced, This->lcl_offs_frames, This->held_frames, This->in_oss_frames);
if(This->held_frames == This->in_oss_frames) if(This->held_frames == This->in_oss_frames)
@ -1448,7 +1448,9 @@ static void oss_write_data(ACImpl *This)
to_write_frames = min(to_write_frames, write_limit); to_write_frames = min(to_write_frames, write_limit);
to_write_bytes = to_write_frames * This->fmt->nBlockAlign; to_write_bytes = to_write_frames * This->fmt->nBlockAlign;
TRACE("going to write %lu frames from %u (%lu of %u)\n", to_write_frames,
write_offs_frames, to_write_frames + write_offs_frames,
This->bufsize_frames);
buf = This->local_buffer + write_offs_frames * This->fmt->nBlockAlign; buf = This->local_buffer + write_offs_frames * This->fmt->nBlockAlign;
@ -1479,6 +1481,8 @@ static void oss_write_data(ACImpl *This)
if(This->session->mute) if(This->session->mute)
silence_buffer(This, This->local_buffer, to_write_frames); silence_buffer(This, This->local_buffer, to_write_frames);
TRACE("wrapping to write %lu frames from beginning\n", to_write_frames);
written_bytes = write(This->fd, This->local_buffer, to_write_bytes); written_bytes = write(This->fd, This->local_buffer, to_write_bytes);
if(written_bytes < 0){ if(written_bytes < 0){
WARN("write failed: %d (%s)\n", errno, strerror(errno)); WARN("write failed: %d (%s)\n", errno, strerror(errno));