Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/wineoss.drv/mmdevdrv.c | 45 +++++-------------------------------- dlls/wineoss.drv/oss.c | 45 +++++++++++++++++++++++++++++++++++++ dlls/wineoss.drv/unixlib.h | 9 ++++++++ 3 files changed, 60 insertions(+), 39 deletions(-)
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index 6498a4750d4..c921b4975c9 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -1442,52 +1442,19 @@ static HRESULT WINAPI AudioClock_GetPosition(IAudioClock *iface, UINT64 *pos, UINT64 *qpctime) { ACImpl *This = impl_from_IAudioClock(iface); - struct oss_stream *stream = This->stream; + struct get_position_params params;
TRACE("(%p)->(%p, %p)\n", This, pos, qpctime);
if(!pos) return E_POINTER;
- oss_lock(stream); - - if(stream->flow == eRender){ - *pos = stream->written_frames - stream->held_frames; - if(*pos < stream->last_pos_frames) - *pos = stream->last_pos_frames; - }else if(stream->flow == eCapture){ - audio_buf_info bi; - UINT32 held; - - if(ioctl(stream->fd, SNDCTL_DSP_GETISPACE, &bi) < 0){ - TRACE("GETISPACE failed: %d (%s)\n", errno, strerror(errno)); - held = 0; - }else{ - if(bi.bytes <= bi.fragsize) - held = 0; - else - held = bi.bytes / stream->fmt->nBlockAlign; - } - - *pos = stream->written_frames + held; - } - - stream->last_pos_frames = *pos; - - TRACE("returning: %s\n", wine_dbgstr_longlong(*pos)); - if(stream->share == AUDCLNT_SHAREMODE_SHARED) - *pos *= stream->fmt->nBlockAlign; - - oss_unlock(stream); - - if(qpctime){ - LARGE_INTEGER stamp, freq; - QueryPerformanceCounter(&stamp); - QueryPerformanceFrequency(&freq); - *qpctime = (stamp.QuadPart * (INT64)10000000) / freq.QuadPart; - } + params.stream = This->stream; + params.position = pos; + params.qpctime = qpctime; + OSS_CALL(get_position, ¶ms);
- return S_OK; + return params.result; }
static HRESULT WINAPI AudioClock_GetCharacteristics(IAudioClock *iface, diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c index 3a512c7cd9e..a39b0bc4f66 100644 --- a/dlls/wineoss.drv/oss.c +++ b/dlls/wineoss.drv/oss.c @@ -1272,6 +1272,50 @@ static NTSTATUS get_frequency(void *args) return oss_unlock_result(stream, ¶ms->result, S_OK); }
+static NTSTATUS get_position(void *args) +{ + struct get_position_params *params = args; + struct oss_stream *stream = params->stream; + UINT64 *pos = params->position, *qpctime = params->qpctime; + + oss_lock(stream); + + if(stream->flow == eRender){ + *pos = stream->written_frames - stream->held_frames; + if(*pos < stream->last_pos_frames) + *pos = stream->last_pos_frames; + }else if(stream->flow == eCapture){ + audio_buf_info bi; + UINT32 held; + + if(ioctl(stream->fd, SNDCTL_DSP_GETISPACE, &bi) < 0){ + TRACE("GETISPACE failed: %d (%s)\n", errno, strerror(errno)); + held = 0; + }else{ + if(bi.bytes <= bi.fragsize) + held = 0; + else + held = bi.bytes / stream->fmt->nBlockAlign; + } + + *pos = stream->written_frames + held; + } + + stream->last_pos_frames = *pos; + + TRACE("returning: %s\n", wine_dbgstr_longlong(*pos)); + if(stream->share == AUDCLNT_SHAREMODE_SHARED) + *pos *= stream->fmt->nBlockAlign; + + if(qpctime){ + LARGE_INTEGER stamp, freq; + NtQueryPerformanceCounter(&stamp, &freq); + *qpctime = (stamp.QuadPart * (INT64)10000000) / freq.QuadPart; + } + + return oss_unlock_result(stream, ¶ms->result, S_OK); +} + static NTSTATUS set_event_handle(void *args) { struct set_event_handle_params *params = args; @@ -1313,5 +1357,6 @@ unixlib_entry_t __wine_unix_call_funcs[] = get_current_padding, get_next_packet_size, get_frequency, + get_position, set_event_handle, }; diff --git a/dlls/wineoss.drv/unixlib.h b/dlls/wineoss.drv/unixlib.h index 9a544ae7899..982b11ec44f 100644 --- a/dlls/wineoss.drv/unixlib.h +++ b/dlls/wineoss.drv/unixlib.h @@ -200,6 +200,14 @@ struct get_frequency_params UINT64 *frequency; };
+struct get_position_params +{ + struct oss_stream *stream; + HRESULT result; + UINT64 *position; + UINT64 *qpctime; +}; + struct set_event_handle_params { struct oss_stream *stream; @@ -228,6 +236,7 @@ enum oss_funcs oss_get_current_padding, oss_get_next_packet_size, oss_get_frequency, + oss_get_position, oss_set_event_handle, };
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=112676
Your paranoid android.
=== debian11 (build log) ===
error: patch failed: dlls/wineoss.drv/oss.c:1243 error: patch failed: dlls/wineoss.drv/unixlib.h:186 error: patch failed: dlls/wineoss.drv/oss.c:1256 error: patch failed: dlls/wineoss.drv/unixlib.h:193 error: patch failed: dlls/wineoss.drv/oss.c:1272 error: patch failed: dlls/wineoss.drv/unixlib.h:200 Task: Patch failed to apply
=== debian11 (build log) ===
error: patch failed: dlls/wineoss.drv/oss.c:1243 error: patch failed: dlls/wineoss.drv/unixlib.h:186 error: patch failed: dlls/wineoss.drv/oss.c:1256 error: patch failed: dlls/wineoss.drv/unixlib.h:193 error: patch failed: dlls/wineoss.drv/oss.c:1272 error: patch failed: dlls/wineoss.drv/unixlib.h:200 Task: Patch failed to apply
Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Fri, Apr 15, 2022 at 09:40:41PM +0100, Huw Davies wrote:
Signed-off-by: Huw Davies huw@codeweavers.com
dlls/wineoss.drv/mmdevdrv.c | 45 +++++-------------------------------- dlls/wineoss.drv/oss.c | 45 +++++++++++++++++++++++++++++++++++++ dlls/wineoss.drv/unixlib.h | 9 ++++++++ 3 files changed, 60 insertions(+), 39 deletions(-)
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index 6498a4750d4..c921b4975c9 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -1442,52 +1442,19 @@ static HRESULT WINAPI AudioClock_GetPosition(IAudioClock *iface, UINT64 *pos, UINT64 *qpctime) { ACImpl *This = impl_from_IAudioClock(iface);
- struct oss_stream *stream = This->stream;
struct get_position_params params;
TRACE("(%p)->(%p, %p)\n", This, pos, qpctime);
if(!pos) return E_POINTER;
- oss_lock(stream);
- if(stream->flow == eRender){
*pos = stream->written_frames - stream->held_frames;
if(*pos < stream->last_pos_frames)
*pos = stream->last_pos_frames;
- }else if(stream->flow == eCapture){
audio_buf_info bi;
UINT32 held;
if(ioctl(stream->fd, SNDCTL_DSP_GETISPACE, &bi) < 0){
TRACE("GETISPACE failed: %d (%s)\n", errno, strerror(errno));
held = 0;
}else{
if(bi.bytes <= bi.fragsize)
held = 0;
else
held = bi.bytes / stream->fmt->nBlockAlign;
}
*pos = stream->written_frames + held;
- }
- stream->last_pos_frames = *pos;
- TRACE("returning: %s\n", wine_dbgstr_longlong(*pos));
- if(stream->share == AUDCLNT_SHAREMODE_SHARED)
*pos *= stream->fmt->nBlockAlign;
- oss_unlock(stream);
- if(qpctime){
LARGE_INTEGER stamp, freq;
QueryPerformanceCounter(&stamp);
QueryPerformanceFrequency(&freq);
*qpctime = (stamp.QuadPart * (INT64)10000000) / freq.QuadPart;
- }
- params.stream = This->stream;
- params.position = pos;
- params.qpctime = qpctime;
- OSS_CALL(get_position, ¶ms);
- return S_OK;
- return params.result;
}
static HRESULT WINAPI AudioClock_GetCharacteristics(IAudioClock *iface, diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c index 3a512c7cd9e..a39b0bc4f66 100644 --- a/dlls/wineoss.drv/oss.c +++ b/dlls/wineoss.drv/oss.c @@ -1272,6 +1272,50 @@ static NTSTATUS get_frequency(void *args) return oss_unlock_result(stream, ¶ms->result, S_OK); }
+static NTSTATUS get_position(void *args) +{
- struct get_position_params *params = args;
- struct oss_stream *stream = params->stream;
- UINT64 *pos = params->position, *qpctime = params->qpctime;
- oss_lock(stream);
- if(stream->flow == eRender){
*pos = stream->written_frames - stream->held_frames;
if(*pos < stream->last_pos_frames)
*pos = stream->last_pos_frames;
- }else if(stream->flow == eCapture){
audio_buf_info bi;
UINT32 held;
if(ioctl(stream->fd, SNDCTL_DSP_GETISPACE, &bi) < 0){
TRACE("GETISPACE failed: %d (%s)\n", errno, strerror(errno));
held = 0;
}else{
if(bi.bytes <= bi.fragsize)
held = 0;
else
held = bi.bytes / stream->fmt->nBlockAlign;
}
*pos = stream->written_frames + held;
- }
- stream->last_pos_frames = *pos;
- TRACE("returning: %s\n", wine_dbgstr_longlong(*pos));
- if(stream->share == AUDCLNT_SHAREMODE_SHARED)
*pos *= stream->fmt->nBlockAlign;
- if(qpctime){
LARGE_INTEGER stamp, freq;
NtQueryPerformanceCounter(&stamp, &freq);
*qpctime = (stamp.QuadPart * (INT64)10000000) / freq.QuadPart;
- }
- return oss_unlock_result(stream, ¶ms->result, S_OK);
+}
static NTSTATUS set_event_handle(void *args) { struct set_event_handle_params *params = args; @@ -1313,5 +1357,6 @@ unixlib_entry_t __wine_unix_call_funcs[] = get_current_padding, get_next_packet_size, get_frequency,
- get_position, set_event_handle,
}; diff --git a/dlls/wineoss.drv/unixlib.h b/dlls/wineoss.drv/unixlib.h index 9a544ae7899..982b11ec44f 100644 --- a/dlls/wineoss.drv/unixlib.h +++ b/dlls/wineoss.drv/unixlib.h @@ -200,6 +200,14 @@ struct get_frequency_params UINT64 *frequency; };
+struct get_position_params +{
- struct oss_stream *stream;
- HRESULT result;
- UINT64 *position;
- UINT64 *qpctime;
+};
struct set_event_handle_params { struct oss_stream *stream; @@ -228,6 +236,7 @@ enum oss_funcs oss_get_current_padding, oss_get_next_packet_size, oss_get_frequency,
- oss_get_position, oss_set_event_handle,
};
-- 2.25.1