]> git.sesse.net Git - mlt/blobdiff - src/modules/jackrack/process.c
Fix crash for mlt_audio_f32le and other formats that were not covered
[mlt] / src / modules / jackrack / process.c
index 1b62755c13f7dae2b2e2121bb3434b53caeb99c1..6d29571a1c7d2ef166e2f2f3d9382b92b0a848d5 100644 (file)
@@ -43,6 +43,8 @@
 #define _(x) x
 #endif
 
+extern pthread_mutex_t g_activate_mutex;
+
 #define USEC_PER_SEC         1000000
 #define MSEC_PER_SEC         1000
 #define TIME_RUN_SKIP_COUNT  5
@@ -204,7 +206,8 @@ connect_chain (process_info_t * procinfo, jack_nframes_t frames)
     }
 
   /* input buffers for first plugin */
-  plugin_connect_input_ports (first_enabled, procinfo->jack_input_buffers);
+  if( plugin->desc->has_input )
+    plugin_connect_input_ports (first_enabled, procinfo->jack_input_buffers);
 }
 
 void
@@ -311,13 +314,15 @@ int process_ladspa (process_info_t * procinfo, jack_nframes_t frames,
   
   for (channel = 0; channel < procinfo->channels; channel++)
     {
-      procinfo->jack_input_buffers[channel] = inputs[channel];
-      if (!procinfo->jack_input_buffers[channel])
+      if(get_first_enabled_plugin (procinfo)->desc->has_input)
         {
-          mlt_log_verbose( NULL, "%s: no jack buffer for input port %ld\n", __FUNCTION__, channel);
-          return 1;
+          procinfo->jack_input_buffers[channel] = inputs[channel];
+          if (!procinfo->jack_input_buffers[channel])
+            {
+              mlt_log_verbose( NULL, "%s: no jack buffer for input port %ld\n", __FUNCTION__, channel);
+              return 1;
+            }
         }
-
       procinfo->jack_output_buffers[channel] = outputs[channel];
       if (!procinfo->jack_output_buffers[channel])
         {
@@ -378,7 +383,7 @@ process_info_connect_jack (process_info_t * procinfo)
 {
   mlt_log_info( NULL, _("Connecting to JACK server with client name '%s'\n"), procinfo->jack_client_name);
 
-  procinfo->jack_client = jack_client_new (procinfo->jack_client_name);
+  procinfo->jack_client = jack_client_open (procinfo->jack_client_name, JackNullOption, NULL);
 
   if (!procinfo->jack_client)
     {
@@ -571,7 +576,9 @@ process_info_new (const char * client_name, unsigned long rack_channels,
   buffer_size = jack_get_sample_rate (procinfo->jack_client);
   
   jack_set_process_callback (procinfo->jack_client, process_jack, procinfo);
+  pthread_mutex_lock( &g_activate_mutex );
   jack_on_shutdown (procinfo->jack_client, jack_shutdown_cb, procinfo);
+  pthread_mutex_unlock( &g_activate_mutex );
   
   jack_activate (procinfo->jack_client);