Skip to content

Commit

Permalink
tx audio R-S warning: use the correct max_len
Browse files Browse the repository at this point in the history
The data_len var used to compute packet_count may be lesser than its
initial value (tx->mtu - hdrs_len) because it might have been decreased
to number of remaining bytes of the last packet.

Returned back data_len to the do-loop and compute the value as
max_len.
  • Loading branch information
MartinPulec committed Sep 11, 2024
1 parent 8ff8a78 commit 9b9105f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/transmit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -872,9 +872,10 @@ audio_tx_send_chan(struct tx *tx, struct rtp *rtp_session, uint32_t timestamp,
}

long data_sent = 0;
int data_len = tx->mtu - hdrs_len;
const int max_len = tx->mtu - hdrs_len;
do {
const char *data = chan_data + pos;
int data_len = max_len;
if (pos + data_len >=
(unsigned int) buffer->get_data_len(channel)) {
data_len = buffer->get_data_len(channel) - pos;
Expand Down Expand Up @@ -915,7 +916,7 @@ audio_tx_send_chan(struct tx *tx, struct rtp *rtp_session, uint32_t timestamp,
}
// issue a warning if R-S is inadequate
const int packet_count =
(buffer->get_data_len(channel) + data_len - 1) / data_len;
(buffer->get_data_len(channel) + max_len - 1) / max_len;
if (packet_count > 3) {
return;
}
Expand Down

0 comments on commit 9b9105f

Please sign in to comment.