Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix most TSAN failures #1346

Merged
merged 4 commits into from
Dec 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions toxav/toxav.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ void toxav_iterate(ToxAV *av)

if (i->msi_call->self_capabilities & MSI_CAP_R_VIDEO &&
i->msi_call->peer_capabilities & MSI_CAP_S_VIDEO) {
pthread_mutex_lock(i->video->queue_mutex);
rc = min_u32(i->video->lcfd, rc);
pthread_mutex_unlock(i->video->queue_mutex);
}

uint32_t fid = i->friend_number;
Expand All @@ -283,8 +285,6 @@ void toxav_iterate(ToxAV *av)
}
}

pthread_mutex_unlock(av->mutex);

av->interval = rc < av->dmssa ? 0 : (rc - av->dmssa);
av->dmsst += current_time_monotonic(av->m->mono_time) - start;

Expand All @@ -293,6 +293,8 @@ void toxav_iterate(ToxAV *av)
av->dmssc = 0;
av->dmsst = 0;
}

pthread_mutex_unlock(av->mutex);
}
bool toxav_call(ToxAV *av, uint32_t friend_number, uint32_t audio_bit_rate, uint32_t video_bit_rate,
Toxav_Err_Call *error)
Expand Down
3 changes: 2 additions & 1 deletion toxav/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ void vc_iterate(VCSession *vc)
return;
}

uint16_t log_rb_size = rb_size(vc->vbuf_raw);
pthread_mutex_unlock(vc->queue_mutex);
const struct RTPHeader *const header = &p->header;

Expand All @@ -332,7 +333,7 @@ void vc_iterate(VCSession *vc)
}

LOGGER_DEBUG(vc->log, "vc_iterate: rb_read p->len=%d p->header.xe=%d", (int)full_data_len, p->header.xe);
LOGGER_DEBUG(vc->log, "vc_iterate: rb_read rb size=%d", (int)rb_size(vc->vbuf_raw));
LOGGER_DEBUG(vc->log, "vc_iterate: rb_read rb size=%d", (int)log_rb_size);
const vpx_codec_err_t rc = vpx_codec_decode(vc->decoder, p->data, full_data_len, nullptr, MAX_DECODE_TIME_US);
free(p);

Expand Down
2 changes: 2 additions & 0 deletions toxcore/Messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ int m_get_friend_connectionstatus(const Messenger *m, int32_t friendnumber)
bool direct_connected = 0;
unsigned int num_online_relays = 0;
int crypt_conn_id = friend_connection_crypt_connection_id(m->fr_c, m->friendlist[friendnumber].friendcon_id);

// FIXME(sudden6): handle return value
crypto_connection_status(m->net_crypto, crypt_conn_id, &direct_connected, &num_online_relays);

if (direct_connected) {
Expand Down
Loading