
Audio and Video Thread Priorities
If DirectShow is using a high percentage of the available CPU on a device when the device is decoding video, the audio and video performance may be uneven if other threads with higher priorities also need to use the CPU.
To maintain a smooth audio or smooth video playback at all times, you can use the following registry subkey to fine tune the priorities for the audio and video threads: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectShow\ThreadPriority
The following table describes the named values for this subkey.
| Value | Type | Description |
| Highest | DWORD | Sets a new thread priority for DirectShow threads that are running with a priority of THREAD_PRIORITY_HIGHEST. The default setting is the hexadecimal value F9, which is identical to the remapped value of THREAD_PRIORITY_HIGHEST (249). |
| AboveNormal | DWORD | Sets a new thread priority for DirectShow threads that are running with a priority of THREAD_PRIORITY_ABOVE_NORMAL. The default setting is the hexadecimal value FA, which is identical to the remapped value of THREAD_PRIORITY_ABOVE_NORMAL (250). |
| Normal | DWORD | Sets a new thread priority for DirectShow threads that are running with a priority of THREAD_PRIORITY_NORMAL. The default setting is the hexadecimal value FB, which is identical to the remapped value of THREAD_PRIORITY_NORMAL (251). |
| BelowNormal | DWORD | Sets a new thread priority for DirectShow threads that are running with a priority of THREAD_PRIORITY_BELOW_NORMAL. The default setting is the hexadecimal value FC, which is identical to the remapped value of THREAD_PRIORITY_BELOW_NORMAL (252). |
| Video | DWORD | Sets a new thread priority for the video rendering thread in DirectShow. The default setting is the hexadecimal value FB, which is identical to the remapped value of THREAD_PRIORITY_NORMAL (251). The setting for Normal does not affect the video rendering thread. |
The named values Highest, AboveNormal, Normal, and BelowNormal are all associated with standard operating system thread priority levels.
DirectShow threads that are identified with the standard operating system thread priorities run at the priority levels that are specified by those registry settings instead of the values that are described in the preceding table. These settings affect only threads that are owned by DirectShow. They do not affect the global operating system thread priority levels, and they do not affect threads that are owned by Windows Media Player.
For more information about Windows Embedded CE thread priorities, see Priority Levels.
The following registry key example shows the default values for the registry subkey
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectShow\ThreadPriority.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectShow\ThreadPriority]
"Highest"=DWORD:F9
"AboveNormal"= DWORD:FA
"Normal"= DWORD:FB
"BelowNormal"= DWORD:FC
"Video"= DWORD:FB Notes
- The default settings for DirectShow thread priorities provide satisfactory results for almost all devices; these values should not be changed unless absolutely necessary.
- Changing values for DirectShow thread priorities from their default values can be very risky because the new values can cause unexpected performance problems for other applications that are running concurrently with DirectShow. It can be difficult to test for, diagnose, and resolve these types of problems.
- If you must adjust the DirectShow audio and video thread priorities, make sure that the DirectShow priorities are higher than the audio and video driver priorities in your operating system design. Also, make sure that the audio priority is higher than the priority of the software mixer. Failing to take these steps almost always results in audio and video playback performance problems.