webrtc_source: Add missing error conditions 92/261092/1
authorSangchul Lee <sc11.lee@samsung.com>
Mon, 12 Jul 2021 00:21:08 +0000 (09:21 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 12 Jul 2021 00:22:38 +0000 (09:22 +0900)
_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 <sc11.lee@samsung.com>
include/webrtc.h
packaging/capi-media-webrtc.spec
src/webrtc_source.c

index a8f925c7f209e4e9de582c7acb6ffd3a95fbae13..abb196cbdcbe675657051cf043328ab8a020daa6 100644 (file)
@@ -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
index 2100897078d04db65b10edad73fb618200d28e43..8a114014ae689bf8a72d44f46cb5da61bb6e45e1 100644 (file)
@@ -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
index d06a8cde5995cadf5e69a3c7e39c1b22c93fb8fc..3f2197c0ade593d84092ef2b2054b99bb4e0b5bb 100644 (file)
@@ -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;