From aa52ca90574b85bef52cbb8d9999ce097f73ab2b Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Thu, 19 Feb 2009 05:48:51 +0000 Subject: [PATCH] - If the current irp buffer is finished, set the state to pause (fixes looping of last sample) - Use KeSetTimer if Irql is below equal DISPATCH_LEVEL svn path=/trunk/; revision=39675 --- .../wdm/audio/backpln/portcls/pin_wavecyclic.c | 13 ++++++++++--- .../wdm/audio/backpln/portcls/service_group.c | 7 +++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c b/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c index 48a060aad65..30bc29400ad 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c +++ b/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c @@ -105,9 +105,10 @@ IServiceSink_fnRequestService( NTSTATUS Status; IPortPinWaveCyclicImpl * This = (IPortPinWaveCyclicImpl*)CONTAINING_RECORD(iface, IPortPinWaveCyclicImpl, lpVtblServiceSink); -#if 0 + if (This->ActiveIrp && This->ActiveIrpOffset >= This->ActiveIrpBufferSize) { + This->Stream->lpVtbl->SetState(This->Stream, KSSTATE_PAUSE); if (KeGetCurrentIrql() > DISPATCH_LEVEL) { if (This->DelayedRequestInProgress) @@ -140,7 +141,6 @@ IServiceSink_fnRequestService( return; } } -#endif if (!This->ActiveIrp) { @@ -186,7 +186,8 @@ IServiceSink_fnRequestService( } else { - This->Stream->lpVtbl->Silence(This->Stream, (PUCHAR)This->CommonBuffer + This->CommonBufferOffset, BytesToCopy); + This->Stream->lpVtbl->SetState(This->Stream, KSSTATE_PAUSE); + return; } BufferLength = Position; IrpLength = This->ActiveIrpBufferSize - This->ActiveIrpOffset; @@ -210,6 +211,12 @@ IServiceSink_fnRequestService( BytesToCopy = min(BufferLength, IrpLength); DPRINT1("Copying %u Remaining %u\n", BytesToCopy, IrpLength); + if (!BytesToCopy) + { + This->Stream->lpVtbl->SetState(This->Stream, KSSTATE_PAUSE); + return; + } + This->DmaChannel->lpVtbl->CopyTo(This->DmaChannel, (PUCHAR)This->CommonBuffer + This->CommonBufferOffset, (PUCHAR)This->ActiveIrpBuffer + This->ActiveIrpOffset, diff --git a/reactos/drivers/wdm/audio/backpln/portcls/service_group.c b/reactos/drivers/wdm/audio/backpln/portcls/service_group.c index 89fda2ed130..7237cbb4d29 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/service_group.c +++ b/reactos/drivers/wdm/audio/backpln/portcls/service_group.c @@ -211,8 +211,11 @@ IServiceGroup_fnRequestDelayedService( if (This->Initialized) { - //KeSetTimer(&This->Timer, DueTime, &This->Dpc); - KeInsertQueueDpc(&This->Dpc, NULL, NULL); + if (KeGetCurrentIrql() <= DISPATCH_LEVEL) + KeSetTimer(&This->Timer, DueTime, &This->Dpc); + else + KeInsertQueueDpc(&This->Dpc, NULL, NULL); + KeClearEvent(&This->DpcEvent); } }