Skip to content

Commit

Permalink
MT#55283 add missing send_timer locks
Browse files Browse the repository at this point in the history
ps->out_lock must be held when sending packets, and the SSRC lock must
be held for sending RTCP

Change-Id: I19fe85762e330a9b8a03658a828f735db6eb6cb7
(cherry picked from commit 6c7277a)
  • Loading branch information
rfuchs committed Oct 17, 2023
1 parent a634e41 commit d47b22b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion daemon/media_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ static void send_timer_rtcp(struct send_timer *st, struct ssrc_ctx *ssrc_out) {

rtcp_send_report(media, ssrc_out);

// XXX missing locking?
ssrc_out->next_rtcp = rtpe_now;
timeval_add_usec(&ssrc_out->next_rtcp, 5000000 + (ssl_random() % 2000000));
}
Expand Down Expand Up @@ -294,8 +293,10 @@ static void __send_timer_send_common(struct send_timer *st, struct codec_packet
// do we send RTCP?
struct ssrc_ctx *ssrc_out = cp->ssrc_out;
if (ssrc_out && ssrc_out->next_rtcp.tv_sec) {
mutex_lock(&ssrc_out->parent->h.lock);
if (timeval_diff(&ssrc_out->next_rtcp, &rtpe_now) < 0)
send_timer_rtcp(st, ssrc_out);
mutex_unlock(&ssrc_out->parent->h.lock);
}

out:
Expand All @@ -309,9 +310,11 @@ static void send_timer_send_lock(struct send_timer *st, struct codec_packet *cp)

log_info_call(call);
rwlock_lock_r(&call->master_lock);
mutex_lock(&st->sink->out_lock);

__send_timer_send_common(st, cp);

mutex_unlock(&st->sink->out_lock);
rwlock_unlock_r(&call->master_lock);
log_info_pop();

Expand Down

0 comments on commit d47b22b

Please sign in to comment.