From 11d6be2dcb51878ea04dc0d2cda9ee11ace1fcd5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 22 Dec 2014 15:33:51 +0100 Subject: [PATCH] osxaudio: Directly return the ringbuffer's caps if it is acquired --- sys/osxaudio/gstosxaudiosink.c | 11 ++++------- sys/osxaudio/gstosxaudiosrc.c | 11 ++++------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/sys/osxaudio/gstosxaudiosink.c b/sys/osxaudio/gstosxaudiosink.c index e1b7e0f..bd373fa 100644 --- a/sys/osxaudio/gstosxaudiosink.c +++ b/sys/osxaudio/gstosxaudiosink.c @@ -363,15 +363,12 @@ gst_osx_audio_sink_getcaps (GstBaseSink * sink, GstCaps * filter) if (buf) { GST_OBJECT_LOCK (buf); - if (buf->acquired) { + if (buf->acquired && buf->spec.caps) { /* Caps are fixed, use what we have */ - ret = gst_pad_get_current_caps (GST_BASE_SINK_PAD (sink)); - if (!ret) { - GST_OBJECT_UNLOCK (buf); - g_return_val_if_reached (NULL); - } + ret = gst_caps_ref (buf->spec.caps); + } - } else if (buf->open && !osxsink->cached_caps) { + if (!ret && buf->open && !osxsink->cached_caps) { /* Device is open, let's probe its caps */ gst_osx_audio_sink_probe_caps (osxsink); } diff --git a/sys/osxaudio/gstosxaudiosrc.c b/sys/osxaudio/gstosxaudiosrc.c index 670ec62..a179882 100644 --- a/sys/osxaudio/gstosxaudiosrc.c +++ b/sys/osxaudio/gstosxaudiosrc.c @@ -318,15 +318,12 @@ gst_osx_audio_src_get_caps (GstBaseSrc * src, GstCaps * filter) if (buf) { GST_OBJECT_LOCK (buf); - if (buf->acquired) { + if (buf->acquired && buf->spec.caps) { /* Caps are fixed, use what we have */ - ret = gst_pad_get_current_caps (GST_BASE_SINK_PAD (src)); - if (!ret) { - GST_OBJECT_UNLOCK (buf); - g_return_val_if_reached (NULL); - } + ret = gst_caps_ref (buf->spec.caps); + } - } else if (buf->open && !osxsrc->cached_caps) { + if (!ret && buf->open && !osxsrc->cached_caps) { /* Device is open, let's probe its caps */ gst_osx_audio_src_probe_caps (osxsrc); } -- 2.7.4