1 | | When remote remove and add back media lines, it will hit the assertion "Currently no media transport reuse" in pjsua_call_media_init(), which is caused by improper stopping and clean up of the removed media. |
| 1 | Reported scenarios: |
| 2 | |
| 3 | ==== Scenario 1 - assertion of "Currently no media transport reuse" ==== |
| 4 | 1. receive offer with 2 media lines, RTP/SAVP and RTP/AVP, both active |
| 5 | 1. accept with 2 media lines in answer, RTP/SAVP gets port zeroed and RTP/AVP active (SRTP mode is set to disabled) |
| 6 | 1. receive reoffer with only 1 media line, RTP/AVP |
| 7 | 1. accept the reoffer |
| 8 | 1. receive reoffer with 2 media lines as in no 1, and assert occurs |
| 9 | It is caused by improper stopping and clean up of the removed media. |
| 10 | |
| 11 | |
| 12 | ==== Scenario 2 - crash after accessing invalid call_med->tp pointer ==== |
| 13 | 1. receive offer with 2 media lines, RTP/SAVP and RTP/AVP, both active |
| 14 | 1. send answer with 2 media lines, RTP/SAVP gets port zeroed and RTP/AVP active (SRTP mode is set to disabled) |
| 15 | 1. receive reoffer with only 1 media line, RTP/AVP |
| 16 | 1. reject the reoffer (e.g: because of no matching codec) |
| 17 | 1. receive reoffer with 2 media lines as in no 1, crash occurs |
| 18 | This seems to be a bug in r5124 (initial fix of scenario 1), it stops the removed media stream and cleans up its media transport right after receiving reoffer with less media lines (no 3), so when the SDP nego fails (the re-offer is rejected), call media states become inconsistent. Note that in SDP reoffer/answer, we shouldn't modify the media streams before SDP nego is done, as if SDP nego fails, the media streams should be maintained as if there is no SDP reoffer. |
| 19 | |
| 20 | Also revisiting a related ticket #1626, where it modifies the media streams before SDP nego: the assertion happens because it gets into unknown media type block handler, while it should never do. So we need to update the fix, e.g: only set the media type when it is undefined. |
| 21 | |
| 22 | Thanks to Brian Walker for the reports. |