From: Sangchul Lee Date: Mon, 12 Jul 2021 00:21:08 +0000 (+0900) Subject: webrtc_source: Add missing error conditions X-Git-Tag: submit/tizen/20210729.023123~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c4086467ecd18f457e8aa6e6c11d84b4218db2c5;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_source: Add missing error conditions _set[get]_video_resolution() are revised to return an error in case of the file source type. [Version] 0.2.37 [Issue Type] Bug fix Change-Id: Ib12ead787d395199d999f9951072af6bf9306221 Signed-off-by: Sangchul Lee --- diff --git a/include/webrtc.h b/include/webrtc.h index a8f925c7..abb196cb 100644 --- a/include/webrtc.h +++ b/include/webrtc.h @@ -826,8 +826,8 @@ int webrtc_media_source_get_mute(webrtc_h webrtc, unsigned int source_id, webrtc /** * @brief Sets a video resolution to the media source. * @details The following media source types are for the video:\n - * #WEBRTC_MEDIA_SOURCE_TYPE_CAMERA\n * #WEBRTC_MEDIA_SOURCE_TYPE_VIDEOTEST\n + * #WEBRTC_MEDIA_SOURCE_TYPE_CAMERA\n * #WEBRTC_MEDIA_SOURCE_TYPE_SCREEN * @since_tizen 6.5 * @remarks If @a source_id does not support for the dynamic resolution change, #WEBRTC_ERROR_INVALID_OPERATION will be returned\n @@ -849,8 +849,8 @@ int webrtc_media_source_set_video_resolution(webrtc_h webrtc, unsigned int sourc /** * @brief Gets the video resolution of the media source. * @details The following media source types are for the video:\n - * #WEBRTC_MEDIA_SOURCE_TYPE_CAMERA\n * #WEBRTC_MEDIA_SOURCE_TYPE_VIDEOTEST\n + * #WEBRTC_MEDIA_SOURCE_TYPE_CAMERA\n * #WEBRTC_MEDIA_SOURCE_TYPE_SCREEN * @since_tizen 6.5 * @param[in] webrtc WebRTC handle diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 21008970..8a114014 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.2.36 +Version: 0.2.37 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_source.c b/src/webrtc_source.c index d06a8cde..3f2197c0 100644 --- a/src/webrtc_source.c +++ b/src/webrtc_source.c @@ -2091,6 +2091,7 @@ int _set_video_resolution(webrtc_s *webrtc, unsigned int source_id, int width, i RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "could not find source"); RET_VAL_IF((source->media_types & MEDIA_TYPE_VIDEO) == 0x0, WEBRTC_ERROR_INVALID_PARAMETER, "it's not a video source"); + RET_VAL_IF((source->type == WEBRTC_MEDIA_SOURCE_TYPE_FILE), WEBRTC_ERROR_INVALID_PARAMETER, "this API does not support the file source"); RET_VAL_IF((source->type == WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET), WEBRTC_ERROR_INVALID_PARAMETER, "this API does not support the media packet source"); if (webrtc->state != WEBRTC_STATE_IDLE) { @@ -2125,6 +2126,7 @@ int _get_video_resolution(webrtc_s *webrtc, unsigned int source_id, int *width, RET_VAL_IF(height == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "height is NULL"); RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "could not find source"); RET_VAL_IF((source->media_types & MEDIA_TYPE_VIDEO) == 0x0, WEBRTC_ERROR_INVALID_PARAMETER, "it's not a video source"); + RET_VAL_IF((source->type == WEBRTC_MEDIA_SOURCE_TYPE_FILE), WEBRTC_ERROR_INVALID_PARAMETER, "this API does not support the file source"); RET_VAL_IF((source->type == WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET), WEBRTC_ERROR_INVALID_PARAMETER, "this API does not support the media packet source"); *width = source->video_info.width;