diff options
author | Dave Craig <dcraig@brightsign.biz> | 2015-12-16 12:40:39 +0000 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2016-02-23 18:11:42 +0200 |
commit | 211c8492b35d1e58033d9104ec8b52d497f475fb (patch) | |
tree | d288d1b1e858c6a4754f8f23fae5d462ef69a42a /ext | |
parent | 6cdbf406224494335940b2ac9ab9354453406ed3 (diff) | |
download | gstreamer-plugins-good-211c8492b35d1e58033d9104ec8b52d497f475fb.tar.gz |
gst: Don't assume that get_current_caps() returns non-NULL caps after has_current_caps()
Remove calls to gst_pad_has_current_caps() which then go on to call
gst_pad_get_current_caps() as the caps can go to NULL in between. Instead just
use gst_pad_get_current_caps() and check for NULL.
https://bugzilla.gnome.org/show_bug.cgi?id=759539
Diffstat (limited to 'ext')
-rw-r--r-- | ext/flac/gstflacenc.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/ext/flac/gstflacenc.c b/ext/flac/gstflacenc.c index dae0172a0..0e3940fa6 100644 --- a/ext/flac/gstflacenc.c +++ b/ext/flac/gstflacenc.c @@ -766,9 +766,8 @@ gst_flac_enc_getcaps (GstAudioEncoder * enc, GstCaps * filter) pad = GST_AUDIO_ENCODER_SINK_PAD (enc); - if (gst_pad_has_current_caps (pad)) { - ret = gst_pad_get_current_caps (pad); - } else { + ret = gst_pad_get_current_caps (pad); + if (ret == NULL) { ret = gst_pad_get_pad_template_caps (pad); } @@ -1281,9 +1280,8 @@ gst_flac_enc_sink_query (GstAudioEncoder * enc, GstQuery * query) case GST_QUERY_ACCEPT_CAPS:{ GstCaps *acceptable, *caps; - if (gst_pad_has_current_caps (pad)) { - acceptable = gst_pad_get_current_caps (pad); - } else { + acceptable = gst_pad_get_current_caps (pad); + if (acceptable == NULL) { acceptable = gst_pad_get_pad_template_caps (pad); } |