audio: More UNPOSITION flag sanity checks
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 11 Jan 2012 09:49:49 +0000 (10:49 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 11 Jan 2012 09:49:49 +0000 (10:49 +0100)
..and turn the GST_WARNING() into a g_warning(). This is a programming
error and should be fixed.

gst-libs/gst/audio/audio.c

index 2075373..cdf39d4 100644 (file)
@@ -676,7 +676,13 @@ gst_audio_info_to_caps (const GstAudioInfo * info)
   if ((flags & GST_AUDIO_FLAG_UNPOSITIONED) && info->channels > 1
       && info->position[0] != GST_AUDIO_CHANNEL_POSITION_NONE) {
     flags &= ~GST_AUDIO_FLAG_UNPOSITIONED;
-    GST_WARNING ("Unpositioned flag set but channel positions present");
+    g_warning ("Unpositioned audio channel position flag set but "
+        "channel positions present");
+  } else if (!(flags & GST_AUDIO_FLAG_UNPOSITIONED) && info->channels > 1
+      && info->position[0] == GST_AUDIO_CHANNEL_POSITION_NONE) {
+    flags |= GST_AUDIO_FLAG_UNPOSITIONED;
+    g_warning ("Unpositioned audio channel position flag not set "
+        "but no channel positions present");
   }
 
   caps = gst_caps_new_simple ("audio/x-raw",