webrtc_test: Revise layout for rendering surfaces 37/260237/2
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 22 Jun 2021 09:25:29 +0000 (18:25 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 23 Jun 2021 06:00:45 +0000 (15:00 +0900)
It is limited to evas surface type.

[Version] 0.2.20
[Issue Type] Improvement

Change-Id: I5e8ce24ba096897dd144727614da8093c29eea8a
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/capi-media-webrtc.spec
test/webrtc_test.c

index f0fbf8f2debc78f17738e50a778b984fdc43da29..35e09dabe52f2aab0ea87200d83f9dbefb9f871a 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.2.19
+Version:    0.2.20
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index f7a287bfd20106a3765e352458b6a01acd755416..32fa3f8fe1e3a2498ab35cbd96b0bfb57e92e9dd 100644 (file)
@@ -44,7 +44,7 @@
 
 #define MAX_STRING_LEN 512
 #define MAX_CHANNEL_LEN 10
-#define MAX_CONNECTION_LEN 4
+#define MAX_CONNECTION_LEN 3
 #define MAX_MEDIA_PACKET_SOURCE_LEN 4
 #define MAX_EXPECTED_SIZE 1024 * 1024 * 1024
 
@@ -117,10 +117,12 @@ static const char* g_webrtc_transceiver_direction_str[] = {
 
 /* for video display */
 static Evas_Object *g_win_id;
+static Evas_Object *g_eo_mine;
 
 typedef struct {
        Evas_Object *win;
-       Evas_Object *layout_main;
+       int win_width;
+       int win_height;
 } appdata_s;
 
 typedef struct {
@@ -199,11 +201,9 @@ static void win_del(void *data, Evas_Object *obj, void *event)
        elm_exit();
 }
 
-static Evas_Object *create_win(const char *name)
+static Evas_Object *create_win(const char *name, int *w, int *h)
 {
        Evas_Object *eo = NULL;
-       int w = 0;
-       int h = 0;
 
        g_print("[%s][%d] name=%s\n", __func__, __LINE__, name);
 
@@ -212,9 +212,9 @@ static Evas_Object *create_win(const char *name)
                elm_win_title_set(eo, name);
                elm_win_borderless_set(eo, EINA_TRUE);
                evas_object_smart_callback_add(eo, "delete,request", win_del, NULL);
-               elm_win_screen_size_get(eo, NULL, NULL, &w, &h);
-               g_print("window size: %d x %d\n", w, h);
-               evas_object_resize(eo, w, h);
+               elm_win_screen_size_get(eo, NULL, NULL, w, h);
+               g_print("window size: %d x %d\n", *w, *h);
+               evas_object_resize(eo, *w, *h);
                elm_win_autodel_set(eo, EINA_TRUE);
                elm_win_alpha_set(eo, EINA_TRUE);
        }
@@ -264,33 +264,37 @@ void create_render_rect_and_bg(Evas_Object *win)
        evas_object_show(win);
 }
 
-#define EO_ONE_SIDE_LEN 512
-#define PADDING_HIGHT 480
-
 static int app_create(void *data)
 {
        appdata_s *ad = data;
        Evas_Object *win = NULL;
        int i;
+       Evas_Object **eo;
 
        /* use gl backend */
        elm_config_accel_preference_set("opengl");
 
        /* create window */
-       win = create_win(PACKAGE);
+       win = create_win(PACKAGE, &ad->win_width, &ad->win_height);
        if (win == NULL)
                return -1;
        ad->win = win;
        g_win_id = win;
        create_render_rect_and_bg(ad->win);
 
-       /* Create evas image object for EVAS surface */
-       for (i = 0; i < MAX_CONNECTION_LEN; i++) {
-               g_conns[i].eo = create_image_object(ad->win);
-               evas_object_image_size_set(g_conns[i].eo, EO_ONE_SIDE_LEN, EO_ONE_SIDE_LEN);
-               evas_object_image_fill_set(g_conns[i].eo, 0, 0, EO_ONE_SIDE_LEN, EO_ONE_SIDE_LEN);
-               evas_object_resize(g_conns[i].eo, EO_ONE_SIDE_LEN, EO_ONE_SIDE_LEN);
-               evas_object_move(g_conns[i].eo, (i % 2) * EO_ONE_SIDE_LEN, ((i / 2) * EO_ONE_SIDE_LEN) + PADDING_HIGHT);
+       /* Create evas image object for EVAS surface.
+        *  _________________________________________  *
+        * |     eo (mine)      |    eo (remote0)    | *
+        * |____________________|____________________| *
+        * |    eo (remote1)    |    eo (remote2)    | *
+        * |____________________|____________________| */
+       for (i = 0; i < MAX_CONNECTION_LEN + 1; i++) {
+               eo = (i == 0) ? &g_eo_mine : &g_conns[i - 1].eo;
+               *eo = create_image_object(ad->win);
+               evas_object_image_size_set(*eo, ad->win_width / 2, ad->win_height / 2);
+               evas_object_image_fill_set(*eo, 0, 0, ad->win_width / 2, ad->win_height / 2);
+               evas_object_resize(*eo, ad->win_width / 2, ad->win_height / 2);
+               evas_object_move(*eo, (i % 2) * (ad->win_width / 2), (i / 2) * (ad->win_height / 2));
        }
        elm_win_activate(win);
        evas_object_show(win);