Commit f8063106 authored by Philip Withnall's avatar Philip Withnall Committed by Olivier Crête
Browse files

examples: Remove unnecessary dynamic type casts

We know the agent is a GObject — there is no need to check it at
runtime. This also improves Tartan’s static analysis of signal
connections.
parent 93e18790
......@@ -130,15 +130,15 @@ example_thread(void *data)
// Set the STUN settings and controlling mode
if (stun_addr) {
g_object_set(G_OBJECT(agent), "stun-server", stun_addr, NULL);
g_object_set(G_OBJECT(agent), "stun-server-port", stun_port, NULL);
g_object_set(agent, "stun-server", stun_addr, NULL);
g_object_set(agent, "stun-server-port", stun_port, NULL);
}
g_object_set(G_OBJECT(agent), "controlling-mode", controlling, NULL);
g_object_set(agent, "controlling-mode", controlling, NULL);
// Connect to the signals
g_signal_connect(G_OBJECT(agent), "candidate-gathering-done",
g_signal_connect(agent, "candidate-gathering-done",
G_CALLBACK(cb_candidate_gathering_done), NULL);
g_signal_connect(G_OBJECT(agent), "component-state-changed",
g_signal_connect(agent, "component-state-changed",
G_CALLBACK(cb_component_state_changed), NULL);
// Create a new stream with one component
......
......@@ -116,17 +116,17 @@ main(int argc, char *argv[])
// Set the STUN settings and controlling mode
if (stun_addr) {
g_object_set(G_OBJECT(agent), "stun-server", stun_addr, NULL);
g_object_set(G_OBJECT(agent), "stun-server-port", stun_port, NULL);
g_object_set(agent, "stun-server", stun_addr, NULL);
g_object_set(agent, "stun-server-port", stun_port, NULL);
}
g_object_set(G_OBJECT(agent), "controlling-mode", controlling, NULL);
g_object_set(agent, "controlling-mode", controlling, NULL);
// Connect to the signals
g_signal_connect(G_OBJECT(agent), "candidate-gathering-done",
g_signal_connect(agent, "candidate-gathering-done",
G_CALLBACK(cb_candidate_gathering_done), NULL);
g_signal_connect(G_OBJECT(agent), "new-selected-pair",
g_signal_connect(agent, "new-selected-pair",
G_CALLBACK(cb_new_selected_pair), NULL);
g_signal_connect(G_OBJECT(agent), "component-state-changed",
g_signal_connect(agent, "component-state-changed",
G_CALLBACK(cb_component_state_changed), NULL);
// Create a new stream with one component
......
......@@ -140,17 +140,17 @@ example_thread(void *data)
// Set the STUN settings and controlling mode
if (stun_addr) {
g_object_set(G_OBJECT(agent), "stun-server", stun_addr, NULL);
g_object_set(G_OBJECT(agent), "stun-server-port", stun_port, NULL);
g_object_set(agent, "stun-server", stun_addr, NULL);
g_object_set(agent, "stun-server-port", stun_port, NULL);
}
g_object_set(G_OBJECT(agent), "controlling-mode", controlling, NULL);
g_object_set(agent, "controlling-mode", controlling, NULL);
// Connect to the signals
g_signal_connect(G_OBJECT(agent), "candidate-gathering-done",
g_signal_connect(agent, "candidate-gathering-done",
G_CALLBACK(cb_candidate_gathering_done), NULL);
g_signal_connect(G_OBJECT(agent), "new-selected-pair",
g_signal_connect(agent, "new-selected-pair",
G_CALLBACK(cb_new_selected_pair), NULL);
g_signal_connect(G_OBJECT(agent), "component-state-changed",
g_signal_connect(agent, "component-state-changed",
G_CALLBACK(cb_component_state_changed), NULL);
// Create a new stream with one component
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment