jitsi / jitsi-videobridge

Jitsi Videobridge is a WebRTC compatible video router or SFU that lets build highly scalable video conferencing infrastructure (i.e., up to hundreds of conferences per server).
https://jitsi.org/jitsi-videobridge
Apache License 2.0
2.89k stars 988 forks source link

Expire always set to 60 when SctpConnection is patched #537

Open oliverhausler opened 6 years ago

oliverhausler commented 6 years ago

When I create a new SctpConnection using REST, I can give it an expiration time, which is reflected in the response.

"expire": 15

But as soon as I modify an existing SctpConnection, "expire" is always set to 60.

This is especially bad, as I cannot set

"expire": 0

in order to expire a channel immediately. That means, when I expire a complete conference, sctpConnections hang until they time out after 60 secs, which probably wastes resources.

Look here:

I have 3 participants and I want to remove one:

{
    "id": "eaa06df320b1d370",
    "contents": [{
        "name": "video",
        "channels": [{
            "id": "a848ceea50555480",
            "expire": 0
        }, {
            "id": "43a568c6caef46cd"
        }, {
            "id": "292324e69ee4ad1"
        }],
        "sctpconnections": []
    }, {
        "name": "audio",
        "channels": [{
            "id": "1b3468eb18111083",
            "expire": 0
        }, {
            "id": "475c91baf131855e"
        }, {
            "id": "8c4fd3987e7db4b4"
        }],
        "sctpconnections": []
    }, {
        "name": "data",
        "channels": [],
        "sctpconnections": [{
            "id": "aef15be015747a8a",
            "expire": 0
        }, {
            "id": "80a98f8fe6878ab7"
        }, {
            "id": "29b6e2900ca2fba6"
        }]
    }],
    "channel-bundles": []
}

See how I reset expire for the participant I want to remove. The response is this:

