Fixed bug 3930 - Android, set thread priorities and names

SDLActivity thread priority is unchanged, by default -10 (THREAD_PRIORITY_VIDEO).

SDLAudio thread priority was -4 (SDL_SetThreadPriority was ignored) and is now -16 (THREAD_PRIORITY_AUDIO).

SDLThread thread priority was 0 (THREAD_PRIORITY_DEFAULT) and is -4 (THREAD_PRIORITY_DISPLAY).
This commit is contained in:
Sylvain Becker
2019-01-10 18:05:56 +01:00
parent 0e0e0272b8
commit d23c2f07e3
5 changed files with 61 additions and 3 deletions

View File

@@ -695,8 +695,16 @@ SDL_RunAudio(void *devicep)
SDL_assert(!device->iscapture);
#if SDL_AUDIO_DRIVER_ANDROID
{
/* Set thread priority to THREAD_PRIORITY_AUDIO */
extern void Android_JNI_AudioSetThreadPriority(int, int);
Android_JNI_AudioSetThreadPriority(device->iscapture, device->id);
}
#else
/* The audio mixing is always a high priority thread */
SDL_SetThreadPriority(SDL_THREAD_PRIORITY_TIME_CRITICAL);
#endif
/* Perform any thread setup */
device->threadid = SDL_ThreadID();
@@ -792,8 +800,16 @@ SDL_CaptureAudio(void *devicep)
SDL_assert(device->iscapture);
#if SDL_AUDIO_DRIVER_ANDROID
{
/* Set thread priority to THREAD_PRIORITY_AUDIO */
extern void Android_JNI_AudioSetThreadPriority(int, int);
Android_JNI_AudioSetThreadPriority(device->iscapture, device->id);
}
#else
/* The audio mixing is always a high priority thread */
SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH);
#endif
/* Perform any thread setup */
device->threadid = SDL_ThreadID();