Author: janderwald
Date: Wed Apr 22 19:01:18 2009
New Revision: 40649
URL:
http://svn.reactos.org/svn/reactos?rev=40649&view=rev
Log:
- Increase importance of the audio dpc which finishes irps
- Once one second of audio data has been buffered, always queue audio irps and dont
complete them imediately. Greatly improves the playback of SMPlayer and probably many
other audio players which act strictly on the timing of completed irps
- Add debug traces when KsCreatePin fails
Modified:
trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c
trunk/reactos/drivers/wdm/audio/sysaudio/control.c
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c [iso-8859-1] Wed Apr 22
19:01:18 2009
@@ -30,6 +30,7 @@
ULONG CurrentOffset;
LONG NumMappings;
ULONG NumDataAvailable;
+ BOOL StartStream;
KSPIN_CONNECT *ConnectDetails;
PKSDATAFORMAT_WAVEFORMATEX DataFormat;
@@ -159,6 +160,7 @@
Mapping->Header = (KSSTREAM_HEADER*)Buffer;
Mapping->Irp = Irp;
KeInitializeDpc(&Mapping->Dpc, DpcRoutine, (PVOID)Mapping);
+ KeSetImportanceDpc(&Mapping->Dpc, HighImportance);
if (This->MaxFrameSize)
{
@@ -258,8 +260,14 @@
BOOL Result;
IIrpQueueImpl * This = (IIrpQueueImpl*)iface;
+ if (This->StartStream)
+ return TRUE;
+
if (This->DataFormat->WaveFormatEx.nAvgBytesPerSec <
This->NumDataAvailable)
+ {
+ This->StartStream = TRUE;
Result = TRUE;
+ }
else
Result = FALSE;
@@ -282,6 +290,7 @@
{
IIrpQueueImpl * This = (IIrpQueueImpl*)iface;
This->DataFormat = (PKSDATAFORMAT_WAVEFORMATEX)DataFormat;
+ This->StartStream = FALSE;
}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c [iso-8859-1] Wed Apr
22 19:01:18 2009
@@ -203,13 +203,16 @@
This = (IPortPinWaveCyclicImpl*)Ctx->Pin;
+ IoFreeWorkItem(Ctx->WorkItem);
+ FreeItem(Ctx, TAG_PORTCLASS);
+
+ if (This->IrpQueue->lpVtbl->NumMappings(This->IrpQueue))
+ return;
+
/* Set the state to stop */
This->Stream->lpVtbl->SetState(This->Stream, KSSTATE_STOP);
/* Set internal state to stop */
This->State = KSSTATE_STOP;
-
- IoFreeWorkItem(Ctx->WorkItem);
- FreeItem(Ctx, TAG_PORTCLASS);
DPRINT1("Stopping %p %u Irql %u\n", This,
This->IrpQueue->lpVtbl->NumMappings(This->IrpQueue), KeGetCurrentIrql());
}
Modified: trunk/reactos/drivers/wdm/audio/sysaudio/control.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/sysaudio…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/sysaudio/control.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/sysaudio/control.c [iso-8859-1] Wed Apr 22 19:01:18
2009
@@ -263,13 +263,18 @@
Status = KsCreatePin(WorkerContext->Entry->Handle, MixerPinConnect,
GENERIC_READ | GENERIC_WRITE, &RealPinHandle);
if (!NT_SUCCESS(Status))
{
+ /* This should not fail */
DPRINT1("KsCreatePin failed with %x\n", Status);
- /* This should not fail */
- KeBugCheck(0);
+ DPRINT1(" InputFormat: SampleRate %u Bits %u Channels %u\n",
InputFormat->WaveFormatEx.nSamplesPerSec, InputFormat->WaveFormatEx.wBitsPerSample,
InputFormat->WaveFormatEx.nChannels);
+ DPRINT1("OutputFormat: SampleRate %u Bits %u Channels %u\n",
OutputFormat->WaveFormatEx.nSamplesPerSec,
OutputFormat->WaveFormatEx.wBitsPerSample, OutputFormat->WaveFormatEx.nChannels);
+
+ SetIrpIoStatus(WorkerContext->Irp, STATUS_UNSUCCESSFUL, 0);
+ ExFreePool(WorkerContext->DispatchContext);
+ ExFreePool(MixerPinConnect);
+ IoFreeWorkItem(WorkerContext->WorkItem);
+ ExFreePool(WorkerContext);
return;
}
- DPRINT(" InputFormat: SampleRate %u Bits %u Channels %u\n",
InputFormat->WaveFormatEx.nSamplesPerSec, InputFormat->WaveFormatEx.wBitsPerSample,
InputFormat->WaveFormatEx.nChannels);
- DPRINT("OutputFormat: SampleRate %u Bits %u Channels %u\n",
OutputFormat->WaveFormatEx.nSamplesPerSec,
OutputFormat->WaveFormatEx.wBitsPerSample, OutputFormat->WaveFormatEx.nChannels);
}
/* get pin file object */