g_print("webrtc_unset_ice_candidate_cb() success\n");
}
+static void __peer_connection_state_change_cb(webrtc_h webrtc, webrtc_peer_connection_state_e state, void *user_data)
+{
+ g_print("__peer_connection_state_change_cb() is invoked, state[%d]\n", state);
+}
+
+static void __signaling_state_change_cb(webrtc_h webrtc, webrtc_signaling_state_e state, void *user_data)
+{
+ g_print("__signaling_state_change_cb() is invoked, state[%d]\n", state);
+}
+
+static void __ice_gathering_state_change_cb(webrtc_h webrtc, webrtc_ice_gathering_state_e state, void *user_data)
+{
+ g_print("__ice_gathering_state_change_cb() is invoked, state[%d]\n", state);
+}
+
+static void __ice_connection_state_change_cb(webrtc_h webrtc, webrtc_ice_connection_state_e state, void *user_data)
+{
+ g_print("__ice_connection_state_change_cb() is invoked, state[%d]\n", state);
+}
+
+static void _webrtc_set_all_negotiation_state_change_cbs(int index)
+{
+ int ret = WEBRTC_ERROR_NONE;
+
+ ret = webrtc_set_peer_connection_state_change_cb(g_conns[index].webrtc, __peer_connection_state_change_cb, g_conns[index].webrtc);
+ if (ret != WEBRTC_ERROR_NONE)
+ g_print("failed to webrtc_set_peer_connection_state_change_cb()\n");
+ else
+ g_print("webrtc_set_peer_connection_state_change_cb() success\n");
+
+ ret = webrtc_set_signaling_state_change_cb(g_conns[index].webrtc, __signaling_state_change_cb, g_conns[index].webrtc);
+ if (ret != WEBRTC_ERROR_NONE)
+ g_print("failed to webrtc_set_signaling_state_change_cb()\n");
+ else
+ g_print("webrtc_set_signaling_state_change_cb() success\n");
+
+ ret = webrtc_set_ice_gathering_state_change_cb(g_conns[index].webrtc, __ice_gathering_state_change_cb, g_conns[index].webrtc);
+ if (ret != WEBRTC_ERROR_NONE)
+ g_print("failed to webrtc_set_ice_gathering_state_change_cb()\n");
+ else
+ g_print("webrtc_set_ice_gathering_state_change_cb() success\n");
+
+ ret = webrtc_set_ice_connection_state_change_cb(g_conns[index].webrtc, __ice_connection_state_change_cb, g_conns[index].webrtc);
+ if (ret != WEBRTC_ERROR_NONE)
+ g_print("failed to webrtc_set_ice_connection_state_change_cb()\n");
+ else
+ g_print("webrtc_set_ice_connection_state_change_cb() success\n");
+}
+
+static void _webrtc_unset_all_negotiation_state_change_cbs(int index)
+{
+ int ret = WEBRTC_ERROR_NONE;
+
+ ret = webrtc_unset_peer_connection_state_change_cb(g_conns[index].webrtc);
+ if (ret != WEBRTC_ERROR_NONE)
+ g_print("failed to webrtc_unset_peer_connection_state_change_cb()\n");
+ else
+ g_print("webrtc_unset_peer_connection_state_change_cb() success\n");
+
+ ret = webrtc_unset_signaling_state_change_cb(g_conns[index].webrtc);
+ if (ret != WEBRTC_ERROR_NONE)
+ g_print("failed to webrtc_unset_signaling_state_change_cb()\n");
+ else
+ g_print("webrtc_unset_signaling_state_change_cb() success\n");
+
+ ret = webrtc_unset_ice_gathering_state_change_cb(g_conns[index].webrtc);
+ if (ret != WEBRTC_ERROR_NONE)
+ g_print("failed to webrtc_unset_ice_gathering_state_change_cb()\n");
+ else
+ g_print("webrtc_unset_ice_gathering_state_change_cb() success\n");
+
+ ret = webrtc_unset_ice_connection_state_change_cb(g_conns[index].webrtc);
+ if (ret != WEBRTC_ERROR_NONE)
+ g_print("failed to webrtc_unset_ice_connection_state_change_cb()\n");
+ else
+ g_print("webrtc_unset_ice_connection_state_change_cb() success\n");
+}
+
static void __track_added_cb(webrtc_h webrtc, webrtc_media_type_e type, unsigned int id, void *user_data)
{
connection_s *conn = (connection_s *)user_data;
_webrtc_set_ice_candidate_cb(g_conn_index);
_webrtc_set_track_added_cb(g_conn_index);
_webrtc_set_data_channel_cb(g_conn_index);
+ _webrtc_set_all_negotiation_state_change_cbs(g_conn_index);
for (i = 0; i < MAX_MEDIA_PACKET_SOURCE_LEN; i++) {
if (g_conns[g_conn_index].packet_sources[i].source_id > 0)
_webrtc_media_packet_source_set_buffer_state_changed_cb(g_conn_index, g_conns[g_conn_index].packet_sources[i].source_id);
}
+ } else if (strncmp(cmd, "san", 3) == 0) {
+ _webrtc_set_all_negotiation_state_change_cbs(g_conn_index);
+
+ } else if (strncmp(cmd, "uan", 3) == 0) {
+ _webrtc_unset_all_negotiation_state_change_cbs(g_conn_index);
+
} else if (strncmp(cmd, "ssc", 3) == 0) {
g_conns[g_conn_index].menu_state = CURRENT_STATUS_CREATE_PRIVATE_SIGNALING_SERVER;
g_print("zf. Send file via data channel\n");
g_print("------------------------------------- Callbacks -----------------------------------------\n");
g_print("sac. Set all callbacks below (except for the encoded frame callbacks)\n");
+ g_print("san. Set all the negotiation change callbacks\t");
+ g_print("uan. Unset all the negotiation change callbacks\n");
g_print("se. Set error callback\t");
g_print("ue. Unset error callback\n");
g_print("sc. Set state changed callback\t");