From: hj kim Date: Tue, 23 Aug 2022 07:18:12 +0000 (+0900) Subject: webrtc_source_screen: set proper video resolution after crop X-Git-Tag: submit/tizen/20220825.024408~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ef9a1d2546cb57bad49813f9ef3a9379e45995b;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_source_screen: set proper video resolution after crop [Version] 0.3.211 [Issue Type] Bug fix Change-Id: I34c33fd280ed88922ecef1ca3fa359fca9786fc1 --- diff --git a/include/webrtc_source_private.h b/include/webrtc_source_private.h index e9303736..7b6bc1be 100644 --- a/include/webrtc_source_private.h +++ b/include/webrtc_source_private.h @@ -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__ */ diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 3beba9e9..715e9d41 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.210 +Version: 0.3.211 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_source.c b/src/webrtc_source.c index b161cacf..c51b3e68 100644 --- a/src/webrtc_source.c +++ b/src/webrtc_source.c @@ -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); diff --git a/src/webrtc_source_private.c b/src/webrtc_source_private.c index 737d8d73..9c6020cc 100644 --- a/src/webrtc_source_private.c +++ b/src/webrtc_source_private.c @@ -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; +} diff --git a/src/webrtc_source_screen.c b/src/webrtc_source_screen.c index 8e438994..f4c897b8 100644 --- a/src/webrtc_source_screen.c +++ b/src/webrtc_source_screen.c @@ -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; }