webrtc_source_camera: Add CAMERA_DEVICE_TYPE_DUMMY for videotestsrc element 78/281578/1 accepted/tizen/unified/20220921.091800
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 20 Sep 2022 04:23:14 +0000 (13:23 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 20 Sep 2022 04:29:11 +0000 (13:29 +0900)
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 <sc11.lee@samsung.com>
packaging/capi-media-webrtc.spec
src/webrtc_source_camera.c

index 96e56f50f0f160eb1185bcff7945f11253422640..6a000544d4b44d9ad670edfa36c6fc28ee59066b 100644 (file)
@@ -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
index c0978e1dc236492aa6dd143090ec00e592b525b2..01e85d5fc6a97207ca6bc109dd4e6087bfa74a54 100644 (file)
@@ -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;