Commit bf8ba839 authored by Guillaume Desmottes's avatar Guillaume Desmottes

add nice_component_state_to_string()

Nice to make debug logs more friendly to read.
parent 220bb5ca
...@@ -1652,8 +1652,8 @@ void agent_signal_new_remote_candidate (NiceAgent *agent, NiceCandidate *candida ...@@ -1652,8 +1652,8 @@ void agent_signal_new_remote_candidate (NiceAgent *agent, NiceCandidate *candida
candidate->stream_id, candidate->component_id, candidate->foundation); candidate->stream_id, candidate->component_id, candidate->foundation);
} }
static const gchar * NICEAPI_EXPORT const gchar *
component_state_to_string (NiceComponentState state) nice_component_state_to_string (NiceComponentState state)
{ {
switch (state) switch (state)
{ {
...@@ -1686,16 +1686,16 @@ void agent_signal_component_state_change (NiceAgent *agent, guint stream_id, gui ...@@ -1686,16 +1686,16 @@ void agent_signal_component_state_change (NiceAgent *agent, guint stream_id, gui
if (agent->reliable && component->tcp == NULL && if (agent->reliable && component->tcp == NULL &&
state != NICE_COMPONENT_STATE_FAILED) { state != NICE_COMPONENT_STATE_FAILED) {
nice_debug ("Agent %p: not changing component state for s%d:%d to %d " nice_debug ("Agent %p: not changing component state for s%d:%d to %s "
"because pseudo tcp socket does not exist in reliable mode", agent, "because pseudo tcp socket does not exist in reliable mode", agent,
stream->id, component->id, state); stream->id, component->id, nice_component_state_to_string (state));
return; return;
} }
if (component->state != state && state < NICE_COMPONENT_STATE_LAST) { if (component->state != state && state < NICE_COMPONENT_STATE_LAST) {
nice_debug ("Agent %p : stream %u component %u STATE-CHANGE %s -> %s.", agent, nice_debug ("Agent %p : stream %u component %u STATE-CHANGE %s -> %s.", agent,
stream_id, component_id, component_state_to_string (component->state), stream_id, component_id, nice_component_state_to_string (component->state),
component_state_to_string (state)); nice_component_state_to_string (state));
component->state = state; component->state = state;
......
...@@ -1412,6 +1412,19 @@ nice_agent_get_io_stream ( ...@@ -1412,6 +1412,19 @@ nice_agent_get_io_stream (
guint stream_id, guint stream_id,
guint component_id); guint component_id);
/**
* nice_component_state_to_string:
* @state: a #NiceComponentState
*
* Returns a string representation of the state, generally to use in debug
* messages.
*
* Returns: (transfer none): a string representation of @state
* Since: UNRELEASED
*/
const gchar *
nice_component_state_to_string (NiceComponentState state);
G_END_DECLS G_END_DECLS
#endif /* _AGENT_H */ #endif /* _AGENT_H */
......
...@@ -47,6 +47,7 @@ nice_agent_parse_remote_stream_sdp ...@@ -47,6 +47,7 @@ nice_agent_parse_remote_stream_sdp
nice_agent_parse_remote_candidate_sdp nice_agent_parse_remote_candidate_sdp
nice_agent_get_io_stream nice_agent_get_io_stream
nice_agent_get_selected_socket nice_agent_get_selected_socket
nice_component_state_to_string
<SUBSECTION Standard> <SUBSECTION Standard>
NICE_AGENT NICE_AGENT
NICE_IS_AGENT NICE_IS_AGENT
......
...@@ -55,6 +55,7 @@ nice_agent_set_stream_tos ...@@ -55,6 +55,7 @@ nice_agent_set_stream_tos
nice_candidate_copy nice_candidate_copy
nice_candidate_free nice_candidate_free
nice_candidate_new nice_candidate_new
nice_component_state_to_string
nice_debug_disable nice_debug_disable
nice_debug_enable nice_debug_enable
nice_interfaces_get_ip_for_interface nice_interfaces_get_ip_for_interface
......
...@@ -53,6 +53,7 @@ nice_agent_set_stream_tos ...@@ -53,6 +53,7 @@ nice_agent_set_stream_tos
nice_candidate_copy nice_candidate_copy
nice_candidate_free nice_candidate_free
nice_candidate_new nice_candidate_new
nice_component_state_to_string
nice_debug_disable nice_debug_disable
nice_debug_enable nice_debug_enable
nice_interfaces_get_ip_for_interface nice_interfaces_get_ip_for_interface
......
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