{
    "id": "eaa06df320b1d370",
    "contents": [{
        "name": "video",
        "channels": [{
            "id": "43a568c6caef46cd",
            "expire": 15,
            "initiator": true,
            "endpoint": "NA-lTs2sSgimlkjgGybgXQ|||||ALa90V2be0sFgEWDRduuYGI",
            "direction": "sendrecv",
            "channel-bundle-id": "NA-lTs2sSgimlkjgGybgXQ|||||ALa90V2be0sFgEWDRduuYGI",
            "rtp-level-relay-type": "translator",
            "last-n": 2,
            "sources": [3967858994],
            "ssrcs": [2105642583]
        }, {
            "id": "292324e69ee4ad1",
            "expire": 15,
            "initiator": true,
            "endpoint": "NA-lTs2sSgimlkjgGybgXQ|||||ALQ-87nUKkVuhfSfveytvXY",
            "direction": "sendrecv",
            "channel-bundle-id": "NA-lTs2sSgimlkjgGybgXQ|||||ALQ-87nUKkVuhfSfveytvXY",
            "rtp-level-relay-type": "translator",
            "last-n": 2,
            "sources": [3967858994],
            "ssrcs": [4231987551]
        }],
        "sctpconnections": []
    }, {
        "name": "audio",
        "channels": [{
            "id": "475c91baf131855e",
            "expire": 15,
            "initiator": true,
            "endpoint": "NA-lTs2sSgimlkjgGybgXQ|||||ALQ-87nUKkVuhfSfveytvXY",
            "direction": "sendrecv",
            "channel-bundle-id": "NA-lTs2sSgimlkjgGybgXQ|||||ALQ-87nUKkVuhfSfveytvXY",
            "rtp-level-relay-type": "translator",
            "sources": [3250296448],
            "ssrcs": [2376421538]
        }, {
            "id": "8c4fd3987e7db4b4",
            "expire": 15,
            "initiator": true,
            "endpoint": "NA-lTs2sSgimlkjgGybgXQ|||||ALa90V2be0sFgEWDRduuYGI",
            "direction": "sendrecv",
            "channel-bundle-id": "NA-lTs2sSgimlkjgGybgXQ|||||ALa90V2be0sFgEWDRduuYGI",
            "rtp-level-relay-type": "translator",
            "sources": [3250296448],
            "ssrcs": [1039909822]
        }],
        "sctpconnections": []
    }, {
        "name": "data",
        "channels": [],
        "sctpconnections": [{
            "id": "aef15be015747a8a",
            "expire": 0,
            "initiator": true,
            "endpoint": "NA-lTs2sSgimlkjgGybgXQ|||||AL6rKpq12kkStEhU9G-l2Wg",
            "port": 5000,
            "channel-bundle-id": "NA-lTs2sSgimlkjgGybgXQ|||||AL6rKpq12kkStEhU9G-l2Wg"
        }, {
            "id": "80a98f8fe6878ab7",
            "expire": 60,
            "initiator": true,
            "endpoint": "NA-lTs2sSgimlkjgGybgXQ|||||ALa90V2be0sFgEWDRduuYGI",
            "port": 5000,
            "channel-bundle-id": "NA-lTs2sSgimlkjgGybgXQ|||||ALa90V2be0sFgEWDRduuYGI"
        }, {
            "id": "29b6e2900ca2fba6",
            "expire": 60,
            "initiator": true,
            "endpoint": "NA-lTs2sSgimlkjgGybgXQ|||||ALQ-87nUKkVuhfSfveytvXY",
            "port": 5000,
            "channel-bundle-id": "NA-lTs2sSgimlkjgGybgXQ|||||ALQ-87nUKkVuhfSfveytvXY"
        }]
    }],
    "channel-bundles": [{
        "id": "NA-lTs2sSgimlkjgGybgXQ|||||ALQ-87nUKkVuhfSfveytvXY",
        "transport": {
            "xmlns": "urn:xmpp:jingle:transports:ice-udp:1",
            "rtcp-mux": true,
            "ufrag": "48scr1bpiekhbv",
            "pwd": "3ten3mprep68q60kgtsoe41okd",
            "fingerprints": [{
                "fingerprint": "FE:56:B6:83:64:EA:5E:A9:40:F3:3D:86:60:A9:E3:D8:EE:F7:0E:79",
                "hash": "sha-1",
                "setup": "actpass"
            }],
            "candidates": [{
                "id": "eaa06df320b1d3702f8e8595ddbab230ffffffff93cd6966",
                "component": 1,
                "protocol": "udp",
                "priority": 2130706431,
                "ip": "2a03:b0c0:3:d0:0:0:599e:2001",
                "port": 10000,
                "type": "host",
                "generation": 0,
                "foundation": "1",
                "network": 0
            }, {
                "id": "eaa06df320b1d3702f8e8595ddbab2301b3c99da",
                "component": 1,
                "protocol": "udp",
                "priority": 2130706431,
                "ip": "10.19.0.5",
                "port": 10000,
                "type": "host",
                "generation": 0,
                "foundation": "2",
                "network": 0
            }, {
                "id": "eaa06df320b1d3702f8e8595ddbab230ffffffff9b6dee51",
                "component": 1,
                "protocol": "udp",
                "priority": 2113932031,
                "ip": "138.68.84.124",
                "port": 10000,
                "type": "host",
                "generation": 0,
                "foundation": "3",
                "network": 0
            }]
        }
    }, {
        "id": "NA-lTs2sSgimlkjgGybgXQ|||||ALa90V2be0sFgEWDRduuYGI",
        "transport": {
            "xmlns": "urn:xmpp:jingle:transports:ice-udp:1",
            "rtcp-mux": true,
            "ufrag": "fm56g1bpiekhld",
            "pwd": "6ni20j41lu6il7f5bpitu7iip7",
            "fingerprints": [{
                "fingerprint": "FE:56:B6:83:64:EA:5E:A9:40:F3:3D:86:60:A9:E3:D8:EE:F7:0E:79",
                "hash": "sha-1",
                "setup": "actpass"
            }],
            "candidates": [{
                "id": "eaa06df320b1d3702856e6035a1ac4ff0ffffffffa195ab69",
                "component": 1,
                "protocol": "udp",
                "priority": 2130706431,
                "ip": "2a03:b0c0:3:d0:0:0:599e:2001",
                "port": 10000,
                "type": "host",
                "generation": 0,
                "foundation": "1",
                "network": 0
            }, {
                "id": "eaa06df320b1d3702856e6035a1ac4ff02904dbdd",
                "component": 1,
                "protocol": "udp",
                "priority": 2130706431,
                "ip": "10.19.0.5",
                "port": 10000,
                "type": "host",
                "generation": 0,
                "foundation": "2",
                "network": 0
            }, {
                "id": "eaa06df320b1d3702856e6035a1ac4ff0ffffffffa9363054",
                "component": 1,
                "protocol": "udp",
                "priority": 2113932031,
                "ip": "138.68.84.124",
                "port": 10000,
                "type": "host",
                "generation": 0,
                "foundation": "3",
                "network": 0
            }]
        }
    }]
}

