Author: janderwald
Date: Fri Dec 10 11:03:28 2010
New Revision: 50001
URL:
http://svn.reactos.org/svn/reactos?rev=50001&view=rev
Log:
[AUDIO-BRINGUP]
- Implement a timeout handler, which detects whether the audio thread has hung. The code
has not yet been activated
- Remove unused members
Modified:
branches/audio-bringup/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp
branches/audio-bringup/drivers/wdm/audio/backpln/portcls/pin_wavepci.cpp
Modified: branches/audio-bringup/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/audio-bringup/drivers/wdm/audio…
==============================================================================
--- branches/audio-bringup/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp
[iso-8859-1] (original)
+++ branches/audio-bringup/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp
[iso-8859-1] Fri Dec 10 11:03:28 2010
@@ -48,6 +48,7 @@
friend NTSTATUS NTAPI PinWaveCyclicAddEndOfStreamEvent(IN PIRP Irp, IN PKSEVENTDATA
EventData, IN PKSEVENT_ENTRY EventEntry);
friend NTSTATUS NTAPI PinWaveCyclicAddLoopedStreamEvent(IN PIRP Irp, IN PKSEVENTDATA
EventData, IN PKSEVENT_ENTRY EventEntry);
friend VOID CALLBACK PinSetStateWorkerRoutine(IN PDEVICE_OBJECT DeviceObject, IN
PVOID Context);
+ friend VOID NTAPI PinWaveCyclicIoTimerRoutine(IN PDEVICE_OBJECT DeviceObject, IN
PVOID Context);
IPortWaveCyclic * m_Port;
IPortFilterWaveCyclic * m_Filter;
@@ -69,8 +70,7 @@
ULONG m_FrameSize;
BOOL m_Capture;
- ULONG m_TotalPackets;
- ULONG m_StopCount;
+ ULONGLONG m_TotalPackets;
KSAUDIO_POSITION m_Position;
KSALLOCATOR_FRAMING m_AllocatorFraming;
PSUBDEVICE_DESCRIPTOR m_Descriptor;
@@ -81,6 +81,12 @@
KSRESET m_ResetState;
ULONG m_Delay;
+
+ ULONGLONG m_GlitchCount;
+ ULONGLONG m_GlitchLength;
+
+ LARGE_INTEGER m_LastPacketTime;
+ BOOLEAN m_Started;
LONG m_Ref;
};
@@ -106,7 +112,7 @@
NTSTATUS NTAPI PinWaveCyclicAddEndOfStreamEvent(IN PIRP Irp, IN PKSEVENTDATA EventData,
IN PKSEVENT_ENTRY EventEntry);
NTSTATUS NTAPI PinWaveCyclicAddLoopedStreamEvent(IN PIRP Irp, IN PKSEVENTDATA EventData,
IN PKSEVENT_ENTRY EventEntry);
NTSTATUS NTAPI PinWaveCyclicDRMHandler(IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT
PVOID Data);
-
+VOID NTAPI PinWaveCyclicIoTimerRoutine(IN PDEVICE_OBJECT DeviceObject, IN PVOID
Context);
DEFINE_KSPROPERTY_CONNECTIONSET(PinWaveCyclicConnectionSet, PinWaveCyclicState,
PinWaveCyclicDataFormat, PinWaveCyclicAllocatorFraming);
DEFINE_KSPROPERTY_AUDIOSET(PinWaveCyclicAudioSet, PinWaveCyclicAudioPosition);
@@ -175,6 +181,7 @@
//==================================================================================================================================
+
NTSTATUS
NTAPI
CPortPinWaveCyclic::QueryInterface(
@@ -199,182 +206,6 @@
}
return STATUS_UNSUCCESSFUL;
-}
-
-NTSTATUS
-NTAPI
-PinWaveCyclicDRMHandler(
- IN PIRP Irp,
- IN PKSIDENTIFIER Request,
- IN OUT PVOID Data)
-{
- DPRINT1("PinWaveCyclicDRMHandler\n");
- ASSERT(0);
- return STATUS_INVALID_PARAMETER;
-}
-
-
-NTSTATUS
-NTAPI
-PinWaveCyclicAddEndOfStreamEvent(
- IN PIRP Irp,
- IN PKSEVENTDATA EventData,
- IN PKSEVENT_ENTRY EventEntry)
-{
- PENDOFSTREAM_EVENT_CONTEXT Entry;
- PSUBDEVICE_DESCRIPTOR Descriptor;
- CPortPinWaveCyclic *Pin;
-
- // get sub device descriptor
- Descriptor = (PSUBDEVICE_DESCRIPTOR)KSPROPERTY_ITEM_IRP_STORAGE(Irp);
-
- // sanity check
- PC_ASSERT(Descriptor);
- PC_ASSERT(Descriptor->PortPin);
- PC_ASSERT_IRQL(DISPATCH_LEVEL);
-
- // cast to pin impl
- Pin = (CPortPinWaveCyclic*)Descriptor->PortPin;
-
- // get extra size
- Entry = (PENDOFSTREAM_EVENT_CONTEXT)(EventEntry + 1);
-
- // not a looped event
- Entry->bLoopedStreaming = FALSE;
-
- // insert item
- (void)ExInterlockedInsertTailList(&Pin->m_EventList,
&EventEntry->ListEntry, &Pin->m_EventListLock);
-
- // done
- return STATUS_SUCCESS;
-}
-
-NTSTATUS
-NTAPI
-PinWaveCyclicAddLoopedStreamEvent(
- IN PIRP Irp,
- IN PKSEVENTDATA EventData,
- IN PKSEVENT_ENTRY EventEntry)
-{
- PLOOPEDSTREAMING_POSITION_EVENT_DATA Data;
- PLOOPEDSTREAMING_EVENT_CONTEXT Entry;
- PSUBDEVICE_DESCRIPTOR Descriptor;
- CPortPinWaveCyclic *Pin;
-
- // get sub device descriptor
- Descriptor = (PSUBDEVICE_DESCRIPTOR)KSEVENT_ITEM_IRP_STORAGE(Irp);
-
- // sanity check
- PC_ASSERT(Descriptor);
- PC_ASSERT(Descriptor->PortPin);
- PC_ASSERT_IRQL(DISPATCH_LEVEL);
-
- // cast to pin impl
- Pin = (CPortPinWaveCyclic*)Descriptor->PortPin;
-
- // cast to looped event
- Data = (PLOOPEDSTREAMING_POSITION_EVENT_DATA)EventData;
-
- // get extra size
- Entry = (PLOOPEDSTREAMING_EVENT_CONTEXT)(EventEntry + 1);
-
- Entry->bLoopedStreaming = TRUE;
- Entry->Position = Data->Position;
-
- DPRINT1("Added event\n");
-
- // insert item
- (void)ExInterlockedInsertTailList(&Pin->m_EventList,
&EventEntry->ListEntry, &Pin->m_EventListLock);
-
- // done
- return STATUS_SUCCESS;
-}
-
-NTSTATUS
-NTAPI
-PinWaveCyclicAllocatorFraming(
- IN PIRP Irp,
- IN PKSIDENTIFIER Request,
- IN OUT PVOID Data)
-{
- CPortPinWaveCyclic *Pin;
- PSUBDEVICE_DESCRIPTOR Descriptor;
-
- // get sub device descriptor
- Descriptor = (PSUBDEVICE_DESCRIPTOR)KSEVENT_ITEM_IRP_STORAGE(Irp);
-
- // sanity check
- PC_ASSERT(Descriptor);
- PC_ASSERT(Descriptor->PortPin);
- PC_ASSERT_IRQL(DISPATCH_LEVEL);
-
- // cast to pin impl
- Pin = (CPortPinWaveCyclic*)Descriptor->PortPin;
-
-
- if (Request->Flags & KSPROPERTY_TYPE_GET)
- {
- // copy pin framing
- RtlMoveMemory(Data, &Pin->m_AllocatorFraming,
sizeof(KSALLOCATOR_FRAMING));
-
- Irp->IoStatus.Information = sizeof(KSALLOCATOR_FRAMING);
- return STATUS_SUCCESS;
- }
-
- // not supported
- return STATUS_NOT_SUPPORTED;
-}
-
-NTSTATUS
-NTAPI
-PinWaveCyclicAudioPosition(
- IN PIRP Irp,
- IN PKSIDENTIFIER Request,
- IN OUT PVOID Data)
-{
- CPortPinWaveCyclic *Pin;
- PSUBDEVICE_DESCRIPTOR Descriptor;
- PKSAUDIO_POSITION Position;
-
- // get sub device descriptor
- Descriptor = (PSUBDEVICE_DESCRIPTOR)KSPROPERTY_ITEM_IRP_STORAGE(Irp);
-
- // sanity check
- PC_ASSERT(Descriptor);
- PC_ASSERT(Descriptor->PortPin);
- PC_ASSERT_IRQL(DISPATCH_LEVEL);
-
- // cast to pin impl
- Pin = (CPortPinWaveCyclic*)Descriptor->PortPin;
-
- //sanity check
- PC_ASSERT(Pin->m_Stream);
-
- if (Request->Flags & KSPROPERTY_TYPE_GET)
- {
- // FIXME non multithreading-safe
- // copy audio position
-
- Position = (PKSAUDIO_POSITION)Data;
-
- if (Pin->m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_STREAMING)
- {
- RtlMoveMemory(Data, &Pin->m_Position, sizeof(KSAUDIO_POSITION));
- DPRINT("Play %lu Record %lu\n", Pin->m_Position.PlayOffset,
Pin->m_Position.WriteOffset);
- }
- else if (Pin->m_ConnectDetails->Interface.Id ==
KSINTERFACE_STANDARD_LOOPED_STREAMING)
- {
- Position->PlayOffset = Pin->m_Position.PlayOffset;
- Position->WriteOffset =
(ULONGLONG)Pin->m_IrpQueue->GetCurrentIrpOffset();
- DPRINT("Play %lu Write %lu\n", Position->PlayOffset,
Position->WriteOffset);
- }
-
- Irp->IoStatus.Information = sizeof(KSAUDIO_POSITION);
- return STATUS_SUCCESS;
- }
-
- // not supported
- return STATUS_NOT_SUPPORTED;
}
typedef struct
@@ -408,17 +239,41 @@
{
/* FIXME complete pending irps with successfull state */
PinWorkContext->Pin->m_IrpQueue->CancelBuffers();
- }
- //HACK
- //PinWorkContext->Pin->m_IrpQueue->CancelBuffers();
+
PinWorkContext->Pin->m_Stream->Silence(PinWorkContext->Pin->m_CommonBuffer,
PinWorkContext->Pin->m_CommonBufferSize);
+ PinWorkContext->Pin->m_IrpQueue->CancelBuffers();
+ PinWorkContext->Pin->m_Position.PlayOffset = 0;
+ PinWorkContext->Pin->m_Position.WriteOffset = 0;
+ PinWorkContext->Pin->m_GlitchCount = 0;
+ PinWorkContext->Pin->m_GlitchLength = 0;
+
+ // unregister the time out
+ PcUnregisterIoTimeout(GetDeviceObject(PinWorkContext->Pin->m_Port),
PinWaveCyclicIoTimerRoutine, (PVOID)PinWorkContext->Pin);
+ }
+ else if (PinWorkContext->Pin->m_ConnectDetails->Interface.Id ==
KSINTERFACE_STANDARD_STREAMING && PinWorkContext->Pin->m_State ==
KSSTATE_STOP)
+ {
+ /* FIXME complete pending irps with successfull state */
+ PinWorkContext->Pin->m_IrpQueue->CancelBuffers();
+
PinWorkContext->Pin->m_Stream->Silence(PinWorkContext->Pin->m_CommonBuffer,
PinWorkContext->Pin->m_CommonBufferSize);
+ PinWorkContext->Pin->m_IrpQueue->CancelBuffers();
+ PinWorkContext->Pin->m_Position.PlayOffset = 0;
+ PinWorkContext->Pin->m_Position.WriteOffset = 0;
+ PinWorkContext->Pin->m_GlitchCount = 0;
+ PinWorkContext->Pin->m_GlitchLength = 0;
+
+ // unregister the time out
+ PcUnregisterIoTimeout(GetDeviceObject(PinWorkContext->Pin->m_Port),
PinWaveCyclicIoTimerRoutine, (PVOID)PinWorkContext->Pin);
+ }
}
// store result
- PinWorkContext->Irp->IoStatus.Information = sizeof(KSSTATE);
- PinWorkContext->Irp->IoStatus.Status = Status;
-
- // complete irp
- IoCompleteRequest(PinWorkContext->Irp, IO_NO_INCREMENT);
+ if (PinWorkContext->Irp)
+ {
+ PinWorkContext->Irp->IoStatus.Information = sizeof(KSSTATE);
+ PinWorkContext->Irp->IoStatus.Status = Status;
+
+ // complete irp
+ IoCompleteRequest(PinWorkContext->Irp, IO_NO_INCREMENT);
+ }
// free work item
IoFreeWorkItem(PinWorkContext->WorkItem);
@@ -428,6 +283,244 @@
}
+VOID
+NTAPI
+PinWaveCyclicIoTimerRoutine(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PVOID Context)
+{
+ CPortPinWaveCyclic *Pin;
+ //PSETPIN_CONTEXT Ctx;
+ LARGE_INTEGER CurrentTime;
+
+ // cast to pin impl
+ Pin = (CPortPinWaveCyclic*)Context;
+
+ /* query system time */
+ KeQuerySystemTime(&CurrentTime);
+
+ /* check if the connection matches */
+ if (Pin->m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_STREAMING
&& Pin->m_ResetState == KSRESET_END && Pin->m_State != KSSTATE_STOP
&& Pin->m_Started)
+ {
+ LARGE_INTEGER Diff;
+
+ Diff.QuadPart = CurrentTime.QuadPart - Pin->m_LastPacketTime.QuadPart;
+
+ if (Diff.QuadPart >= Int32x32To64(3000, 10000))
+ {
+ DPRINT1("AudioThread Hang detected: Last Packet %I64u CurrentTime %I64u
Diff %I64u\n", Pin->m_LastPacketTime.QuadPart, CurrentTime.QuadPart,
Diff.QuadPart);
+#if 0
+ /* allocate pin context */
+ Ctx = (PSETPIN_CONTEXT)AllocateItem(NonPagedPool, sizeof(SETPIN_CONTEXT),
TAG_PORTCLASS);
+
+ if (!Ctx)
+ {
+ /* no memory */
+ return;
+ }
+
+ /* initialize ctx */
+ Ctx->Pin = Pin;
+ if (Pin->m_State == KSSTATE_RUN)
+ Ctx->NewState = KSSTATE_PAUSE;
+ else if (Pin->m_State == KSSTATE_PAUSE)
+ Ctx->NewState = KSSTATE_ACQUIRE;
+ else if (Pin->m_State == KSSTATE_ACQUIRE)
+ Ctx->NewState = KSSTATE_STOP;
+
+ Ctx->WorkItem = IoAllocateWorkItem(DeviceObject);
+ Ctx->Irp = NULL;
+
+ if (!Ctx->WorkItem)
+ {
+ /* no memory */
+ FreeItem(Ctx, TAG_PORTCLASS);
+ return;
+ }
+
+ /* queue the work item */
+ IoQueueWorkItem(Ctx->WorkItem, PinSetStateWorkerRoutine, DelayedWorkQueue,
(PVOID)Ctx);
+#endif
+ }
+ }
+}
+
+
+NTSTATUS
+NTAPI
+PinWaveCyclicDRMHandler(
+ IN PIRP Irp,
+ IN PKSIDENTIFIER Request,
+ IN OUT PVOID Data)
+{
+ DPRINT1("PinWaveCyclicDRMHandler\n");
+ ASSERT(0);
+ return STATUS_INVALID_PARAMETER;
+}
+
+
+NTSTATUS
+NTAPI
+PinWaveCyclicAddEndOfStreamEvent(
+ IN PIRP Irp,
+ IN PKSEVENTDATA EventData,
+ IN PKSEVENT_ENTRY EventEntry)
+{
+ PENDOFSTREAM_EVENT_CONTEXT Entry;
+ PSUBDEVICE_DESCRIPTOR Descriptor;
+ CPortPinWaveCyclic *Pin;
+
+ // get sub device descriptor
+ Descriptor = (PSUBDEVICE_DESCRIPTOR)KSPROPERTY_ITEM_IRP_STORAGE(Irp);
+
+ // sanity check
+ PC_ASSERT(Descriptor);
+ PC_ASSERT(Descriptor->PortPin);
+ PC_ASSERT_IRQL(DISPATCH_LEVEL);
+
+ // cast to pin impl
+ Pin = (CPortPinWaveCyclic*)Descriptor->PortPin;
+
+ // get extra size
+ Entry = (PENDOFSTREAM_EVENT_CONTEXT)(EventEntry + 1);
+
+ // not a looped event
+ Entry->bLoopedStreaming = FALSE;
+
+ // insert item
+ (void)ExInterlockedInsertTailList(&Pin->m_EventList,
&EventEntry->ListEntry, &Pin->m_EventListLock);
+
+ // done
+ return STATUS_SUCCESS;
+}
+
+NTSTATUS
+NTAPI
+PinWaveCyclicAddLoopedStreamEvent(
+ IN PIRP Irp,
+ IN PKSEVENTDATA EventData,
+ IN PKSEVENT_ENTRY EventEntry)
+{
+ PLOOPEDSTREAMING_POSITION_EVENT_DATA Data;
+ PLOOPEDSTREAMING_EVENT_CONTEXT Entry;
+ PSUBDEVICE_DESCRIPTOR Descriptor;
+ CPortPinWaveCyclic *Pin;
+
+ // get sub device descriptor
+ Descriptor = (PSUBDEVICE_DESCRIPTOR)KSEVENT_ITEM_IRP_STORAGE(Irp);
+
+ // sanity check
+ PC_ASSERT(Descriptor);
+ PC_ASSERT(Descriptor->PortPin);
+ PC_ASSERT_IRQL(DISPATCH_LEVEL);
+
+ // cast to pin impl
+ Pin = (CPortPinWaveCyclic*)Descriptor->PortPin;
+
+ // cast to looped event
+ Data = (PLOOPEDSTREAMING_POSITION_EVENT_DATA)EventData;
+
+ // get extra size
+ Entry = (PLOOPEDSTREAMING_EVENT_CONTEXT)(EventEntry + 1);
+
+ Entry->bLoopedStreaming = TRUE;
+ Entry->Position = Data->Position;
+
+ DPRINT1("Added event\n");
+
+ // insert item
+ (void)ExInterlockedInsertTailList(&Pin->m_EventList,
&EventEntry->ListEntry, &Pin->m_EventListLock);
+
+ // done
+ return STATUS_SUCCESS;
+}
+
+NTSTATUS
+NTAPI
+PinWaveCyclicAllocatorFraming(
+ IN PIRP Irp,
+ IN PKSIDENTIFIER Request,
+ IN OUT PVOID Data)
+{
+ CPortPinWaveCyclic *Pin;
+ PSUBDEVICE_DESCRIPTOR Descriptor;
+
+ // get sub device descriptor
+ Descriptor = (PSUBDEVICE_DESCRIPTOR)KSEVENT_ITEM_IRP_STORAGE(Irp);
+
+ // sanity check
+ PC_ASSERT(Descriptor);
+ PC_ASSERT(Descriptor->PortPin);
+ PC_ASSERT_IRQL(DISPATCH_LEVEL);
+
+ // cast to pin impl
+ Pin = (CPortPinWaveCyclic*)Descriptor->PortPin;
+
+
+ if (Request->Flags & KSPROPERTY_TYPE_GET)
+ {
+ // copy pin framing
+ RtlMoveMemory(Data, &Pin->m_AllocatorFraming,
sizeof(KSALLOCATOR_FRAMING));
+
+ Irp->IoStatus.Information = sizeof(KSALLOCATOR_FRAMING);
+ return STATUS_SUCCESS;
+ }
+
+ // not supported
+ return STATUS_NOT_SUPPORTED;
+}
+
+NTSTATUS
+NTAPI
+PinWaveCyclicAudioPosition(
+ IN PIRP Irp,
+ IN PKSIDENTIFIER Request,
+ IN OUT PVOID Data)
+{
+ CPortPinWaveCyclic *Pin;
+ PSUBDEVICE_DESCRIPTOR Descriptor;
+ PKSAUDIO_POSITION Position;
+
+ // get sub device descriptor
+ Descriptor = (PSUBDEVICE_DESCRIPTOR)KSPROPERTY_ITEM_IRP_STORAGE(Irp);
+
+ // sanity check
+ PC_ASSERT(Descriptor);
+ PC_ASSERT(Descriptor->PortPin);
+ PC_ASSERT_IRQL(DISPATCH_LEVEL);
+
+ // cast to pin impl
+ Pin = (CPortPinWaveCyclic*)Descriptor->PortPin;
+
+ //sanity check
+ PC_ASSERT(Pin->m_Stream);
+
+ if (Request->Flags & KSPROPERTY_TYPE_GET)
+ {
+ // FIXME non multithreading-safe
+ // copy audio position
+
+ Position = (PKSAUDIO_POSITION)Data;
+
+ if (Pin->m_ConnectDetails->Interface.Id == KSINTERFACE_STANDARD_STREAMING)
+ {
+ RtlMoveMemory(Data, &Pin->m_Position, sizeof(KSAUDIO_POSITION));
+ DPRINT("Play %I64u Record %I64u\n", Pin->m_Position.PlayOffset,
Pin->m_Position.WriteOffset);
+ }
+ else if (Pin->m_ConnectDetails->Interface.Id ==
KSINTERFACE_STANDARD_LOOPED_STREAMING)
+ {
+ Position->PlayOffset = Pin->m_Position.PlayOffset;
+ Position->WriteOffset =
(ULONGLONG)Pin->m_IrpQueue->GetCurrentIrpOffset();
+ DPRINT("Play %I64u Write %I64u\n", Position->PlayOffset,
Position->WriteOffset);
+ }
+
+ Irp->IoStatus.Information = sizeof(KSAUDIO_POSITION);
+ return STATUS_SUCCESS;
+ }
+
+ // not supported
+ return STATUS_NOT_SUPPORTED;
+}
NTSTATUS
NTAPI
@@ -470,20 +563,46 @@
{
// FIXME
// complete with successful state
+ DPRINT1("BytesPlayed %I64u, GlitchCount %I64u GlitchLength
%I64u\n", Pin->m_Position.PlayOffset, Pin->m_GlitchCount,
Pin->m_GlitchLength);
Pin->m_Stream->Silence(Pin->m_CommonBuffer,
Pin->m_CommonBufferSize);
Pin->m_IrpQueue->CancelBuffers();
Pin->m_Position.PlayOffset = 0;
Pin->m_Position.WriteOffset = 0;
+ Pin->m_GlitchCount = 0;
+ Pin->m_GlitchLength = 0;
+
+
+ // unregister the time out
+ PcUnregisterIoTimeout(GetDeviceObject(Pin->m_Port),
PinWaveCyclicIoTimerRoutine, (PVOID)Pin);
}
else if (Pin->m_State == KSSTATE_STOP)
{
+ DPRINT1("BytesPlayed %I64u, GlitchCount %I64u GlitchLength
%I64u\n", Pin->m_Position.PlayOffset, Pin->m_GlitchCount,
Pin->m_GlitchLength);
Pin->m_Stream->Silence(Pin->m_CommonBuffer,
Pin->m_CommonBufferSize);
Pin->m_IrpQueue->CancelBuffers();
Pin->m_Position.PlayOffset = 0;
Pin->m_Position.WriteOffset = 0;
+ Pin->m_GlitchCount = 0;
+ Pin->m_GlitchLength = 0;
+
+ // unregister the time out
+ PcUnregisterIoTimeout(GetDeviceObject(Pin->m_Port),
PinWaveCyclicIoTimerRoutine, (PVOID)Pin);
}
// store result
Irp->IoStatus.Information = sizeof(KSSTATE);
+
+ if (*State == KSSTATE_RUN)
+ {
+ // register wave hung routine
+ NTSTATUS PcStatus = PcRegisterIoTimeout(GetDeviceObject(Pin->m_Port),
PinWaveCyclicIoTimerRoutine, (PVOID)Pin);
+ if (!NT_SUCCESS(PcStatus))
+ {
+ DPRINT1("Failed to register timer routine with %x\n",
PcStatus);
+ }
+
+ // set flag that stream has started for the wave hung routine
+ Pin->m_Started = TRUE;
+ }
}
return Status;
}
@@ -701,8 +820,10 @@
Gap = Position - m_CommonBufferOffset;
if (Gap > BufferLength)
{
+ // increment glitchcount
+ m_GlitchCount++;
+ m_GlitchLength += BufferLength;
// insert silence samples
- DPRINT1("Inserting Silence Buffer Offset %lu GapLength %lu\n",
m_CommonBufferOffset, BufferLength);
m_Stream->Silence((PUCHAR)m_CommonBuffer + m_CommonBufferOffset,
BufferLength);
m_CommonBufferOffset += BufferLength;
@@ -760,8 +881,11 @@
Gap = m_CommonBufferSize - m_CommonBufferOffset + Position;
if (Gap > BufferLength)
{
+ // increment glitchcount
+ m_GlitchCount++;
+ m_GlitchLength += BufferLength;
+
// insert silence samples
- DPRINT1("Overlap Inserting Silence Buffer Size %lu Offset %lu Gap
%lu Position %lu\n", m_CommonBufferSize, m_CommonBufferOffset, Gap, Position);
m_Stream->Silence((PUCHAR)m_CommonBuffer + m_CommonBufferOffset,
BufferLength);
m_CommonBufferOffset += BufferLength;
@@ -933,6 +1057,8 @@
{
m_Position.WriteOffset += Data;
Status = STATUS_PENDING;
+ /* time stamp last packet */
+ KeQuerySystemTime(&m_LastPacketTime);
}
}
else
@@ -1034,6 +1160,9 @@
DPRINT("Warning: failed to stop stream with %x\n", Status);
PC_ASSERT(0);
}
+
+ // unregister the time out
+ PcUnregisterIoTimeout(GetDeviceObject(m_Port), PinWaveCyclicIoTimerRoutine,
(PVOID)this);
}
// set state to stop
m_State = KSSTATE_STOP;
@@ -1269,7 +1398,7 @@
Status = m_ServiceGroup->AddMember(PSERVICESINK(this));
if (!NT_SUCCESS(Status))
{
- DPRINT("Failed to add pin to service group\n");
+ DPRINT1("Failed to add pin to service group\n");
return Status;
}
Modified: branches/audio-bringup/drivers/wdm/audio/backpln/portcls/pin_wavepci.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/audio-bringup/drivers/wdm/audio…
==============================================================================
--- branches/audio-bringup/drivers/wdm/audio/backpln/portcls/pin_wavepci.cpp [iso-8859-1]
(original)
+++ branches/audio-bringup/drivers/wdm/audio/backpln/portcls/pin_wavepci.cpp [iso-8859-1]
Fri Dec 10 11:03:28 2010
@@ -60,7 +60,6 @@
ULONG m_TotalPackets;
KSAUDIO_POSITION m_Position;
- ULONG m_StopCount;
BOOL m_bUsePrefetch;
ULONG m_PrefetchOffset;