On 9/29/20 2:09 PM, Anton Baskanov wrote:
Signed-off-by: Anton Baskanov baskanov@gmail.com
dlls/amstream/ddrawstream.c | 31 +++- dlls/amstream/tests/amstream.c | 280 +++++++++++++++++++++++++++++++++ 2 files changed, 308 insertions(+), 3 deletions(-)
diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c index 972c2b9f4d0..9020828f578 100644 --- a/dlls/amstream/ddrawstream.c +++ b/dlls/amstream/ddrawstream.c @@ -1491,6 +1491,7 @@ static HRESULT WINAPI ddraw_sample_Update(IDirectDrawStreamSample *iface, } if (!sample->parent->peer || sample->parent->eos) {
}sample->update_hr = MS_S_ENDOFSTREAM; LeaveCriticalSection(&sample->parent->cs); return MS_S_ENDOFSTREAM;
@@ -1517,9 +1518,33 @@ static HRESULT WINAPI ddraw_sample_Update(IDirectDrawStreamSample *iface,
static HRESULT WINAPI ddraw_sample_CompletionStatus(IDirectDrawStreamSample *iface, DWORD flags, DWORD milliseconds) {
- FIXME("(%p)->(%x,%u): stub\n", iface, flags, milliseconds);
- struct ddraw_sample *sample = impl_from_IDirectDrawStreamSample(iface);
- HRESULT hr;
- return E_NOTIMPL;
- TRACE("sample %p, flags %#x, milliseconds %u.\n", sample, flags, milliseconds);
- EnterCriticalSection(&sample->parent->cs);
- if (sample->update_hr == MS_S_PENDING)
- {
if (flags & (COMPSTAT_NOUPDATEOK | COMPSTAT_ABORT))
{
sample->update_hr = MS_S_NOUPDATE;
remove_queued_update(sample);
}
else if (flags & COMPSTAT_WAIT)
{
LeaveCriticalSection(&sample->parent->cs);
WaitForSingleObject(sample->update_event, milliseconds);
EnterCriticalSection(&sample->parent->cs);
}
- }
- hr = sample->update_hr;
- LeaveCriticalSection(&sample->parent->cs);
- return hr;
}
This is another place where I think it would be a good idea to use a condition variable.
Could you please add a test with (COMPSTAT_NOUPDATEOK | COMPSTAT_WAIT, INFINITE) and (COMPSTAT_ABORT | COMPSTAT_WAIT, INFINITE), to show that the WAIT flag doesn't matter?