To Get Reader Performance Statistics
[The feature associated with this page, Windows Media Format 11 SDK, is a legacy feature. It has been superseded by Source Reader and Sink Writer. Source Reader and Sink Writer have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Source Reader and Sink Writer instead of Windows Media Format 11 SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
When reading files locally with the asynchronous reader, it is not necessary to check the performance of reading operations. If your application is reading from a streaming source however, performance statistics can be very important. Your application can respond to changes in playback performance to ensure the best possible end-user experience.
The performance information you can retrieve from the reader includes the following statistics:
- The current bandwidth of the connection.
- The number of packets received from the server.
- The number of lost packets that were recovered.
- The number of lost packets that were not recovered.
- The percentage of the total number of packets sent that have been received.
To get reader performance statistics, perform the following steps.
- Before starting playback, create a WM_READER_STATISTICS structure. You must set the cbSize member to sizeof(WM_READER_STATISTICS).
- Obtain a pointer to the IWMReaderAdvanced interface of the reader object by calling IWMReader::QueryInterface.
- During playback, make calls to IWMReaderAdvanced::GetStatistics frequently to monitor performance. Pass your WM_READER_STATISTICS structure with each call and examine the appropriate members.
Related topics