Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

aubuf: fix possible data race warning #61

Merged
merged 1 commit into from
Jun 7, 2022
Merged
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
4 changes: 3 additions & 1 deletion src/aubuf/aubuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ int aubuf_write_auframe(struct aubuf *ab, const struct auframe *af)
struct mbuf *mb;
size_t sz;
size_t sample_size;
bool ajb;
int err;

if (!ab || !af)
Expand All @@ -293,9 +294,10 @@ int aubuf_write_auframe(struct aubuf *ab, const struct auframe *af)

lock_write_get(ab->lock);
mem_deref(mb);
ajb = !ab->filling && ab->ajb;
lock_rel(ab->lock);

if (!ab->filling && ab->ajb)
if (ajb)
ajb_calc(ab->ajb, af, ab->cur_sz);

return err;
Expand Down