webrtc_sink: Update received video frame resolution 46/284746/1
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 23 Nov 2022 07:17:50 +0000 (16:17 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Fri, 25 Nov 2022 02:13:44 +0000 (02:13 +0000)
[Version] 0.3.265
[Issue Type] New feature

Change-Id: I3ec24e1a964e884d51263cb9e3966db7374eee0a
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/capi-media-webrtc.spec
src/webrtc_sink.c

index 7bbda3c47f9e43c6b9590b5c2f17694c83029fb0..5e5289628af235ef8a28c0d8da74a0fe4ac81d63 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.3.264
+Version:    0.3.265
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 56fea11dad6335cfde14c4ab420dbd08f5f4f7ac..aa44f780d879715678e97c2a86793eb842b53216 100644 (file)
@@ -125,6 +125,31 @@ static const char *__get_videosink_factory_name(webrtc_display_s *display, webrt
        return factory_name;
 }
 
+static void __videosink_caps_notify_cb(GstPad *pad, GParamSpec *unused, gpointer data)
+{
+       GstCaps *caps;
+       GstStructure *structure;
+       gint width = 0;
+       gint height = 0;
+       webrtc_gst_slot_s *sink = (webrtc_gst_slot_s *)data;
+
+       RET_IF(sink == NULL, "sink is NULL");
+
+       GET_CAPS_INFO_FROM_PAD(pad, caps);
+       structure = gst_caps_get_structure(caps, 0);
+
+       PRINT_CAPS(caps, "video sink pad");
+
+       gst_structure_get_int(structure, "width", &width);
+       gst_structure_get_int(structure, "height", &height);
+       LOG_INFO("width: %d, height: %d", width, height);
+
+       sink->video_info.width = width;
+       sink->video_info.height = height;
+
+       gst_caps_unref(caps);
+}
+
 static int __build_videosink(webrtc_s *webrtc, GstElement *decodebin, GstPad *src_pad)
 {
        webrtc_gst_slot_s *sink;
@@ -132,6 +157,7 @@ static int __build_videosink(webrtc_s *webrtc, GstElement *decodebin, GstPad *sr
        GstElement *capsfilter;
        GstElement *videosink;
        GstElement *link_to;
+       GstPad *sink_pad;
        const char *videosink_factory_name;
        GList *element_list = NULL;
        bool display_is_set;
@@ -238,6 +264,10 @@ static int __build_videosink(webrtc_s *webrtc, GstElement *decodebin, GstPad *sr
        if (display_is_set)
                sink->display->sink_element = videosink;
 
+       sink_pad = gst_element_get_static_pad(link_to, "sink");
+       _connect_and_append_signal(&sink->signals, (GObject *)sink_pad, "notify::caps", G_CALLBACK(__videosink_caps_notify_cb), (gpointer)sink);
+       gst_object_unref(GST_OBJECT(sink_pad));
+
        SAFE_G_LIST_FREE(element_list);
 
        return WEBRTC_ERROR_NONE;