When I use the KeWaitForSingleObject to wait for the buffering to complete, the
blue screen will occur. How do I resolve it
//=============================================================================
STDMETHODIMP_(void)
WaveStream::CopyFrom
(
IN PVOID Destination,
IN PVOID Source,
IN ULONG ByteCount
)
/*++
Routine Description:
The CopyFrom function copies sample data from the DMA buffer.
Callers of CopyFrom can run at any IRQL
Arguments:
Destination - Points to the destination buffer.
Source - Points to the source buffer.
ByteCount - Points to the source buffer.
Return Value:
void
--*/
{
UNREFERENCED_PARAMETER(Destination);
UNREFERENCED_PARAMETER(Source);
UNREFERENCED_PARAMETER(ByteCount);
ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL);
LARGE_INTEGER timeout;
timeout.QuadPart = -100000 * 10;
_data_trans_t* dt = (_data_trans_t*)this->m_pOwner->m_hDataTrans;
if (dt->data_len < ByteCount) {
dt->req_size = ByteCount - dt->data_len;
DPT("wait buffer...");
KeWaitForSingleObject(
&dt->event,
Executive,
KernelMode,
FALSE,
&timeout
);
}
//dt->req_size = 0;
data_transfer_record(this->m_pOwner->m_hDataTrans, Destination, ByteCount,
&m_ulDmaPosition);
//ULONG remind = ByteCount,size=0;
//while (remind > 0) {
////DPT("IDmaChannel::CopyFrom ByteCount=%lu", ByteCount);
//size = remind - 4800 > 0 ? 4800 : remind;
//remind -= size;
//_data_trans_t* dt = (_data_trans_t*)this->m_pOwner->m_hDataTrans;
//if (dt->data_len < size) {
//dt->req_size = size;
//KeWaitForSingleObject(&dt->event, Executive, KernelMode, FALSE, &timeout);
//KeResetEvent(&dt->event);
//}
//dt->req_size = 0;
//data_transfer_record(this->m_pOwner->m_hDataTrans, Destination, size);
//
//}
}
At 2018-10-29 16:15:47, "何海洲" <hehaizhou8888@xxxxxxx> wrote:
Hi all:
I have recently been developing an ASIO & WDM audio driver, which is modified
by msvad routine. Most of the functions have been completed. Now when I
encounter the recording call CopyFrom copying samples from the circular buffer,
noise will be generated whenever I encounter insufficient buffering.