osxaudio: Directly return the ringbuffer's caps if it is acquired

This commit is contained in:
Sebastian Dröge 2014-12-22 15:33:51 +01:00
parent fc1670b75d
commit 11d6be2dcb
2 changed files with 8 additions and 14 deletions

View file

@ -363,15 +363,12 @@ gst_osx_audio_sink_getcaps (GstBaseSink * sink, GstCaps * filter)
if (buf) { if (buf) {
GST_OBJECT_LOCK (buf); GST_OBJECT_LOCK (buf);
if (buf->acquired) { if (buf->acquired && buf->spec.caps) {
/* Caps are fixed, use what we have */ /* Caps are fixed, use what we have */
ret = gst_pad_get_current_caps (GST_BASE_SINK_PAD (sink)); ret = gst_caps_ref (buf->spec.caps);
if (!ret) { }
GST_OBJECT_UNLOCK (buf);
g_return_val_if_reached (NULL);
}
} else if (buf->open && !osxsink->cached_caps) { if (!ret && buf->open && !osxsink->cached_caps) {
/* Device is open, let's probe its caps */ /* Device is open, let's probe its caps */
gst_osx_audio_sink_probe_caps (osxsink); gst_osx_audio_sink_probe_caps (osxsink);
} }

View file

@ -318,15 +318,12 @@ gst_osx_audio_src_get_caps (GstBaseSrc * src, GstCaps * filter)
if (buf) { if (buf) {
GST_OBJECT_LOCK (buf); GST_OBJECT_LOCK (buf);
if (buf->acquired) { if (buf->acquired && buf->spec.caps) {
/* Caps are fixed, use what we have */ /* Caps are fixed, use what we have */
ret = gst_pad_get_current_caps (GST_BASE_SINK_PAD (src)); ret = gst_caps_ref (buf->spec.caps);
if (!ret) { }
GST_OBJECT_UNLOCK (buf);
g_return_val_if_reached (NULL);
}
} else if (buf->open && !osxsrc->cached_caps) { if (!ret && buf->open && !osxsrc->cached_caps) {
/* Device is open, let's probe its caps */ /* Device is open, let's probe its caps */
gst_osx_audio_src_probe_caps (osxsrc); gst_osx_audio_src_probe_caps (osxsrc);
} }