summaryrefslogtreecommitdiff
path: root/sys/osxaudio
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2016-01-15 03:56:49 +0530
committerTim-Philipp Müller <tim@centricular.com>2016-01-14 22:32:09 +0000
commit6b760ead2af88aed91d128c2874ebcd556590084 (patch)
treed66602e91e68939de78d6582eab8532ce4085829 /sys/osxaudio
parent53c797d6046c131f751c69fe83e9fe65d8e0da95 (diff)
downloadgstreamer-plugins-good-6b760ead2af88aed91d128c2874ebcd556590084.tar.gz
osxaudio: Fix error handling when selecting/opening devices
Post an element error when the CoreAudio device cannot be selected or opened. Also ensure that we post a GST_ERROR with more detail.
Diffstat (limited to 'sys/osxaudio')
-rw-r--r--sys/osxaudio/gstosxaudioringbuffer.c15
-rw-r--r--sys/osxaudio/gstosxcoreaudiohal.c2
2 files changed, 14 insertions, 3 deletions
diff --git a/sys/osxaudio/gstosxaudioringbuffer.c b/sys/osxaudio/gstosxaudioringbuffer.c
index 2afcb5678..4201e045f 100644
--- a/sys/osxaudio/gstosxaudioringbuffer.c
+++ b/sys/osxaudio/gstosxaudioringbuffer.c
@@ -48,6 +48,7 @@
#endif
#include <gst/gst.h>
+#include <gst/gst-i18n-plugin.h>
#include <gst/audio/audio-channels.h>
#include "gstosxaudioringbuffer.h"
#include "gstosxaudiosink.h"
@@ -140,12 +141,22 @@ gst_osx_audio_ring_buffer_dispose (GObject * object)
static gboolean
gst_osx_audio_ring_buffer_open_device (GstAudioRingBuffer * buf)
{
+ GstObject *osxel = GST_OBJECT_PARENT (buf);
GstOsxAudioRingBuffer *osxbuf = GST_OSX_AUDIO_RING_BUFFER (buf);
- if (!gst_core_audio_select_device (osxbuf->core_audio))
+ if (!gst_core_audio_select_device (osxbuf->core_audio)) {
+ GST_ELEMENT_ERROR (osxel, RESOURCE, NOT_FOUND,
+ (_("CoreAudio device not found")), (NULL));
return FALSE;
+ }
- return gst_core_audio_open (osxbuf->core_audio);
+ if (!gst_core_audio_open (osxbuf->core_audio)) {
+ GST_ELEMENT_ERROR (osxel, RESOURCE, OPEN_READ,
+ (_("CoreAudio device could not be opened")), (NULL));
+ return FALSE;
+ }
+
+ return TRUE;
}
static gboolean
diff --git a/sys/osxaudio/gstosxcoreaudiohal.c b/sys/osxaudio/gstosxcoreaudiohal.c
index c1fefcc3c..36bd85efd 100644
--- a/sys/osxaudio/gstosxcoreaudiohal.c
+++ b/sys/osxaudio/gstosxcoreaudiohal.c
@@ -1238,7 +1238,7 @@ gst_core_audio_select_device_impl (GstCoreAudio * core_audio)
device_id = default_device_id;
res = TRUE;
} else {
- /* No device of required type available */
+ GST_ERROR ("No device of required type available");
res = FALSE;
}
} else {