iOS: Cannot retrieve width & height via "check_media_size" method
Hello GStreamer community,
I am developing a native iOS application, which should be capable of displaying a live videostream. My code is based on the official GStreamer iOS tutorials.
The stream itself works. It is displayed and I am quite satisfied with resolution, FPS and latency of the stream.
But I am not able to get the following method - which was taken from the tutorials - to return the expected result:
static void check_media_size (GStreamerBackend *self) {
GstElement *video_sink;
GstPad *video_sink_pad;
GstCaps *caps;
GstVideoInfo info;
/* Retrieve the Caps at the entrance of the video sink */
g_object_get (self->pipeline, "video-sink", &video_sink, NULL);
video_sink_pad = gst_element_get_static_pad (video_sink, "sink");
caps = gst_pad_get_current_caps (video_sink_pad);
if (gst_video_info_from_caps (&info, caps)) {
NSLog(@"check_media_size - Media size is %dx%d, notifying application", info.width, info.height);
info.width = info.width * info.par_n / info.par_d;
GST_DEBUG ("Media size is %dx%d, notifying application", info.width, info.height);
if (self->ui_delegate && [self->ui_delegate respondsToSelector:@selector(mediaSizeChanged:height:)])
{
[self->ui_delegate mediaSizeChanged:info.width height:info.height];
}
}
gst_caps_unref(caps);
gst_object_unref (video_sink_pad);
gst_object_unref(video_sink);
}
The function call:
g_object_get (self->pipeline, "video-sink", &video_sink, NULL);
triggers the following warning:
(:22803): GLib-GObject-�[1;33mWARNING�[0m **: �[34m08:43:06.226�[0m: g_object_get_is_valid_property: object class 'GstPipeline' has no property named 'video-sink'
As a result, the next 2 lines of code also fail:
video_sink_pad = gst_element_get_static_pad (video_sink, "sink");
caps = gst_pad_get_current_caps (video_sink_pad);
(:22803): GStreamer-�[1;35mCRITICAL�[0m **: �[34m08:43:06.226�[0m: gst_element_get_static_pad: assertion 'GST_IS_ELEMENT (element)' failed.
(:22803): GStreamer-�[1;35mCRITICAL�[0m **: �[34m08:43:06.226�[0m: gst_pad_get_current_caps: assertion 'GST_IS_PAD (pad)' failed
and finally, the instruction in the if(...) block always returns false
if (gst_video_info_from_caps (&info, caps))
therefore, the code inside the if-block is never executed and there's no way to receive the media info (e.g. width & height) of the video being played.
I do not understand why the pipeline does not seem to have a "video-sink" property, but the stream itself works and is displayed.
Any help/hint would be appreciated.
Additional information
GStreamer version: I tested the behaviour with GStreamer 1.19.3 as well as 1.20.2.
On the server side (MacOs), I am running the following pipeline:
gst-launch-1.0 -v autovideosrc ! "video/x-raw,framerate=30/1" ! queue ! jpegenc ! queue ! rtpjpegpay ! udpsink host=<IP_ADDRESS> port=8003
On client side (iOS), this is the pipeline used to display the stream:
udpsrc port=8003 ! application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, a-framerate=(string)30.000000, payload=(int)26, ssrc=(uint)2661516146, timestamp-offset=(uint)3924289949, seqnum-offset=(uint)1975 ! rtpbin ! rtpjpegdepay ! queue ! jpegdec ! queue ! videoconvert ! autovideosink sync=false