webrtc_source_screen: move resolution setting code for screen source to webrtc_source... 24/281924/8
authorhj kim <backto.kim@samsung.com>
Fri, 23 Sep 2022 07:20:08 +0000 (16:20 +0900)
committerhaejeong kim <backto.kim@samsung.com>
Tue, 27 Sep 2022 01:46:29 +0000 (01:46 +0000)
setting the default video resolution to screen resolution is only required for screen source.

[Version] 0.3.251
[Issue Type] Refactoring

Change-Id: I25dbf22a6d8a8469705e6fee7c69bbd1369b2a32

include/webrtc_private.h
packaging/capi-media-webrtc.spec
src/webrtc_source_private.c
src/webrtc_source_screen.c

index ede9a75ed9020d09e6bda127c27e515509b8293a..b4be4588d150bd4111d6f984a505c185f3a6db9c 100644 (file)
@@ -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);
index 894622d2739f41f227d9f1c201060d4af13ae4cb..d78e80c77b7699ac9a608dab39a5c76a3f5c34bb 100644 (file)
@@ -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
index dad638d6ebae54f3389091d4f9f2d162f30c4824..ca63bb834960c1ca69cb064a3e9598089cf1c742 100644 (file)
@@ -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;
 }
index a8204139baa41e99a3a4f2141d53b5a130b09f8c..3ee9df969ce878f31c430256006306f896068fec 100644 (file)
@@ -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)