webrtc_private: Apply designated initializers to arrays 77/253977/3
authorSangchul Lee <sc11.lee@samsung.com>
Mon, 22 Feb 2021 02:53:11 +0000 (11:53 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 22 Feb 2021 10:01:54 +0000 (19:01 +0900)
[Version] 0.1.116
[Issue Type] Refactoring

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

index 98be288b1f86d31fe0bb6102e7053a5a3a12ba9a..14366eb6a0389376a8f05899c1e17688230beaed 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.1.115
+Version:    0.1.116
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 982dcac2e509c939b85a5365ea12194977acf9d0..c1720074ebcc783db3887c65e3de668ab2856028 100644 (file)
 #define DEFAULT_DOT_FILE_NAME_PREFIX   "webrtc"
 
 static const char* __state_str[] = {
-       "IDLE",
-       "NEGOTIATING",
-       "PLAYING",
+       [WEBRTC_STATE_IDLE] = "IDLE",
+       [WEBRTC_STATE_NEGOTIATING] = "NEGOTIATING",
+       [WEBRTC_STATE_PLAYING] = "PLAYING",
 };
 
-static const char* __direction_str[] = {
-       "SENDONLY",
-       "RECVONLY",
-       "SENDRECV",
-};
+typedef struct {
+       const char *str;
+       GstWebRTCRTPTransceiverDirection gst;
+} direction_info_s;
 
-static GstWebRTCRTPTransceiverDirection __direction_gst[] = {
-       GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY,
-       GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY,
-       GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDRECV
+static direction_info_s __direction_info[] = {
+       [WEBRTC_TRANSCEIVER_DIRECTION_SENDONLY] = { "SENDONLY", GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY },
+       [WEBRTC_TRANSCEIVER_DIRECTION_RECVONLY] = { "RECVONLY", GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY },
+       [WEBRTC_TRANSCEIVER_DIRECTION_SENDRECV] = { "SENDRECV", GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDRECV }
 };
 
 void _generate_dot(webrtc_s *webrtc, const gchar *name)
@@ -1088,7 +1087,7 @@ int _get_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_
                        ret = __convert_direction(trans->direction, direction);
                        if (ret == WEBRTC_ERROR_NONE)
                                LOG_DEBUG("found transceiver[%p, index:%d, mline:%u, mid:%s, direction:%s]",
-                                       trans, i, trans->mline, trans->mid, __direction_str[*direction]);
+                                       trans, i, trans->mline, trans->mid, __direction_info[*direction].str);
                        goto end;
                }
        }
@@ -1131,9 +1130,9 @@ int _set_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_
        for (i = 0; i < transceivers->len; i++) {
                trans = g_array_index(transceivers, GstWebRTCRTPTransceiver *, i);
                if (trans->mline == mline) {
-                       trans->direction = __direction_gst[direction];
+                       trans->direction = __direction_info[direction].gst;
                        LOG_DEBUG("Set direction to transceiver[%p, index:%d, mline:%u, direction:%s]",
-                               trans, i, trans->mline, __direction_str[direction]);
+                               trans, i, trans->mline, __direction_info[direction].str);
                        ret = WEBRTC_ERROR_NONE;
                        goto end;
                }