@@ -176,17 +176,16 @@ static gboolean on_appsink_new_event(GstAppSink *appsink, gpointer userdata) {
176176 return FALSE;
177177}
178178
179- #if THIS_GSTREAMER_VER >= GSTREAMER_VER (1 , 24 , 0 )
180- static gboolean on_appsink_propose_allocation (GstAppSink * appsink , GstQuery * query , gpointer userdata ) {
179+ UNUSED static gboolean on_appsink_propose_allocation (GstAppSink * appsink , GstQuery * query , gpointer userdata ) {
181180 (void ) appsink ;
182181 (void ) userdata ;
183182
184183 gst_query_add_allocation_meta (query , GST_VIDEO_META_API_TYPE , NULL );
185184
186185 return FALSE;
187186}
188- #else
189- static GstPadProbeReturn on_query_appsink_pad (GstPad * pad , GstPadProbeInfo * info , void * userdata ) {
187+
188+ UNUSED static GstPadProbeReturn on_query_appsink_pad (GstPad * pad , GstPadProbeInfo * info , void * userdata ) {
190189 GstQuery * query ;
191190
192191 (void ) pad ;
@@ -206,7 +205,6 @@ static GstPadProbeReturn on_query_appsink_pad(GstPad *pad, GstPadProbeInfo *info
206205
207206 return GST_PAD_PROBE_HANDLED ;
208207}
209- #endif
210208
211209GstElement * flutter_gl_texture_sink_new (struct texture * texture , struct gl_renderer * renderer ) {
212210 ASSERT_NOT_NULL (texture );
@@ -264,19 +262,23 @@ GstElement *flutter_gl_texture_sink_new(struct texture *texture, struct gl_rende
264262
265263#if THIS_GSTREAMER_VER >= GSTREAMER_VER (1 , 24 , 0 )
266264 cbs .propose_allocation = on_appsink_propose_allocation ;
267- #else
268- GstPad * pad = gst_element_get_static_pad (sink , "sink" );
269- if (pad == NULL ) {
270- LOG_ERROR ("Couldn't get static pad `sink` from appsink.\n" );
271- frame_interface_unref (meta -> interface );
272- gst_object_unref (element );
273- free (meta );
274- return NULL ;
275- }
276-
277- gst_pad_add_probe (pad , GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM , on_query_appsink_pad , NULL );
278265#endif
279266
267+ // If instead of conditional compilation so
268+ // this is type-checked even for >= 1.24.0.
269+ if (THIS_GSTREAMER_VER < GSTREAMER_VER (1 , 24 , 0 )) {
270+ GstPad * pad = gst_element_get_static_pad (element , "sink" );
271+ if (pad == NULL ) {
272+ LOG_ERROR ("Couldn't get static pad `sink` from appsink.\n" );
273+ frame_interface_unref (meta -> interface );
274+ gst_object_unref (element );
275+ free (meta );
276+ return NULL ;
277+ }
278+
279+ gst_pad_add_probe (pad , GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM , on_query_appsink_pad , NULL , NULL );
280+ }
281+
280282 gst_app_sink_set_callbacks (
281283 GST_APP_SINK (appsink ),
282284 & cbs ,
0 commit comments