From f651fb282cf880ad0cc21e11ee7f2e3a10ced9ef Mon Sep 17 00:00:00 2001 From: Sangchul Lee Date: Wed, 23 Nov 2022 16:17:50 +0900 Subject: [PATCH] webrtc_sink: Update received video frame resolution [Version] 0.3.265 [Issue Type] New feature Change-Id: I3ec24e1a964e884d51263cb9e3966db7374eee0a Signed-off-by: Sangchul Lee --- packaging/capi-media-webrtc.spec | 2 +- src/webrtc_sink.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 7bbda3c4..5e528962 100644 --- a/packaging/capi-media-webrtc.spec +++ b/packaging/capi-media-webrtc.spec @@ -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 diff --git a/src/webrtc_sink.c b/src/webrtc_sink.c index 56fea11d..aa44f780 100644 --- a/src/webrtc_sink.c +++ b/src/webrtc_sink.c @@ -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; -- 2.34.1