diff --git a/dom/media/gstreamer/GStreamerFormatHelper.cpp b/dom/media/gstreamer/GStreamerFormatHelper.cpp index ebd12c233c0..2ee32e53c04 100644 --- a/dom/media/gstreamer/GStreamerFormatHelper.cpp +++ b/dom/media/gstreamer/GStreamerFormatHelper.cpp @@ -279,7 +279,11 @@ static bool SupportsCaps(GstElementFactory *aFactory, GstCaps *aCaps) continue; } - if (gst_caps_can_intersect(gst_static_caps_get(&templ->static_caps), aCaps)) { + bool supported = gst_caps_can_intersect(caps, aCaps); + + gst_caps_unref(caps); + + if (supported) { return true; } } @@ -307,11 +311,11 @@ bool GStreamerFormatHelper::HaveElementsToProcessCaps(GstCaps* aCaps) { } } + gst_caps_unref(caps); + if (!found) { return false; } - - gst_caps_unref(caps); } return true;