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

Catch exceptions rewriting SSRCs in the SSRC cache. #2192

Merged
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
33 changes: 19 additions & 14 deletions jvb/src/main/kotlin/org/jitsi/videobridge/SsrcCache.kt
Original file line number Diff line number Diff line change
Expand Up @@ -411,23 +411,28 @@ abstract class SsrcCache(val size: Int, val ep: SsrcRewriter, val parentLogger:
val remappings = mutableListOf<SendSource>()
var send = false

synchronized(sendSources) {
var rs = receivedSsrcs[packet.ssrc]
if (rs == null) {
val props = findSourceProps(packet.ssrc) ?: return false
rs = ReceiveSsrc(props)
receivedSsrcs[packet.ssrc] = rs
logger.debug { "Added receive SSRC: ${packet.ssrc}" }
}
try {
synchronized(sendSources) {
var rs = receivedSsrcs[packet.ssrc]
if (rs == null) {
val props = findSourceProps(packet.ssrc) ?: return false
rs = ReceiveSsrc(props)
receivedSsrcs[packet.ssrc] = rs
logger.debug { "Added receive SSRC: ${packet.ssrc}" }
}

val ss = getSendSource(rs.props.ssrc1, rs.props, allowCreateOnPacket, remappings)
if (ss != null) {
send = ss.rewriteRtp(packet, start, rs)
val ss = getSendSource(rs.props.ssrc1, rs.props, allowCreateOnPacket, remappings)
if (ss != null) {
send = ss.rewriteRtp(packet, start, rs)
}
}
}

if (remappings.isNotEmpty()) {
notifyMappings(remappings)
if (remappings.isNotEmpty()) {
notifyMappings(remappings)
}
} catch (e: Exception) {
logger.error("Error rewriting SSRC", e)
send = false
}

return send
Expand Down
Loading