fail over to default if desired stream is not found

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13184 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-04-29 03:05:35 +00:00
parent 6704139f65
commit c66dc3de19
1 changed files with 9 additions and 0 deletions

View File

@ -301,6 +301,8 @@ static switch_status_t local_stream_file_open(switch_file_handle_t *handle, cons
return SWITCH_STATUS_FALSE;
}
top:
alt_path = switch_mprintf("%s/%d", path, handle->samplerate);
switch_mutex_lock(globals.mutex);
@ -313,6 +315,13 @@ static switch_status_t local_stream_file_open(switch_file_handle_t *handle, cons
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);