]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fail over to default if desired stream is not found
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 29 Apr 2009 03:05:35 +0000 (03:05 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 29 Apr 2009 03:05:35 +0000 (03:05 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13184 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/formats/mod_local_stream/mod_local_stream.c

index 673c8744ad7e2a15c79ff81cd77d639679681e77..b78f1d5d0855473c129b21d32e2410689026419e 100644 (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);