Skip to content

Commit

Permalink
Convert some one-bit wide bit-field int variables to gboolean
Browse files Browse the repository at this point in the history
  • Loading branch information
atoppi committed May 2, 2024
1 parent d2e74fd commit 0b6586f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/ice.c
Expand Up @@ -2112,7 +2112,7 @@ static void janus_ice_cb_candidate_gathering_done(NiceAgent *agent, guint stream
return;
}
pc->gathered = janus_get_monotonic_time();
pc->cdone = 1;
pc->cdone = TRUE;
/* If we're doing full-trickle, send an event to the user too */
if(janus_full_trickle_enabled) {
/* Send a "trickle" event with completed:true to the browser */
Expand Down
2 changes: 1 addition & 1 deletion src/ice.h
Expand Up @@ -439,7 +439,7 @@ struct janus_ice_peerconnection {
/*! \brief libnice ICE component ID */
guint component_id;
/*! \brief Whether this stream is ready to be used */
gint cdone:1;
gboolean cdone;
/*! \brief libnice ICE component state */
guint state;
/*! \brief Monotonic time of when gathering has completed */
Expand Down
28 changes: 14 additions & 14 deletions src/plugins/janus_nosip.c
Expand Up @@ -290,10 +290,10 @@ static janus_nosip_message exit_message;
typedef struct janus_nosip_media {
char *remote_audio_ip;
char *remote_video_ip;
int ready:1;
gboolean ready;
gboolean require_srtp, has_srtp_local, has_srtp_remote;
janus_srtp_profile srtp_profile;
int has_audio:1;
gboolean has_audio;
int audio_rtp_fd, audio_rtcp_fd;
int local_audio_rtp_port, remote_audio_rtp_port;
int local_audio_rtcp_port, remote_audio_rtcp_port;
Expand All @@ -305,7 +305,7 @@ typedef struct janus_nosip_media {
srtp_policy_t audio_remote_policy, audio_local_policy;
char *audio_srtp_local_profile, *audio_srtp_local_crypto;
gboolean audio_send;
int has_video:1;
gboolean has_video;
int video_rtp_fd, video_rtcp_fd;
int local_video_rtp_port, remote_video_rtp_port;
int local_video_rtcp_port, remote_video_rtcp_port;
Expand Down Expand Up @@ -622,12 +622,12 @@ void janus_nosip_media_reset(janus_nosip_session *session) {
session->media.updated = FALSE;
session->media.ready = FALSE;
session->media.require_srtp = FALSE;
session->media.has_audio = 0;
session->media.has_audio = FALSE;
session->media.audio_pt = -1;
session->media.opusred_pt = -1;
session->media.audio_pt_name = NULL; /* Immutable string, no need to free*/
session->media.audio_send = TRUE;
session->media.has_video = 0;
session->media.has_video = FALSE;
session->media.video_pt = -1;
session->media.video_pt_name = NULL; /* Immutable string, no need to free*/
session->media.video_send = TRUE;
Expand Down Expand Up @@ -930,7 +930,7 @@ void janus_nosip_create_session(janus_plugin_session *handle, int *error) {
session->sdp = NULL;
session->media.remote_audio_ip = NULL;
session->media.remote_video_ip = NULL;
session->media.ready = 0;
session->media.ready = FALSE;
session->media.require_srtp = FALSE;
session->media.has_srtp_local = FALSE;
session->media.has_srtp_remote = FALSE;
Expand All @@ -939,7 +939,7 @@ void janus_nosip_create_session(janus_plugin_session *handle, int *error) {
session->media.audio_srtp_local_crypto = NULL;
session->media.video_srtp_local_profile = NULL;
session->media.video_srtp_local_crypto = NULL;
session->media.has_audio = 0;
session->media.has_audio = FALSE;
session->media.audio_rtp_fd = -1;
session->media.audio_rtcp_fd = -1;
session->media.local_audio_rtp_port = 0;
Expand All @@ -952,7 +952,7 @@ void janus_nosip_create_session(janus_plugin_session *handle, int *error) {
session->media.opusred_pt = -1;
session->media.audio_pt_name = NULL;
session->media.audio_send = TRUE;
session->media.has_video = 0;
session->media.has_video = FALSE;
session->media.video_rtp_fd = -1;
session->media.video_rtcp_fd = -1;
session->media.local_video_rtp_port = 0;
Expand Down Expand Up @@ -1485,11 +1485,11 @@ static void *janus_nosip_handler(void *data) {
/* Allocate RTP ports and merge them with the anonymized SDP */
if(strstr(msg_sdp, "m=audio") && !strstr(msg_sdp, "m=audio 0")) {
JANUS_LOG(LOG_VERB, "Going to negotiate audio...\n");
session->media.has_audio = 1; /* FIXME Maybe we need a better way to signal this */
session->media.has_audio = TRUE; /* FIXME Maybe we need a better way to signal this */
}
if(strstr(msg_sdp, "m=video") && !strstr(msg_sdp, "m=video 0")) {
JANUS_LOG(LOG_VERB, "Going to negotiate video...\n");
session->media.has_video = 1; /* FIXME Maybe we need a better way to signal this */
session->media.has_video = TRUE; /* FIXME Maybe we need a better way to signal this */
}
janus_mutex_lock(&session->mutex);
if(janus_nosip_allocate_local_ports(session, sdp_update) < 0) {
Expand Down Expand Up @@ -1597,15 +1597,15 @@ static void *janus_nosip_handler(void *data) {
/* If this is an answer, start the media */
if(!sdp_update && !offer) {
/* Start the media */
session->media.ready = 1; /* FIXME Maybe we need a better way to signal this */
session->media.ready = TRUE; /* FIXME Maybe we need a better way to signal this */
GError *error = NULL;
char tname[16];
g_snprintf(tname, sizeof(tname), "nosiprtp %p", session);
janus_refcount_increase(&session->ref);
session->relayer_thread = g_thread_try_new(tname, janus_nosip_relay_thread, session, &error);
if(error != NULL) {
session->relayer_thread = NULL;
session->media.ready = 0;
session->media.ready = FALSE;
janus_refcount_decrease(&session->ref);
JANUS_LOG(LOG_ERR, "Got error %d (%s) trying to launch the RTP/RTCP thread...\n",
error->code, error->message ? error->message : "??");
Expand Down Expand Up @@ -1835,7 +1835,7 @@ void janus_nosip_sdp_process(janus_nosip_session *session, janus_sdp *sdp, gbool
if(changed)
*changed = TRUE;
}
session->media.has_audio = 1;
session->media.has_audio = TRUE;
session->media.remote_audio_rtp_port = m->port;
session->media.remote_audio_rtcp_port = m->port+1; /* FIXME We're assuming RTCP is on the next port */
if(m->direction == JANUS_SDP_SENDONLY || m->direction == JANUS_SDP_INACTIVE)
Expand All @@ -1852,7 +1852,7 @@ void janus_nosip_sdp_process(janus_nosip_session *session, janus_sdp *sdp, gbool
if(changed)
*changed = TRUE;
}
session->media.has_video = 1;
session->media.has_video = TRUE;
session->media.remote_video_rtp_port = m->port;
session->media.remote_video_rtcp_port = m->port+1; /* FIXME We're assuming RTCP is on the next port */
if(m->direction == JANUS_SDP_SENDONLY || m->direction == JANUS_SDP_INACTIVE)
Expand Down
16 changes: 8 additions & 8 deletions src/transports/janus_rabbitmq.c
Expand Up @@ -157,9 +157,9 @@ typedef struct janus_rabbitmq_client {
GThread *in_thread, *out_thread; /* Threads to handle incoming and outgoing queues */
GAsyncQueue *messages; /* Queue of outgoing messages to push */
janus_mutex mutex; /* Mutex to lock/unlock this session */
gint session_timeout:1; /* Whether a Janus session timeout occurred in the core */
gint destroy:1; /* Flag to trigger a lazy session destruction */
gint connected:1; /* Flag to specify whether or not RabbitMQ connection is deemed to be up */
gboolean session_timeout; /* Whether a Janus session timeout occurred in the core */
gboolean destroy; /* Flag to trigger a lazy session destruction */
gboolean connected; /* Flag to specify whether or not RabbitMQ connection is deemed to be up */
} janus_rabbitmq_client;

/* RabbitMQ response */
Expand Down Expand Up @@ -461,7 +461,7 @@ int janus_rabbitmq_init(janus_transport_callbacks *callback, const char *config_
}

rmq_client->messages = g_async_queue_new();
rmq_client->destroy = 0;
rmq_client->destroy = FALSE;
/* Prepare the transport session (again, just one) */
rmq_session = janus_transport_session_create(rmq_client, NULL);
/* Start the threads */
Expand Down Expand Up @@ -531,7 +531,7 @@ int janus_rabbitmq_init(janus_transport_callbacks *callback, const char *config_
}

int janus_rabbitmq_connect(void) {
rmq_client->connected = 0;
rmq_client->connected = FALSE;
/* Connect */
rmq_client->rmq_conn = amqp_new_connection();
amqp_socket_t *socket = NULL;
Expand Down Expand Up @@ -713,7 +713,7 @@ int janus_rabbitmq_connect(void) {
}
}

rmq_client->connected = 1;
rmq_client->connected = TRUE;

JANUS_LOG(LOG_INFO, "RabbitMQ Connected successfully");

Expand All @@ -726,7 +726,7 @@ void janus_rabbitmq_destroy(void) {
g_atomic_int_set(&stopping, 1);

if(rmq_client) {
rmq_client->destroy = 1;
rmq_client->destroy = TRUE;
g_async_queue_push(rmq_client->messages, &exit_message);
if(rmq_client->in_thread)
g_thread_join(rmq_client->in_thread);
Expand Down Expand Up @@ -937,7 +937,7 @@ void *janus_rmq_in_thread(void *data) {
continue;
JANUS_LOG(LOG_VERB, "Error on amqp_simple_wait_frame_noblock: %d (%s)\n", res, amqp_error_string2(res));

rmq_client->connected = 0;
rmq_client->connected = FALSE;

/* Try and reconnect */
if(rmq_client->rmq_conn) {
Expand Down

0 comments on commit 0b6586f

Please sign in to comment.