[SCM] gsequencer/master: merged patches related to Bug#857948

jkraehemann-guest at users.alioth.debian.org jkraehemann-guest at users.alioth.debian.org
Thu Mar 16 15:51:34 UTC 2017


The following commit has been merged in the master branch:
commit 46d63686803937bb2fddc5a3ae1a0fa883cc484d
Author: Joël Krähemann <jkraehemann-guest at users.alioth.debian.org>
Date:   Thu Mar 16 16:51:22 2017 +0100

    merged patches related to Bug#857948

diff --git a/debian/patches/fix-missing-mutices.diff b/debian/patches/fix-missing-mutices.diff
new file mode 100644
index 0000000..6ee476e
--- /dev/null
+++ b/debian/patches/fix-missing-mutices.diff
@@ -0,0 +1,346 @@
+--- a/ags/audio/recall/ags_delay_audio_run.c
++++ b/ags/audio/recall/ags_delay_audio_run.c
+@@ -26,6 +26,8 @@
+ #include <ags/object/ags_soundcard.h>
+ #include <ags/object/ags_plugin.h>
+ 
++#include <ags/thread/ags_mutex_manager.h>
++
+ #include <ags/file/ags_file_stock.h>
+ #include <ags/file/ags_file_id_ref.h>
+ #include <ags/file/ags_file_lookup.h>
+@@ -441,16 +443,24 @@
+   AgsDelayAudio *delay_audio;
+   AgsDelayAudioRun *delay_audio_run;
+ 
++  AgsMutexManager *mutex_manager;
++  
+   gdouble notation_delay, sequencer_delay;
++  gdouble delay;
++  guint attack;
+ 
+   GValue value = { 0, };
+ 
++  pthread_mutex_t *application_mutex;
++  pthread_mutex_t *soundcard_mutex;
++  
+   AGS_RECALL_CLASS(ags_delay_audio_run_parent_class)->run_pre(recall);
+ 
+   //  g_message("ags_delay_audio_run_run_pre()\0");
+   
+   delay_audio_run = AGS_DELAY_AUDIO_RUN(recall);
+ 
++  /* check done */  
+   if((AGS_RECALL_PERSISTENT & (recall->flags)) == 0 &&
+      delay_audio_run->dependency_ref == 0){
+     delay_audio_run->notation_counter = 0;
+@@ -463,6 +473,17 @@
+ 
+   delay_audio = AGS_DELAY_AUDIO(AGS_RECALL_AUDIO_RUN(delay_audio_run)->recall_audio);
+ 
++  mutex_manager = ags_mutex_manager_get_instance();
++  application_mutex = ags_mutex_manager_get_application_mutex(mutex_manager);
++  
++  /* lookup soundcard mutex */
++  pthread_mutex_lock(application_mutex);
++  
++  soundcard_mutex = ags_mutex_manager_lookup(mutex_manager,
++					     recall->soundcard);
++  
++  pthread_mutex_unlock(application_mutex);
++
+   /* read notation-delay port */
+   g_value_init(&value, G_TYPE_DOUBLE);
+ 
+@@ -489,22 +510,22 @@
+   }else{
+     delay_audio_run->sequencer_counter += 1;
+   }
++  
++  /* delay and attack */
++  pthread_mutex_lock(soundcard_mutex);
++
++  attack = ags_soundcard_get_attack(AGS_SOUNDCARD(recall->soundcard));
++  
++  pthread_mutex_unlock(soundcard_mutex);
++  
++  delay = 0.0;
+ 
++  /* notation */
+   if(delay_audio_run->notation_counter == 0){    
+     guint run_order;
+-    gdouble delay;
+-    guint attack;
+ 
+     run_order = 0; //NOTE:JK: old hide_ref style
+ 
+-    /* delay and attack */
+-    //TODO:JK: unclear
+-    attack = ags_soundcard_get_attack(AGS_SOUNDCARD(recall->soundcard));
+-      
+-    delay = 0.0; // soundcard->delay[((soundcard->tic_counter + 1 == AGS_NOTATION_TICS_PER_BEAT) ?
+-      //		   0:
+-      //		   soundcard->tic_counter + 1)];
+-
+     //    g_message("ags_delay_audio_run_run_pre@%llu: alloc notation[%u]\0",
+     //	      delay_audio_run,
+     //	      run_order);
+@@ -521,8 +542,6 @@
+ 				       delay, attack);
+   }else{
+     guint run_order;
+-    gdouble delay;
+-    guint attack;
+ 
+     run_order = 0;
+     
+@@ -541,17 +560,9 @@
+ 				       delay, attack);
+   }
+ 
++  /* sequencer */
+   if(delay_audio_run->sequencer_counter == 0){
+     guint run_order;
+-    gdouble delay;
+-    guint attack;
+-
+-    /* delay and attack */
+-    //TODO:JK: unclear
+-    attack = ags_soundcard_get_attack(AGS_SOUNDCARD(recall->soundcard));
+-    delay = 0.0; // soundcard->delay[((soundcard->tic_counter + 1 == AGS_NOTATION_TICS_PER_BEAT) ?
+-      //		   0:
+-      //		   soundcard->tic_counter + 1)];
+ 
+     run_order = 0;
+ 
+@@ -572,8 +583,6 @@
+ 					delay, attack);
+   }else{
+     guint run_order;
+-    gdouble delay;
+-    guint attack;
+ 
+     run_order = 0;
+     
+--- a/ags/audio/recall/ags_count_beats_audio_run.c
++++ b/ags/audio/recall/ags_count_beats_audio_run.c
+@@ -1446,38 +1446,87 @@
+   }else{      
+     if(count_beats_audio_run->sequencer_counter >= (guint) loop_end - 1.0){
+       AgsAudio *audio;
++
++      AgsMutexManager *mutex_manager;
++
+       GList *playback;
+ 
++      pthread_mutex_t *application_mutex;
++      pthread_mutex_t *audio_mutex;
++      
++      audio = AGS_RECALL_AUDIO_RUN(count_beats_audio_run)->recall_audio->audio;
++
++      mutex_manager = ags_mutex_manager_get_instance();
++      application_mutex = ags_mutex_manager_get_application_mutex(mutex_manager);
++  
++      /* lookup audio mutex */
++      pthread_mutex_lock(application_mutex);
++  
++      audio_mutex = ags_mutex_manager_lookup(mutex_manager,
++					     audio);
++  
++      pthread_mutex_unlock(application_mutex);
++
++      /* reset sequencer counter */
+       count_beats_audio_run->sequencer_counter = 0;
+ 
+-      audio = AGS_RECALL_AUDIO_RUN(count_beats_audio_run)->recall_audio->audio;
++      /* get playback */
++      pthread_mutex_lock(audio_mutex);
++      
+       playback = AGS_PLAYBACK_DOMAIN(audio->playback_domain)->playback;
+ 
++      pthread_mutex_unlock(audio_mutex);
++      
+       /* emit stop signals */
+       ags_count_beats_audio_run_sequencer_stop(count_beats_audio_run,
+ 					       FALSE);
+ 
+       /* set done flag in soundcard play */
+       while(playback != NULL){
+-	if(AGS_PLAYBACK(playback->data)->recall_id[1] != NULL &&
+-	   AGS_PLAYBACK(playback->data)->recall_id[1]->recycling_context == AGS_RECALL(count_beats_audio_run)->recall_id->recycling_context){
+-	  AgsChannel *channel;
++	AgsChannel *channel;
++	AgsRecyclingContext *recycling_context;
++	
++	pthread_mutex_lock(audio_mutex);
++
++	channel = audio->output;
++	
++	if(AGS_PLAYBACK(playback->data)->recall_id[1] != NULL){
++	  recycling_context = AGS_PLAYBACK(playback->data)->recall_id[1]->recycling_context;
++	}else{
++	  recycling_context = NULL;
++	}
++
++	pthread_mutex_unlock(audio_mutex);
++
++	if(recycling_context == AGS_RECALL(count_beats_audio_run)->recall_id->recycling_context){
+ 	  AgsStreamChannelRun *stream_channel_run;
++	  
+ 	  GList *list;
+ 	  GList *recall_recycling_list, *recall_audio_signal_list;
++	  
+ 	  gboolean found;
+ 
++	  pthread_mutex_t *channel_mutex;
++
+ 	  //	    AGS_PLAYBACK(playback->data)->flags |= AGS_PLAYBACK_DONE;
+ 
++	  /* lookup channel mutex */
++	  pthread_mutex_lock(application_mutex);
++	  
++	  channel_mutex = ags_mutex_manager_lookup(mutex_manager,
++						   channel);
++	  
++	  pthread_mutex_unlock(application_mutex);
++
+ 	  /* check if to stop audio processing */
+-	  channel = audio->output;
+ 	  found = FALSE;
+ 
++	  pthread_mutex_lock(channel_mutex);
++	  
+ 	  list = channel->play;
+-
+ 	  list = ags_recall_find_type_with_recycling_context(list,
+ 							     AGS_TYPE_STREAM_CHANNEL_RUN,
+-							     (GObject *) AGS_RECALL(count_beats_audio_run)->recall_id->recycling_context);
++							     (GObject *) recycling_context);
+ 
+ 	  if(list != NULL){
+ 	    stream_channel_run = AGS_STREAM_CHANNEL_RUN(list->data);
+@@ -1500,6 +1549,8 @@
+ 	    }
+ 	  }
+ 
++	  pthread_mutex_unlock(channel_mutex);
++
+ 	  /* stop audio processing*/
+ 	  if(!found){
+ 	    ags_count_beats_audio_run_stop(count_beats_audio_run,
+@@ -1509,7 +1560,12 @@
+ 	  break;
+ 	}
+ 
+-	playback = playback->next;
++	/* iterate playback */
++	pthread_mutex_lock(audio_mutex);
++	
++      	playback = playback->next;
++
++	pthread_mutex_unlock(audio_mutex);
+       }
+ 
+       return;
+--- a/ags/audio/recall/ags_copy_pattern_channel_run.c
++++ b/ags/audio/recall/ags_copy_pattern_channel_run.c
+@@ -364,7 +364,7 @@
+ 						      gdouble delay, guint attack,
+ 						      AgsCopyPatternChannelRun *copy_pattern_channel_run)
+ {
+-  AgsChannel *output, *source;
++  AgsChannel *source;
+   AgsPattern *pattern;
+   AgsCopyPatternAudio *copy_pattern_audio;
+   AgsCopyPatternAudioRun *copy_pattern_audio_run;
+@@ -380,7 +380,8 @@
+ 
+   pthread_mutex_t *application_mutex;
+   pthread_mutex_t *pattern_mutex;
+-
++  pthread_mutex_t *source_mutex;
++  
+   if(delay != 0.0){
+     return;
+   }
+@@ -440,34 +441,66 @@
+ 
+   /*  */
+   if(current_bit){
++    AgsChannel *link;
+     AgsRecycling *recycling;
++    AgsRecycling *end_recycling;
+     AgsAudioSignal *audio_signal;
+ 
+     gdouble delay;
+     guint attack;
+   
++    pthread_mutex_t *link_mutex;
++    
+     //    g_message("ags_copy_pattern_channel_run_sequencer_alloc_callback - playing channel: %u; playing pattern: %u\0",
+     //	      AGS_RECALL_CHANNEL(copy_pattern_channel)->source->line,
+     //	      copy_pattern_audio_run->count_beats_audio_run->sequencer_counter);
+ 
+     /* get source */
+     source = AGS_RECALL_CHANNEL(copy_pattern_channel)->source;
++
++    pthread_mutex_lock(application_mutex);
++  
++    source_mutex = ags_mutex_manager_lookup(mutex_manager,
++					    (GObject *) source);
++    
++    pthread_mutex_unlock(application_mutex);
++    
++    /* source fields */
++    pthread_mutex_lock(source_mutex);
++
++    link = source->link;
+     
+-    /* create new audio signals */
+     recycling = source->first_recycling;
++
++    if(recycling != NULL){
++      end_recycling = source->last_recycling->next;
++    }
+     
+-    //TODO:JK: unclear
++    pthread_mutex_unlock(source_mutex);
+ 
++    /* link */
++    if(link != NULL){
++      pthread_mutex_lock(application_mutex);
++      
++      link_mutex = ags_mutex_manager_lookup(mutex_manager,
++					    (GObject *) link);
++      
++      pthread_mutex_unlock(application_mutex);
++    }
++
++    /* create audio signals */
+     if(recycling != NULL){
+       AgsRecallID *child_recall_id;
+ 
+-      while(recycling != source->last_recycling->next){
+-	if(source->link == NULL){
++      while(recycling != end_recycling){
++	if(link == NULL){
+ 	  child_recall_id = AGS_RECALL(copy_pattern_channel_run)->recall_id;
+ 	}else{
+ 	  GList *list;
+ 
+-	  list = source->link->recall_id;
++	  pthread_mutex_lock(link_mutex);
++	  
++	  list = link->recall_id;
+ 
+ 	  while(list != NULL){
+ 	    if(AGS_RECALL_ID(list->data)->recycling_context->parent == AGS_RECALL(copy_pattern_channel_run)->recall_id->recycling_context){
+@@ -481,6 +514,8 @@
+ 	  if(list == NULL){
+ 	    child_recall_id = NULL;
+ 	  }
++
++	  pthread_mutex_unlock(link_mutex);
+ 	}
+ 
+ 	audio_signal = ags_audio_signal_new(AGS_RECALL(copy_pattern_audio)->soundcard,
diff --git a/debian/patches/series b/debian/patches/series
index 1c10ee0..2580cd0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -13,9 +13,7 @@ fix-pad-callbacks.patch
 fix-export-soundcard-callbacks.patch
 fix-jack-devout.patch
 fix-jack-client.patch
-fix-delay-audio-run.patch
-fix-count-beats-audio-run.patch
-fix-copy-pattern-channel-run.patch
+fix-missing-mutices.diff
 fix-clear-buffer-h.patch
 fix-clear-buffer-c.patch
 fix-devout.patch

-- 
gsequencer packaging



More information about the pkg-multimedia-commits mailing list