Skip to content

Commit 278babf

Browse files
committed
avformat/whip: reindent for adding handle multi nack support
Signed-off-by: Jack Lau <jacklau1222@qq.com>
1 parent 6f0ed41 commit 278babf

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

libavformat/whip.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,16 +1941,16 @@ static int whip_write_packet(AVFormatContext *s, AVPacket *pkt)
19411941
if (ptr + len > ret) break;
19421942

19431943
if (pt == 205 && fmt == 1 && len >= 12) { /* PT=RTPFB, FMT=1 */
1944-
int i;
1945-
/* SRTCP index(4 bytes) + HMAC (SRTP_AES128_CM_SHA1_80 10bytes) */
1946-
int srtcp_len = len + 4 + 10;
1947-
int ret = ff_srtp_decrypt(&whip->srtp_recv, whip->buf, &srtcp_len);
1948-
if (ret < 0) {
1949-
av_log(whip, AV_LOG_ERROR, "WHIP: SRTCP decrypt failed: %d\n", ret);
1950-
// packet is invalid or authentication failed
1951-
break;
1952-
}
1953-
for (i = 0 ; 14 + i <= len; i = i + 4) {
1944+
int i;
1945+
/* SRTCP index(4 bytes) + HMAC (SRTP_AES128_CM_SHA1_80 10bytes) */
1946+
int srtcp_len = len + 4 + 10;
1947+
int ret = ff_srtp_decrypt(&whip->srtp_recv, whip->buf, &srtcp_len);
1948+
if (ret < 0) {
1949+
av_log(whip, AV_LOG_ERROR, "WHIP: SRTCP decrypt failed: %d\n", ret);
1950+
// packet is invalid or authentication failed
1951+
break;
1952+
}
1953+
for (i = 0 ; 14 + i <= len; i = i + 4) {
19541954
/**
19551955
* See https://datatracker.ietf.org/doc/html/rfc4585#section-6.1
19561956
* Handle multi NACKs in bundled packet.
@@ -1966,16 +1966,15 @@ static int whip_write_packet(AVFormatContext *s, AVPacket *pkt)
19661966

19671967
const RtpHistoryItem * it = rtp_history_find(whip, seq);
19681968
if (it) {
1969-
send_rtx_packet(s, it->pkt, it->size);
1969+
// send_rtx_packet(s, it->pkt, it->size);
19701970
av_log(whip, AV_LOG_INFO, "WHIP: NACK packet found: size: %d, seq=%d, blp=%d\n", it->size, seq, blp);
19711971
} else
19721972
av_log(whip, AV_LOG_INFO, "WHIP: NACK packet, seq=%d, blp=%d, not found, the latest packet seq: %d\n", seq, blp, whip->history[whip->hist_head-1].seq);
19731973
}
1974-
}
1974+
}
19751975
}
19761976
break;
19771977
}
1978-
19791978
}
19801979
} else if (ret != AVERROR(EAGAIN)) {
19811980
av_log(whip, AV_LOG_ERROR, "WHIP: Failed to read from UDP socket\n");

0 commit comments

Comments
 (0)