Changeset 263

Show
Ignore:
Timestamp:
07/04/08 23:00:04 (4 years ago)
Author:
ath
Message:

Make ALSA use realtime priority if available.

Location:
trunk/fm_server/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/fm_server/src/fm_output_alsa.c

    r232 r263  
    3131#include <alsa/asoundlib.h> 
    3232 
     33#include "fm_utils.h" 
    3334#include "src_type_conv.h" 
    3435#include "fm_buffer.h" 
     
    4243 
    4344#define ALSA_DEFAULT_DEVICE "default" 
    44 //#define ALSA_DEFAULT_DEVICE "surround40" 
    4545#define ALSA_DEFAULT_SAMPLE_RATE 44100 
    4646//#define ALSA_DEFAULT_SAMPLE_RATE 48000 
     
    477477        FmElement *element = FM_ELEMENT (data); 
    478478        FmOutputAlsa *output_alsa = FM_OUTPUT_ALSA (data); 
     479 
     480        g_thread_set_rt (NULL, 10); 
    479481         
    480482        while (!output_alsa->stop_processing) { 
  • trunk/fm_server/src/fm_utils.c

    r194 r263  
    2626 
    2727#ifdef G_OS_UNIX 
     28#include <sys/types.h> 
     29#include <unistd.h> 
    2830#include <sched.h> 
    2931#include <errno.h> 
     
    3133#include <pthread.h> 
    3234#endif 
     35 
     36#include <config.h> 
    3337 
    3438#include "fm_utils.h" 
     
    4145#ifdef HAVE_SCHED_SETSCHEDULER 
    4246 
    43         pthread_t th = pthread_self(); 
     47        //pthread_t th = pthread_self(); 
    4448        struct sched_param param; 
    4549 
    4650        param.sched_priority = prio; 
    4751 
    48         if (sched_setscheduler(th, SCHED_FIFO, &param)) { 
     52        if (sched_setscheduler(0, SCHED_FIFO, &param)) { 
    4953                g_warning("Failed to set thread %p to SCHED_FIFO with prio %d: %s", gthread, prio, strerror(errno)); 
    5054                return FALSE;