From: hj kim Date: Fri, 23 Sep 2022 07:20:08 +0000 (+0900) Subject: webrtc_source_screen: move resolution setting code for screen source to webrtc_source... X-Git-Tag: accepted/tizen/unified/20220928.020833~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0d5cc75bc8a05740f310fee725e506a1461e18e2;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_source_screen: move resolution setting code for screen source to webrtc_source_screen.c setting the default video resolution to screen resolution is only required for screen source. [Version] 0.3.251 [Issue Type] Refactoring Change-Id: I25dbf22a6d8a8469705e6fee7c69bbd1369b2a32 --- diff --git a/include/webrtc_private.h b/include/webrtc_private.h index ede9a75e..b4be4588 100644 --- a/include/webrtc_private.h +++ b/include/webrtc_private.h @@ -696,7 +696,6 @@ int _update_pt_if_media_packet_source(webrtc_s *webrtc, webrtc_gst_slot_s *sourc /* screen source */ int _build_screensrc(webrtc_s *webrtc, webrtc_gst_slot_s *source); -int _get_screen_resolution(int *width, int *height); void _unset_screen_rotation_changed_cb(webrtc_s *webrtc); int _set_screen_source_crop(webrtc_s *webrtc, unsigned int source_id, int x, int y, int width, int height); int _unset_screen_source_crop(webrtc_s *webrtc, unsigned int source_id); diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 894622d2..d78e80c7 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.250 +Version: 0.3.251 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_source_private.c b/src/webrtc_source_private.c index dad638d6..ca63bb83 100644 --- a/src/webrtc_source_private.c +++ b/src/webrtc_source_private.c @@ -915,6 +915,8 @@ void _set_video_src_resolution(webrtc_gst_slot_s *source, int width, int height) source->video_info.width = width; source->video_info.height = height; + + LOG_DEBUG("video resolution is updated. width[%d] height[%d]", width, height); } GstCaps *_make_video_raw_caps_with_resolution(webrtc_gst_slot_s *source, webrtc_ini_s *ini, int width, int height) @@ -989,24 +991,5 @@ bool _set_default_video_info(webrtc_gst_slot_s *source, const ini_item_media_sou source->video_info.origin_height = ini_source->v_height; _set_video_src_resolution(source, ini_source->v_width, ini_source->v_height); - if (source->type == WEBRTC_MEDIA_SOURCE_TYPE_SCREEN) { -#ifdef TIZEN_FEATURE_UI - int width = 0; - int height = 0; - - if (_get_screen_resolution(&width, &height) != WEBRTC_ERROR_NONE) { - if (width == 0 || height == 0) { - LOG_WARNING("failed to _get_screen_resolution(). use values of ini"); - return true; - } - } - - source->video_info.origin_width = width; - source->video_info.origin_height = height; - _set_video_src_resolution(source, width, height); -#else - LOG_WARNING("TIZEN_FEATURE_UI is disabled, skip this function, use values of ini"); -#endif - } return true; } diff --git a/src/webrtc_source_screen.c b/src/webrtc_source_screen.c index a8204139..3ee9df96 100644 --- a/src/webrtc_source_screen.c +++ b/src/webrtc_source_screen.c @@ -140,7 +140,7 @@ int _unset_screen_source_crop(webrtc_s *webrtc, unsigned int source_id) return WEBRTC_ERROR_NONE; } -int _get_screen_resolution(int *width, int *height) +static int __get_screen_resolution(int *width, int *height) { int mm_ret; mm_display_interface_h mm_display; @@ -302,6 +302,22 @@ static bool __link_switch_srcs(GstElement *switch_element, GList *switch_src_lis return true; } +static void __update_video_resolution(webrtc_gst_slot_s *source) +{ + int width = 0; + int height = 0; + + RET_IF(source == NULL, "source is NULL"); + RET_IF(__get_screen_resolution(&width, &height) != WEBRTC_ERROR_NONE, "failed to __get_screen_resolution()"); + RET_IF(width == 0, "width is 0"); + RET_IF(height == 0, "height is 0"); + + source->video_info.origin_width = width; + source->video_info.origin_height = height; + + _set_video_src_resolution(source, width, height); +} + int _build_screensrc(webrtc_s *webrtc, webrtc_gst_slot_s *source) { int ret; @@ -331,6 +347,8 @@ int _build_screensrc(webrtc_s *webrtc, webrtc_gst_slot_s *source) if (!_set_default_video_info(source, ini_source)) return WEBRTC_ERROR_INVALID_OPERATION; + __update_video_resolution(source); + #ifndef TIZEN_TV if (!webrtc->rotate_info.sensor_listener) if ((ret = __set_screen_rotation_changed_cb(webrtc)) != WEBRTC_ERROR_NONE)