summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Drochner <m.drochner@fz-juelich.de>2010-07-21 15:27:33 +0000
committerMatthias Drochner <m.drochner@fz-juelich.de>2010-07-21 15:27:33 +0000
commite9c4a618fbc47dae2cdd82d4d09ade8ec020bfe1 (patch)
treeb6adae3a891d51befdc74cd691498fe38a2dbc61
parentba6e40bee872673f4af4e32836d633b28e634997 (diff)
downloadxine-lib-e9c4a618fbc47dae2cdd82d4d09ade8ec020bfe1.tar.gz
xine-lib-e9c4a618fbc47dae2cdd82d4d09ade8ec020bfe1.tar.bz2
Add _POSIX_THREAD_PRIORITY_SCHEDULING #ifdefs
This is optional, and some systems don't support it. POSIX defines the _POSIX_THREAD_PRIORITY_SCHEDULING to tell that support is present.
-rw-r--r--src/xine-engine/audio_decoder.c4
-rw-r--r--src/xine-engine/audio_out.c2
-rw-r--r--src/xine-engine/video_decoder.c8
-rw-r--r--src/xine-engine/video_out.c2
4 files changed, 16 insertions, 0 deletions
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c
index dd15bf696..3d5ef7e6f 100644
--- a/src/xine-engine/audio_decoder.c
+++ b/src/xine-engine/audio_decoder.c
@@ -463,7 +463,9 @@ static void *audio_decoder_loop (void *stream_gen) {
int _x_audio_decoder_init (xine_stream_t *stream) {
pthread_attr_t pth_attrs;
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
struct sched_param pth_params;
+#endif
int err;
if (stream->audio_out == NULL) {
@@ -501,10 +503,12 @@ int _x_audio_decoder_init (xine_stream_t *stream) {
*/
pthread_attr_init(&pth_attrs);
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
pthread_attr_getschedparam(&pth_attrs, &pth_params);
pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER);
pthread_attr_setschedparam(&pth_attrs, &pth_params);
pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM);
+#endif
stream->audio_thread_created = 1;
if ((err = pthread_create (&stream->audio_thread,
diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c
index 0a141e014..b9738595b 100644
--- a/src/xine-engine/audio_out.c
+++ b/src/xine-engine/audio_out.c
@@ -2284,7 +2284,9 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver,
this->audio_loop_running = 1;
pthread_attr_init(&pth_attrs);
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM);
+#endif
this->audio_thread_created = 1;
if ((err = pthread_create (&this->audio_thread,
diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c
index 0756fc5b2..f70bb82bb 100644
--- a/src/xine-engine/video_decoder.c
+++ b/src/xine-engine/video_decoder.c
@@ -41,6 +41,10 @@
#define SPU_SLEEP_INTERVAL (90000/2)
+#ifndef SCHED_OTHER
+#define SCHED_OTHER 0
+#endif
+
static void update_spu_decoder (xine_stream_t *stream, int type) {
@@ -486,7 +490,9 @@ int _x_video_decoder_init (xine_stream_t *stream) {
} else {
pthread_attr_t pth_attrs;
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
struct sched_param pth_params;
+#endif
int err, num_buffers;
/* The fifo size is based on dvd playback where buffers are filled
* with 2k of data. With 500 buffers and a typical video data rate
@@ -515,10 +521,12 @@ int _x_video_decoder_init (xine_stream_t *stream) {
stream->spu_track_map_entries = 0;
pthread_attr_init(&pth_attrs);
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
pthread_attr_getschedparam(&pth_attrs, &pth_params);
pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER);
pthread_attr_setschedparam(&pth_attrs, &pth_params);
pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM);
+#endif
stream->video_thread_created = 1;
if ((err = pthread_create (&stream->video_thread,
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index cd73233c3..26ad98290 100644
--- a/src/xine-engine/video_out.c
+++ b/src/xine-engine/video_out.c
@@ -1911,7 +1911,9 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabon
this->grab_only = 0;
pthread_attr_init(&pth_attrs);
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM);
+#endif
if ((err = pthread_create (&this->video_thread,
&pth_attrs, video_out_loop, this)) != 0) {