mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-06 03:25:31 +00:00
sip: use g_return_if_fail and friends only for public functions
This commit is contained in:
parent
685aa1950e
commit
cadaa6a3e0
4 changed files with 26 additions and 18 deletions
|
@ -616,7 +616,7 @@ diagnose_used_ports_in_socket (GSocket *socket)
|
|||
g_warning ("Could not get local address of socket");
|
||||
return;
|
||||
}
|
||||
g_return_if_fail (G_IS_INET_SOCKET_ADDRESS (local_addr));
|
||||
g_assert (G_IS_INET_SOCKET_ADDRESS (local_addr));
|
||||
|
||||
local_port = g_inet_socket_address_get_port (G_INET_SOCKET_ADDRESS (local_addr));
|
||||
g_debug ("Using local port %d", local_port);
|
||||
|
@ -625,7 +625,7 @@ diagnose_used_ports_in_socket (GSocket *socket)
|
|||
g_warning ("Could not get remote address of socket");
|
||||
return;
|
||||
}
|
||||
g_return_if_fail (G_IS_INET_SOCKET_ADDRESS (remote_addr));
|
||||
g_assert (G_IS_INET_SOCKET_ADDRESS (remote_addr));
|
||||
|
||||
remote_port = g_inet_socket_address_get_port (G_INET_SOCKET_ADDRESS (remote_addr));
|
||||
g_debug ("Using remote port %d", remote_port);
|
||||
|
@ -640,8 +640,8 @@ diagnose_ports_in_use (CallsSipMediaPipeline *self)
|
|||
GSocket *socket_out;
|
||||
gboolean same_socket = FALSE;
|
||||
|
||||
g_return_if_fail (CALLS_IS_SIP_MEDIA_PIPELINE (self));
|
||||
// TODO also return if pipeline is not started yet
|
||||
g_assert (CALLS_IS_SIP_MEDIA_PIPELINE (self));
|
||||
g_assert (self->is_running);
|
||||
|
||||
g_object_get (self->rtp_src, "used-socket", &socket_in, NULL);
|
||||
g_object_get (self->rtp_sink, "used-socket", &socket_out, NULL);
|
||||
|
|
|
@ -219,11 +219,14 @@ sip_i_state (int status,
|
|||
CallsCallState state;
|
||||
CallsSipCall *call;
|
||||
|
||||
g_return_if_fail (CALLS_IS_SIP_ORIGIN (origin));
|
||||
g_assert (CALLS_IS_SIP_ORIGIN (origin));
|
||||
|
||||
call = g_hash_table_lookup (origin->call_handles, nh);
|
||||
|
||||
g_return_if_fail (call != NULL);
|
||||
if (call == NULL) {
|
||||
g_warning ("No call found for the current handle");
|
||||
return;
|
||||
}
|
||||
|
||||
g_debug ("The call state has changed: %03d %s", status, phrase);
|
||||
tl_gets (tags,
|
||||
|
@ -355,6 +358,15 @@ sip_callback (nua_event_t event,
|
|||
|
||||
case nua_r_bye:
|
||||
g_debug ("response to BYE: %03d %s", status, phrase);
|
||||
if (status == 200) {
|
||||
CallsSipCall *call =
|
||||
CALLS_SIP_CALL (g_hash_table_lookup (origin->call_handles, nh));
|
||||
|
||||
if (call == NULL) {
|
||||
g_warning ("BYE response from an unknown call");
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case nua_r_register:
|
||||
|
@ -441,8 +453,6 @@ setup_nua (CallsSipOrigin *self)
|
|||
const gchar *uuid = NULL;
|
||||
g_autofree gchar* urn_uuid = NULL;
|
||||
|
||||
g_return_val_if_fail (CALLS_IS_SIP_ORIGIN (self), NULL);
|
||||
|
||||
uuid = nua_generate_instance_identifier (self->ctx->home);
|
||||
urn_uuid = g_strdup_printf ("urn:uuid:%s", uuid);
|
||||
|
||||
|
@ -497,7 +507,7 @@ setup_sip_handles (CallsSipOrigin *self)
|
|||
CallsSipHandles *oper;
|
||||
g_autofree gchar *registrar_url = NULL;
|
||||
|
||||
g_return_val_if_fail (CALLS_IS_SIP_ORIGIN (self), NULL);
|
||||
g_assert (CALLS_IS_SIP_ORIGIN (self));
|
||||
|
||||
if (!(oper = su_zalloc (self->ctx->home, sizeof(CallsSipHandles)))) {
|
||||
g_warning ("cannot create handle");
|
||||
|
@ -517,7 +527,7 @@ setup_sip_handles (CallsSipOrigin *self)
|
|||
static void
|
||||
setup_account_for_direct_connection (CallsSipOrigin *self)
|
||||
{
|
||||
g_return_if_fail (CALLS_IS_SIP_ORIGIN (self));
|
||||
g_assert (CALLS_IS_SIP_ORIGIN (self));
|
||||
|
||||
/* honour username, if previously set */
|
||||
if (self->user == NULL)
|
||||
|
@ -545,7 +555,7 @@ setup_account_for_direct_connection (CallsSipOrigin *self)
|
|||
static gboolean
|
||||
is_account_complete (CallsSipOrigin *self)
|
||||
{
|
||||
g_return_val_if_fail (CALLS_IS_SIP_ORIGIN (self), FALSE);
|
||||
g_assert (CALLS_IS_SIP_ORIGIN (self));
|
||||
|
||||
/* we need only need to check for password if needing to authenticate over a proxy/UAS */
|
||||
if (self->user == NULL ||
|
||||
|
@ -565,8 +575,6 @@ init_sip_account (CallsSipOrigin *self,
|
|||
{
|
||||
gboolean recoverable = FALSE;
|
||||
|
||||
g_return_val_if_fail (CALLS_IS_SIP_ORIGIN (self), FALSE);
|
||||
|
||||
if (self->use_direct_connection) {
|
||||
g_debug ("Direct connection case. Using user and hostname");
|
||||
setup_account_for_direct_connection (self);
|
||||
|
@ -677,14 +685,14 @@ on_call_state_changed_cb (CallsSipOrigin *self,
|
|||
CallsCallState old_state,
|
||||
CallsCall *call)
|
||||
{
|
||||
g_assert (CALLS_IS_SIP_ORIGIN (self));
|
||||
g_assert (CALLS_IS_CALL (call));
|
||||
|
||||
if (new_state != CALLS_CALL_STATE_DISCONNECTED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
g_assert (CALLS_IS_SIP_ORIGIN (self));
|
||||
g_assert (CALLS_IS_CALL (call));
|
||||
|
||||
remove_call (self, call, "Disconnected");
|
||||
}
|
||||
|
||||
|
|
|
@ -233,7 +233,7 @@ calls_sip_provider_init_sofia (CallsSipProvider *self,
|
|||
{
|
||||
GSource *gsource;
|
||||
|
||||
g_return_val_if_fail (CALLS_IS_SIP_PROVIDER (self), FALSE);
|
||||
g_assert (CALLS_SIP_PROVIDER (self));
|
||||
|
||||
self->ctx = g_new0 (CallsSipContext, 1);
|
||||
if (self->ctx == NULL) {
|
||||
|
|
|
@ -40,7 +40,7 @@ static MediaCodecInfo gst_codecs[] = {
|
|||
MediaCodecInfo *
|
||||
media_codec_by_name (const char *name)
|
||||
{
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
g_return_val_if_fail (name, NULL);
|
||||
|
||||
for (guint i = 0; i < G_N_ELEMENTS (gst_codecs); i++) {
|
||||
if (g_strcmp0 (name, gst_codecs[i].name) == 0)
|
||||
|
|
Loading…
Reference in a new issue