Changeset 3011
Legend:
- Unmodified
- Added
- Removed
-
rat/trunk/MODS
r3009 r3011 997 997 - Add version number to mbus config file. Should prevent crashes 998 998 when we update the format of that file. 999 - Set thread priority of media engine to THREAD_PRIORITY_ABOVE_NORMAL 1000 on Windows. 999 1001 1000 1002 -
rat/trunk/auddev_win32.c
r2956 r3011 35 35 static int error = 0; 36 36 static char errorText[MAXERRORLENGTH]; 37 extern int thread_pri;38 37 static int nLoopGain = 100; 39 38 #define MAX_DEV_NAME 64 -
rat/trunk/main_engine.c
r3008 r3011 44 44 #include "rtp_callback.h" 45 45 46 int should_exit = FALSE;47 int thread_pri = 2; /* Time Critical*/46 int should_exit = FALSE; 47 char *c_addr, *token, *token_e; /* These should be parameters of the session? */ 48 48 49 49 #ifndef WIN32 … … 55 55 } 56 56 #endif 57 58 char *c_addr, *token, *token_e;59 57 60 58 #define MBUS_ADDR_ENGINE "(media:audio module:engine app:rat instance:%5u)" … … 102 100 uint8_t j; 103 101 104 #ifndef WIN32 102 #ifdef WIN32 103 /* Not sure what the correct priority should be... rat-3.0.x uses */ 104 /* THREAD_PRIORITY_TIME_CRITICAL, but that's maybe too high. [csp] */ 105 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL); 106 #else 105 107 signal(SIGINT, signal_handler); 108 debug_set_core_dir(argv[0]); 106 109 #endif 107 110 108 debug_set_core_dir(argv[0]); 109 111 /* Setup things which are independent of the session. These should */ 112 /* be create static data only, since it will be accessed by BOTH */ 113 /* instances when running as a transcoder. */ 110 114 seed = (gethostid() << 8) | (getpid() & 0xff); 111 115 srand48(seed); 112 116 lbl_srandom(seed); 113 117 converters_init(); 118 audio_init_interfaces(); 119 parse_args(argc, argv); 120 121 /* Initialize the session structure, and all session specific data */ 114 122 sp = (session_t *) xmalloc(sizeof(session_t)); 115 123 session_init(sp); 116 converters_init();117 audio_init_interfaces();118 124 audio_device_get_safe_config(&sp->new_config); 119 125 audio_device_reconfigure(sp); 120 sp->cur_ts = ts_seq32_in(&sp->decode_sequencer, 121 get_freq(sp->device_clock), 0); 126 sp->cur_ts = ts_seq32_in(&sp->decode_sequencer, get_freq(sp->device_clock), 0); 122 127 assert(audio_device_is_open(sp->audio_device)); 123 128 settings_load_early(sp); 124 parse_args(argc, argv);125 129 126 130 /* Initialise our mbus interface... once this is done we can talk to our controller */ … … 165 169 settings_load_late(sp); 166 170 167 ui_controller_init(sp);168 171 ui_initial_settings(sp); 169 172 ui_update(sp); 170 173 network_process_mbus(sp); 171 174 172 #ifdef NDEF173 if (sp->new_config != NULL) {174 network_process_mbus(sp);175 audio_device_reconfigure(sp);176 network_process_mbus(sp);177 }178 #endif179 180 #ifdef NDEF181 ui_final_settings(sp);182 network_process_mbus(sp);183 #endif184 175 audio_drain(sp->audio_device); 185 176 if (tx_is_sending(sp->tb)) { … … 222 213 /* Process audio */ 223 214 elapsed_time += audio_rw_process(sp, sp, sp->ms); 224 cur_time = get_time(sp->device_clock);225 ntp_time = ntp_time32();226 sp->cur_ts = ts_seq32_in(&sp->decode_sequencer, get_freq(sp->device_clock), cur_time);215 cur_time = get_time(sp->device_clock); 216 ntp_time = ntp_time32(); 217 sp->cur_ts = ts_seq32_in(&sp->decode_sequencer, get_freq(sp->device_clock), cur_time); 227 218 228 219 if (tx_is_sending(sp->tb)) { … … 234 225 if (sp->playing_audio) { 235 226 struct s_source *s; 236 int sidx; 237 ts_t cush_ts; 227 int sidx; 228 ts_t cush_ts; 229 238 230 cush_ts = ts_map32(get_freq(sp->device_clock), cushion_get_size(sp->cushion)); 239 231 cush_ts = ts_add(sp->cur_ts, cush_ts); … … 269 261 /* Echo Suppression - cut off transmitter when receiving */ 270 262 /* audio, enable when stop receiving. */ 271 272 263 if (sp->echo_suppress) { 273 264 if (scnt > 0) { … … 305 296 } 306 297 if (sp->new_config != NULL) { 307 /* wait for mbus messages - closing audio device 308 * can timeout unprocessed messages as some drivers 309 * pause to drain before closing. 310 */ 298 /* wait for mbus messages - closing audio device */ 299 /* can timeout unprocessed messages as some drivers */ 300 /* pause to drain before closing. */ 311 301 network_process_mbus(sp); 312 302 if (audio_device_reconfigure(sp)) { 313 /* Device reconfigured so 314 * decode paths of all sources 315 * are misconfigured. Delete 316 * and incoming data will 317 * drive correct new path */ 303 /* Device reconfigured so decode paths of all sources */ 304 /* are misconfigured. Delete the source, and incoming */ 305 /* data will drive the correct new path. */ 318 306 source_list_clear(sp->active_sources); 319 307 } … … 345 333 } while (!mbus_sent_all(sp->mbus_engine)); 346 334 mbus_exit(sp->mbus_engine); 347 sp->mbus_engine = NULL;348 335 349 336 for (j = 0; j < sp->rtp_session_count; j++) { … … 354 341 355 342 session_exit(sp); 356 xfree(sp);357 358 343 converters_free(); 359 344 audio_free_interfaces(); 360 361 345 xmemdmp(); 362 346 return 0; -
rat/trunk/session.c
r2958 r3011 160 160 channel_encoder_destroy(&sp->channel_coder); 161 161 source_list_destroy(&sp->active_sources); 162 xfree(sp); 162 163 } 163 164 -
rat/trunk/ui.c
r3006 r3011 1081 1081 ui_initial_settings(session_t *sp) 1082 1082 { 1083 /* One off setting transfers / initialization */ 1083 1084 uint32_t my_ssrc = rtp_my_ssrc(sp->rtp_session[0]); 1084 /* One off setting transfers / initialization */ 1085 1086 mbus_qmsgf(sp->mbus_engine, sp->mbus_ui_addr, TRUE, "rtp.ssrc", "%08lx", my_ssrc); 1087 network_process_mbus(sp); 1088 1085 1089 ui_sampling_modes(sp); network_process_mbus(sp); 1086 1090 ui_converters(sp); network_process_mbus(sp); … … 1095 1099 ui_info_update_tool(sp, my_ssrc); network_process_mbus(sp); 1096 1100 ui_title(sp); network_process_mbus(sp); 1097 #ifdef NDEF /* This is done by load_settings() now... */1098 ui_load_settings(sp); network_process_mbus(sp);1099 #endif1100 1101 } 1101 1102 … … 1106 1107 } 1107 1108 1108 void1109 ui_controller_init(session_t *sp)1110 {1111 char my_ssrc[11];1112 1113 sprintf(my_ssrc, "\"%08x\"", rtp_my_ssrc(sp->rtp_session[0]));1114 mbus_qmsg(sp->mbus_engine, sp->mbus_ui_addr, "rtp.ssrc", my_ssrc, TRUE);1115 }1116 -
rat/trunk/ui.h
r2958 r3011 64 64 void ui_quit (struct s_session *s); 65 65 66 void ui_controller_init (struct s_session *s);67 68 66 #endif
