KSPROPERTY_RTAUDIO_PACKETCOUNT

KSPROPERTY_RTAUDIO_PACKETCOUNT returns the (1-based) count of packets completely transferred from the WaveRT buffer into hardware.

Usage Summary Table

Get Set Target Property descriptor type Property value type

Yes

No

Pin

KSPROPERTY

ULONG

The property descriptor (instance data) is a KSPROPERTY structure. Before sending the request, the client loads the structure with the (1-based) count of packets completely transferred from the WaveRT buffer into hardware.

The property value is a variable of type ULONG.

Return Value

A KSPROPERTY_RTAUDIO_PACKETCOUNT property request returns STATUS_SUCCESS to indicate that it has completed successfully. Otherwise, the request returns an appropriate failure status code.

Remarks

From the packet count, the OS can derive the stream position of the packets it writes into the WaveRT buffer. The OS can also derive the WaveRT buffer position of the next packet to write within the WaveRT buffer. For WaveRT drivers, the driver signals a single notification event as it transfers data from each packet of the WaveRT buffer. Therefore the event alone cannot indicate which packet within the WaveRT buffer is being transferred. In normal operation this is not a concern but in underflow cases correction is more easily achieved by querying the packet count from which the OS can determine which packet to write next.

The returned PacketCount indicates the (1-based) count of packets completely transferred from the WaveRT buffer into hardware. From this, the OS can determine the 0-based number of the packet currently being transferred, and ensure that it writes ahead of that packet. For example, if the packet count is 5, then 5 packets have completely transferred. That is, packets 0-4 have completely transferred. Therefore packet 5 is in progress, and the OS should write packet 6. If the notification count for the WaveRT buffer is 2, then packet 6 would be at offset 0 within the WaveRT buffer (because 6 modulo 2 is 0, and 0 times the packet size is 0).

The OS may get this property at any time. However it generally gets this property only periodically or after the driver returns a dataflow error (STATUS_DATA_LATE_ERROR, STATUS_DATA_OVERRUN) from SetWritePacket() in order to resynchronize with the driver.

The driver should reset the packet count to 0 when the stream is in KSSTATE_STOP.

Requirements

Version

Available in Windows 10 and later Windows operating systems.

Header

Ksmedia.h

See also

KSPROPSETID_RTAudio