osxvideosink: Use gst_pad_push_event() and post navigation messages

Use gst_pad_push_event() instead of manually getting peer pad and calling
gst_pad_send_event() otherwise the pad probe on the sinkpad wouldn't get the
events.

Also ensure navigation events are posted to the bus even when gst_pad_push_event()
fails in the render function, so navigation remains functional regardless
of rendering issues.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9130>
This commit is contained in:
Thibault Saunier 2025-05-08 00:10:42 -04:00 committed by GStreamer Marge Bot
parent 41f7d94e8d
commit dab38ddaac

View File

@ -454,7 +454,6 @@ gst_osx_video_sink_navigation_send_event (GstNavigation * navigation,
GstStructure * structure)
{
GstOSXVideoSink *osxvideosink = GST_OSX_VIDEO_SINK (navigation);
GstPad *peer;
GstEvent *event;
GstVideoRectangle src = { 0, };
GstVideoRectangle dst = { 0, };
@ -462,9 +461,7 @@ gst_osx_video_sink_navigation_send_event (GstNavigation * navigation,
NSRect bounds;
gdouble x, y, xscale = 1.0, yscale = 1.0;
peer = gst_pad_get_peer (GST_VIDEO_SINK_PAD (osxvideosink));
if (!peer || !osxvideosink->osxwindow)
if (!osxvideosink->osxwindow)
return;
event = gst_event_new_navigation (structure);
@ -508,8 +505,12 @@ gst_osx_video_sink_navigation_send_event (GstNavigation * navigation,
(gdouble) y * yscale, NULL);
}
gst_pad_send_event (peer, event);
gst_object_unref (peer);
gst_event_ref (event);
if (!gst_pad_push_event (GST_VIDEO_SINK_PAD (osxvideosink), event)) {
gst_element_post_message (GST_ELEMENT_CAST (osxvideosink),
gst_navigation_message_new_event (GST_OBJECT_CAST (osxvideosink), event));
}
gst_event_unref (event);
}
static void