#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)
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;
}
}
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;
}