vtl: clean-up "Remove Video" action state
[ardour.git] / gtk2_ardour / ardour_ui.cc
index fd75481af521b0e56a1ec0a6a59dd23bc7fae923..ad727d00d6c6f8eb7d54d48b4a64d9661e0a2cd4 100644 (file)
@@ -813,13 +813,13 @@ ARDOUR_UI::check_memory_locking ()
                                                  "runs out of memory. \n\n"
                                                  "You can view the memory limit with 'ulimit -l', "
                                                  "and it is normally controlled by %2"),
-                                               PROGRAM_NAME).c_str()
+                                               PROGRAM_NAME, 
 #ifdef __FreeBSD__
-                                       X_("/etc/login.conf")
+                                               X_("/etc/login.conf")
 #else
-                                       X_(" /etc/security/limits.conf")
+                                               X_(" /etc/security/limits.conf")
 #endif
-                                       );
+                                       ).c_str());
 
                                msg.set_default_response (RESPONSE_OK);
 
@@ -3423,9 +3423,28 @@ ARDOUR_UI::start_video_server (Gtk::Window* float_window, bool popup_msg)
                        Config->set_video_advanced_setup(true);
                }
 
+               if (video_server_process) {
+                       delete video_server_process;
+               }
+
                video_server_process = new SystemExec(icsd_exec, argp);
-               video_server_process->start();
-               sleep(1);
+               if (video_server_process->start()) {
+                       warning << _("Cannot launch the video-server") << endmsg;
+                       continue;
+               }
+               int timeout = 120; // 6 sec
+               while (!ARDOUR_UI::instance()->video_timeline->check_server()) {
+                       usleep (50000);
+                       if (--timeout <= 0 || !video_server_process->is_running()) break;
+               }
+               if (timeout <= 0) {
+                       warning << _("Video-server was started but does not respond to requests...") << endmsg;
+               } else {
+                       if (!ARDOUR_UI::instance()->video_timeline->check_server_docroot()) {
+                               delete video_server_process;
+                               video_server_process = 0;
+                       }
+               }
        }
        return true;
 }