2 remaining audio channels (correct), 2 remaining video channels (correct), but 3 remaining sctpconnections, one where expire is 0, two where it's reset to 60 (all 3 wrong, one should be gone, the others should stay at their original value, was 15).

Am I doing this wrong? Is the logic for removing a different one for video/audio channels and sctpconnections?

oliverhausler commented 6 years ago

This may be related with https://github.com/jitsi/jitsi-videobridge/issues/73. I assume the conference doesn't expire immediately because the SctpConnection is still up.

bgrozev commented 6 years ago

Am I doing this wrong? Is the logic for removing a different one for video/audio channels and sctpconnections?

What you describe you expect seems correct. The different behavior is probably a bug.

bgrozev commented 6 years ago

I found that the value of the "expire" attribute is not used when an SctpConnection is initially created. I'm not sure why you're seeing the seemingly correct response when you create one with expire=15, but I don't think it was being set (so it defaulted to 60).

Can you test with the changes in #539 ? Then use the "expire" attribute specified with the creation request, and they might also fix the problem with the expire=0 sctpconnection not being removed immediately.

oliverhausler commented 6 years ago

I am definitely seeing 15 seconds when I create the channels. The fix seems to work. Will comment on your PR.

oliverhausler commented 6 years ago

@bgrozev When created, "expire": 15 seems to be honored, try to POST the following JSON. Maybe insert happens somewhere else.

