webrtc_source_screen: set proper video resolution after crop 74/280074/4
authorhj kim <backto.kim@samsung.com>
Tue, 23 Aug 2022 07:18:12 +0000 (16:18 +0900)
committerhj kim <backto.kim@samsung.com>
Wed, 24 Aug 2022 02:42:38 +0000 (11:42 +0900)
[Version] 0.3.211
[Issue Type] Bug fix

Change-Id: I34c33fd280ed88922ecef1ca3fa359fca9786fc1

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

index e93037362ff905f8bc90d26aa9891b0c791866a0..7b6bc1be8ad68162b026b2dc9f27284f963e9152 100644 (file)
@@ -113,5 +113,6 @@ int _set_encoder_element_bitrate(GstElement *encoder, int target_bitrate);
 int _get_encoder_element_bitrate(GstElement *encoder, int *target_bitrate);
 void _set_caps_for_render(webrtc_gst_slot_s *source, GstCaps *caps, int av_idx);
 void _unset_caps_for_render(webrtc_gst_slot_s *source, int av_idx);
+void _set_video_src_resolution(webrtc_gst_slot_s *source, int width, int height);
 
 #endif /* __TIZEN_MEDIA_WEBRTC_SOURCE_COMMON_H__ */
index 3beba9e9ce5b56e632cc9b07a3d8bf179f87c1e9..715e9d4155561d9aca1dede25da133a568cfcabe 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.3.210
+Version:    0.3.211
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index b161cacf07626fcecbe488ec93cd07686345852e..c51b3e68fde4709e25b9f0602978eecd63a6d113 100644 (file)
@@ -142,8 +142,7 @@ static bool __set_default_video_info(webrtc_gst_slot_s *source, const ini_item_m
        source->video_info.framerate = ini_source->v_framerate;
        source->video_info.origin_width = ini_source->v_width;
        source->video_info.origin_height = ini_source->v_height;
-       source->video_info.width = ini_source->v_width;
-       source->video_info.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
@@ -159,8 +158,7 @@ static bool __set_default_video_info(webrtc_gst_slot_s *source, const ini_item_m
 
                source->video_info.origin_width = width;
                source->video_info.origin_height = height;
-               source->video_info.width = width;
-               source->video_info.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
@@ -1448,8 +1446,7 @@ int _set_video_resolution(webrtc_s *webrtc, unsigned int source_id, int width, i
                _set_caps_for_render(source, new_caps, AV_IDX_VIDEO);
        }
 
-       source->video_info.width = width;
-       source->video_info.height = height;
+       _set_video_src_resolution(source, width, height);
 
        LOG_INFO("webrtc[%p], source_id[%u], [%dx%d]", webrtc, source_id, width, height);
 
index 737d8d7375649efd45091f4ebfaed8737e74397b..9c6020cc95c506390734f3c8a5ec1451b2227c87 100644 (file)
@@ -1211,3 +1211,11 @@ void _unset_caps_for_render(webrtc_gst_slot_s *source, int av_idx)
        gst_caps_unref(source->av[av_idx].render.appsrc_caps);
        source->av[av_idx].render.appsrc_caps = NULL;
 }
+
+void _set_video_src_resolution(webrtc_gst_slot_s *source, int width, int height)
+{
+       RET_IF(source == NULL, "source is NULL");
+
+       source->video_info.width = width;
+       source->video_info.height = height;
+}
index 8e43899468795e791faee676fb605db13e427141..f4c897b81b837565dbad330c27b2c59e284748db 100644 (file)
@@ -79,8 +79,10 @@ int _set_screen_source_crop(webrtc_s *webrtc, unsigned int source_id, int x, int
 
        *width = output_width - (left + right);
        *height = output_height - (top + bottom);
-       LOG_INFO("source_id[%u], video resolution is changed [%dx%d] ==> [%dx%d]", source_id,
-                       output_width, output_height, *width, *height);
+
+       _set_video_src_resolution(source, *width, *height);
+
+       LOG_INFO("source_id[%u], video resolution is changed [%dx%d] ==> [%dx%d]", source_id, output_width, output_height, *width, *height);
 
        return WEBRTC_ERROR_NONE;
 }
@@ -118,6 +120,8 @@ int _unset_screen_source_crop(webrtc_s *webrtc, unsigned int source_id)
                "bottom", 0,
                NULL);
 
+       _set_video_src_resolution(source, source->video_info.origin_width, source->video_info.origin_height);
+
        return WEBRTC_ERROR_NONE;
 }