From: Sangchul Lee Date: Tue, 20 Sep 2022 04:23:14 +0000 (+0900) Subject: webrtc_source_camera: Add CAMERA_DEVICE_TYPE_DUMMY for videotestsrc element X-Git-Tag: accepted/tizen/unified/20220921.091800^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1c29afa44a64c48dc9bd86c3717618f7ad1f8fa1;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_source_camera: Add CAMERA_DEVICE_TYPE_DUMMY for videotestsrc element A tizen emulator uses 'videotestsrc' element as a camera source. Now, we use 'pattern' property for device id in this case. This fixes UTC failures - set/get camera device id. [Version] 0.3.243 [Issue Type] Bug fix / UTC failure Change-Id: I36ca271ebb5543fdb88cc197b7cd3fc05936f59a Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 96e56f50..6a000544 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.242 +Version: 0.3.243 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_source_camera.c b/src/webrtc_source_camera.c index c0978e1d..01e85d5f 100644 --- a/src/webrtc_source_camera.c +++ b/src/webrtc_source_camera.c @@ -20,6 +20,7 @@ typedef enum { CAMERA_DEVICE_TYPE_V4L2, CAMERA_DEVICE_TYPE_TIZEN, + CAMERA_DEVICE_TYPE_DUMMY, } camera_device_type_e; typedef enum { @@ -37,6 +38,7 @@ typedef struct { static camera_info_s __camera_infos[] = { [CAMERA_DEVICE_TYPE_V4L2] = { "v4l2src", "device", "/dev/video", CAMERA_DEVICE_PROP_VAL_TYPE_STRING }, [CAMERA_DEVICE_TYPE_TIZEN] = { "camerasrc", "camera-id", NULL, CAMERA_DEVICE_PROP_VAL_TYPE_INT }, + [CAMERA_DEVICE_TYPE_DUMMY] = { "videotestsrc", "pattern", NULL, CAMERA_DEVICE_PROP_VAL_TYPE_INT }, /* this might be for the emulator */ }; static int __get_device_type(webrtc_s *webrtc, camera_device_type_e *type) @@ -48,7 +50,7 @@ static int __get_device_type(webrtc_s *webrtc, camera_device_type_e *type) RET_VAL_IF(type == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "type is NULL"); camera_factory_name = _get_source_element(webrtc, WEBRTC_MEDIA_SOURCE_TYPE_CAMERA); - for (i = CAMERA_DEVICE_TYPE_V4L2; i < CAMERA_DEVICE_TYPE_TIZEN + 1; i++) { + for (i = CAMERA_DEVICE_TYPE_V4L2; i < CAMERA_DEVICE_TYPE_DUMMY + 1; i++) { if (!strcmp(__camera_infos[i].factory_name, camera_factory_name)) { *type = (camera_device_type_e)i; return WEBRTC_ERROR_NONE; @@ -129,6 +131,8 @@ int _get_camera_device_id(webrtc_s *webrtc, unsigned int source_id, unsigned int if ((ret = __validate_source_and_get_camera_device_type(webrtc, source_id, &type, &camerasrc)) != WEBRTC_ERROR_NONE) return ret; + RET_VAL_IF(device_id == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "device_id is NULL"); + switch (__camera_infos[type].device_prop_value_type) { case CAMERA_DEVICE_PROP_VAL_TYPE_INT: { gint id;