Author: anthm Date: Tue Apr 28 22:05:35 2009 New Revision: 13184 Log: fail over to default if desired stream is not found Modified: freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c Modified: freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c ============================================================================== --- freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c (original) +++ freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c Tue Apr 28 22:05:35 2009 @@ -301,6 +301,8 @@ return SWITCH_STATUS_FALSE; } + top: + alt_path = switch_mprintf("%s/%d", path, handle->samplerate); switch_mutex_lock(globals.mutex); @@ -313,6 +315,13 @@ if (switch_thread_rwlock_tryrdlock(source->rwlock) != SWITCH_STATUS_SUCCESS) { source = NULL; } + } else { + if (!switch_stristr("default", alt_path) && !switch_stristr("default", path)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown source %s, trying 'default'\n", path); + free(alt_path); + path = "default"; + goto top; + } } switch_mutex_unlock(globals.mutex);