{
    "contents": [{
        "name": "audio",
        "channels": [{
            "expire": 15,
            "initiator": true,
            "endpoint": "NA-lTs2sSgimlkjgGybgXQ|||||APMUI_-LJEOiqKtXwQ19WoQ",
            "direction": "sendrecv",
            "channel-bundle-id": "NA-lTs2sSgimlkjgGybgXQ|||||APMUI_-LJEOiqKtXwQ19WoQ",
            "rtp-level-relay-type": "translator",
            "payload-types": [{
                "id": 111,
                "name": "opus",
                "clockrate": 48000,
                "channels": 2,
                "parameters": {
                    "fmtp": ["minptime=10; useinbandfec=1"]
                }
            }, {
                "id": 103,
                "name": "ISAC",
                "clockrate": 16000
            }, {
                "id": 104,
                "name": "ISAC",
                "clockrate": 32000
            }, {
                "id": 9,
                "name": "G722",
                "clockrate": 8000
            }, {
                "id": 102,
                "name": "ILBC",
                "clockrate": 8000
            }, {
                "id": 0,
                "name": "PCMU",
                "clockrate": 8000
            }, {
                "id": 8,
                "name": "PCMA",
                "clockrate": 8000
            }, {
                "id": 106,
                "name": "CN",
                "clockrate": 32000
            }, {
                "id": 105,
                "name": "CN",
                "clockrate": 16000
            }, {
                "id": 13,
                "name": "CN",
                "clockrate": 8000
            }, {
                "id": 127,
                "name": "red",
                "clockrate": 8000
            }, {
                "id": 126,
                "name": "telephone-event",
                "clockrate": 8000
            }]
        }, {
            "expire": 15,
            "initiator": true,
            "endpoint": "NA-lTs2sSgimlkjgGybgXQ|||||C7Rj-qmEQBmWPHi6E33d-w",
            "direction": "sendrecv",
            "channel-bundle-id": "NA-lTs2sSgimlkjgGybgXQ|||||C7Rj-qmEQBmWPHi6E33d-w",
            "rtp-level-relay-type": "translator",
            "payload-types": [{
                "id": 111,
                "name": "opus",
                "clockrate": 48000,
                "channels": 2,
                "parameters": {
                    "fmtp": ["minptime=10; useinbandfec=1"]
                }
            }, {
                "id": 103,
                "name": "ISAC",
                "clockrate": 16000
            }, {
                "id": 104,
                "name": "ISAC",
                "clockrate": 32000
            }, {
                "id": 9,
                "name": "G722",
                "clockrate": 8000
            }, {
                "id": 102,
                "name": "ILBC",
                "clockrate": 8000
            }, {
                "id": 0,
                "name": "PCMU",
                "clockrate": 8000
            }, {
                "id": 8,
                "name": "PCMA",
                "clockrate": 8000
            }, {
                "id": 106,
                "name": "CN",
                "clockrate": 32000
            }, {
                "id": 105,
                "name": "CN",
                "clockrate": 16000
            }, {
                "id": 13,
                "name": "CN",
                "clockrate": 8000
            }, {
                "id": 127,
                "name": "red",
                "clockrate": 8000
            }, {
                "id": 126,
                "name": "telephone-event",
                "clockrate": 8000
            }]
        }, {
            "expire": 15,
            "initiator": true,
            "endpoint": "NA-lTs2sSgimlkjgGybgXQ|||||APMP-UnhMUQPoQC9PeAJYA8",
            "direction": "sendrecv",
            "channel-bundle-id": "NA-lTs2sSgimlkjgGybgXQ|||||APMP-UnhMUQPoQC9PeAJYA8",
            "rtp-level-relay-type": "translator",
            "payload-types": [{
                "id": 111,
                "name": "opus",
                "clockrate": 48000,
                "channels": 2,
                "parameters": {
                    "fmtp": ["minptime=10; useinbandfec=1"]
                }
            }, {
                "id": 103,
                "name": "ISAC",
                "clockrate": 16000
            }, {
                "id": 104,
                "name": "ISAC",
                "clockrate": 32000
            }, {
                "id": 9,
                "name": "G722",
                "clockrate": 8000
            }, {
                "id": 102,
                "name": "ILBC",
                "clockrate": 8000
            }, {
                "id": 0,
                "name": "PCMU",
                "clockrate": 8000
            }, {
                "id": 8,
                "name": "PCMA",
                "clockrate": 8000
            }, {
                "id": 106,
                "name": "CN",
                "clockrate": 32000
            }, {
                "id": 105,
                "name": "CN",
                "clockrate": 16000
            }, {
                "id": 13,
                "name": "CN",
                "clockrate": 8000
            }, {
                "id": 127,
                "name": "red",
                "clockrate": 8000
            }, {
                "id": 126,
                "name": "telephone-event",
                "clockrate": 8000
            }]
        }],
        "sctpconnections": []
    }, {
        "name": "video",
        "channels": [{
            "expire": 15,
            "initiator": true,
            "endpoint": "NA-lTs2sSgimlkjgGybgXQ|||||APMUI_-LJEOiqKtXwQ19WoQ",
            "direction": "sendrecv",
            "channel-bundle-id": "NA-lTs2sSgimlkjgGybgXQ|||||APMUI_-LJEOiqKtXwQ19WoQ",
            "rtp-level-relay-type": "translator",
            "last-n": 2,
            "receive-simulcast-layer": 0,
            "payload-types": [{
                "id": 100,
                "name": "VP8",
                "clockrate": 90000,
                "parameters": {
                    "fmtp": ["x-google-start-bitrate=550"],
                    "rtcp-fb": ["ccm fir", "nack", "nack pli", "goog-remb"]
                }
            }]
        }, {
            "expire": 15,
            "initiator": true,
            "endpoint": "NA-lTs2sSgimlkjgGybgXQ|||||C7Rj-qmEQBmWPHi6E33d-w",
            "direction": "sendrecv",
            "channel-bundle-id": "NA-lTs2sSgimlkjgGybgXQ|||||C7Rj-qmEQBmWPHi6E33d-w",
            "rtp-level-relay-type": "translator",
            "last-n": 2,
            "receive-simulcast-layer": 0,
            "payload-types": [{
                "id": 100,
                "name": "VP8",
                "clockrate": 90000,
                "parameters": {
                    "fmtp": ["x-google-start-bitrate=550"],
                    "rtcp-fb": ["ccm fir", "nack", "nack pli", "goog-remb"]
                }
            }]
        }, {
            "expire": 15,
            "initiator": true,
            "endpoint": "NA-lTs2sSgimlkjgGybgXQ|||||APMP-UnhMUQPoQC9PeAJYA8",
            "direction": "sendrecv",
            "channel-bundle-id": "NA-lTs2sSgimlkjgGybgXQ|||||APMP-UnhMUQPoQC9PeAJYA8",
            "rtp-level-relay-type": "translator",
            "last-n": 2,
            "receive-simulcast-layer": 0,
            "payload-types": [{
                "id": 100,
                "name": "VP8",
                "clockrate": 90000,
                "parameters": {
                    "fmtp": ["x-google-start-bitrate=550"],
                    "rtcp-fb": ["ccm fir", "nack", "nack pli", "goog-remb"]
                }
            }]
        }],
        "sctpconnections": []
    }, {
        "name": "data",
        "channels": [],
        "sctpconnections": [{
            "expire": 15,
            "initiator": true,
            "endpoint": "NA-lTs2sSgimlkjgGybgXQ|||||APMUI_-LJEOiqKtXwQ19WoQ",
            "port": 5000,
            "channel-bundle-id": "NA-lTs2sSgimlkjgGybgXQ|||||APMUI_-LJEOiqKtXwQ19WoQ"
        }, {
            "expire": 15,
            "initiator": true,
            "endpoint": "NA-lTs2sSgimlkjgGybgXQ|||||C7Rj-qmEQBmWPHi6E33d-w",
            "port": 5000,
            "channel-bundle-id": "NA-lTs2sSgimlkjgGybgXQ|||||C7Rj-qmEQBmWPHi6E33d-w"
        }, {
            "expire": 15,
            "initiator": true,
            "endpoint": "NA-lTs2sSgimlkjgGybgXQ|||||APMP-UnhMUQPoQC9PeAJYA8",
            "port": 5000,
            "channel-bundle-id": "NA-lTs2sSgimlkjgGybgXQ|||||APMP-UnhMUQPoQC9PeAJYA8"
        }]
    }],
    "channel-bundles": [{
        "id": "NA-lTs2sSgimlkjgGybgXQ|||||APMUI_-LJEOiqKtXwQ19WoQ",
        "transport": {
            "xmlns": "urn:xmpp:jingle:transports:ice-udp:1",
            "rtcp-mux": true
        }
    }, {
        "id": "NA-lTs2sSgimlkjgGybgXQ|||||C7Rj-qmEQBmWPHi6E33d-w",
        "transport": {
            "xmlns": "urn:xmpp:jingle:transports:ice-udp:1",
            "rtcp-mux": true
        }
    }, {
        "id": "NA-lTs2sSgimlkjgGybgXQ|||||APMP-UnhMUQPoQC9PeAJYA8",
        "transport": {
            "xmlns": "urn:xmpp:jingle:transports:ice-udp:1",
            "rtcp-mux": true
        }
    }]
}