SimpleAudioSample.sys - trying to add DEVPKEY_KsAudio_PacketSize_Constraints2 property handler
Hi. I've copied the DEVPKEY_KsAudio_PacketSize_Constraints2 property handler from the sysvad sample, to what I believe to be the proper locations in the SimpleAudioSample WaveRT VAD. Using Matt van Eerde's play-exclusive test application, the call to IAudioClient::GetDevicePeriod() always returns 3ms.
What I've changed:
* in SimpleAudioSample/Source/Filters/minipairs.h, I've added:*
static struct
{
KSAUDIO_PACKETSIZE_CONSTRAINTS2 TransportPacketConstraints;
KSAUDIO_PACKETSIZE_PROCESSINGMODE_CONSTRAINT AdditionalProcessingConstraints [1];
} SimpleAudioSampleWaveRtPacketSizeConstraintsRender =
{
{
1 * HNSTIME_PER_MILLISECOND, // 2 ms minimum processing interval
FILE_BYTE_ALIGNMENT, // 1 byte packet size alignment
0, // no maximum packet size constraint
2, // 2 processing constraints follow
{
STATIC_AUDIO_SIGNALPROCESSINGMODE_DEFAULT, // constraint for default processing mode
64, // 128 samples per processing frame
0, // NA hns per processing frame
},
},
{
{
STATIC_AUDIO_SIGNALPROCESSINGMODE_MOVIE, // constraint for movie processing mode
1024, // 1024 samples per processing frame
0, // NA hns per processing frame
},
}
};
const SIMPLEAUDIOSAMPLE_DEVPROPERTY SimpleAudioSampleWaveFilterInterfacePropertiesRender[] =
{
{
&DEVPKEY_KsAudio_PacketSize_Constraints2, // Key
DEVPROP_TYPE_BINARY, // Type
sizeof(SimpleAudioSampleWaveRtPacketSizeConstraintsRender), // BufferSize
&SimpleAudioSampleWaveRtPacketSizeConstraintsRender, // Buffer
},
};
and updated the ENDPOINT_PAIR for SpeakerMiniports filter pair:
static
ENDPOINT_MINIPAIR SpeakerMiniports =
{
eSpeakerDevice,
L"TopologySpeaker", // make sure this or the template name matches with KSNAME_TopologySpeaker in the inf's [Strings] section
NULL, // optional template name
CreateMiniportTopologySimpleAudioSample,
&SpeakerTopoMiniportFilterDescriptor,
0, NULL, // Interface properties
L"WaveSpeaker", // make sure this or the template name matches with KSNAME_WaveSpeaker in the inf's [Strings] section
NULL, // optional template name
CreateMiniportWaveRTSimpleAudioSample,
&SpeakerWaveMiniportFilterDescriptor,
ARRAYSIZE(SimpleAudioSampleWaveFilterInterfacePropertiesRender), // +++++ ADDED BY ME
SimpleAudioSampleWaveFilterInterfacePropertiesRender, // +++++ ADDED BY ME
SPEAKER_DEVICE_MAX_CHANNELS,
SpeakerPinDeviceFormatsAndModes,
SIZEOF_ARRAY(SpeakerPinDeviceFormatsAndModes),
SpeakerTopologyPhysicalConnections,
SIZEOF_ARRAY(SpeakerTopologyPhysicalConnections),
ENDPOINT_NO_FLAGS,
};
The docs, say somewhat tersely:
The driver sets this variable length data structure as the value of the DEVPKEY_KsAudio_PacketSize_Constraints2 property on the PnP interface of the KS filter that has the streaming pins with the constraints.
Is this the proper way to implement this property?
Forgot to add these:
- target OS is 21H2, x64
- Microsoft Visual Studio Professional 2022
Version 17.3.5
Installed Version: Professional
Debugging Tools for Windows 10.0.22621.311
Integrates the Windows Debugger functionality (http://go.microsoft.com/fwlink/?linkid=223405) in Visual Studio.
Windows Driver Kit 10.0.22621.311
Headers, libraries, and tools needed to develop, debug, and test Windows drivers (msdn.microsoft.com/en-us/windows/hardware/gg487428.aspx)
Thanks!
-Wade