]> git.sesse.net Git - vlc/blobdiff - src/audio_output/common.c
Fix potential deadlock when changing audio channels (fixes #2240)
[vlc] / src / audio_output / common.c
index 8b8458057769ab226a87513fef617cf414fc36f4..116e51e96528c5962645f66de580128706305205 100644 (file)
@@ -117,10 +117,10 @@ static void aout_Destructor( vlc_object_t * p_this )
 /* Lock ordering rules:
  *
  *            Mixer Input IFIFO OFIFO (< Inner lock)
- * Mixer       No!   N/A   Yes   Yes
- * Input       N/A   No!   Yes   N/A
+ * Mixer       No!   Yes   Yes   Yes
+ * Input       No!   No!   Yes   Yes
  * In FIFOs    No!   No!   No!   Yes
- * Out FIFOs   No!   N/A   No!   No!
+ * Out FIFOs   No!   No!   No!   No!
  * (^ Outer lock)
  */
 #ifdef AOUT_DEBUG
@@ -136,14 +136,16 @@ void aout_lock (unsigned i)
             allowed = 0;
             break;
         case INPUT_LOCK:
-            allowed = 0;
+            allowed = MIXER_LOCK;
             break;
         case INPUT_FIFO_LOCK:
             allowed = MIXER_LOCK|INPUT_LOCK;
             break;
         case OUTPUT_FIFO_LOCK:
-            allowed = MIXER_LOCK|INPUT_FIFO_LOCK;
+            allowed = MIXER_LOCK|INPUT_LOCK|INPUT_FIFO_LOCK;
             break;
+        default:
+            abort ();
     }
 
     if (aout_locks & ~allowed)
@@ -151,7 +153,7 @@ void aout_lock (unsigned i)
         fprintf (stderr, "Illegal audio lock transition (%x -> %x)\n",
                  aout_locks, aout_locks|i);
         vlc_backtrace ();
-        //abort ();
+        abort ();
     }
     aout_locks |= i;
 }