Steam missing description

step 1:publish 1audio+3video

{"janus":"message","body":{"request":"publish","descriptions":[{"mid":"0","description":"101audio"},{"mid":"1","description":"102LCamera"},{"mid":"2","description":"103RCamera"},{"mid":"3","description":"104TSYScreen"}},"jsep……

got event

……"streams": [{"type": "audio","mindex": 0,"mid": "0","description": "101audio","codec": "opus"},{"type": "video","mindex": 1,"mid":"1","description": "102LCamera",  "codec": "h264","h264_profile": "42e01f"},{"type": "video","mindex": 2,"mid": "2","description": "103RCamera",                                                                                                                   "codec": "h264", "h264_profile": "42e01f"},{"type": "video","mindex": 3,"mid": "3","description": "104TSYScreen","codec": "h264","h264_profile": "42e01f"}]}},

step 2: add a 4th video stream(105MCamera) via configure

 {"janus":"message","body":{"request":"configure","descriptions":[{"mid":"0","description":"101audio"},{"mid":"1","description":"102LCamera"},{"mid":"2","description":"103RCamera"},{"mid":"3","description":"104TSYScreen"},{"mid":"4","description":"105MCamera"}]},"jsep":{"type":"OFFER",……

got event

……{"type": "video","mindex": 4,"mid": "4","description": "105MCamera","codec": "h264","h264_profile": "42e01f"}……

step 3:Removed 105MCamera via configure (by excluding it from descriptions) - server returns "disabled": true

{"request":"configure","descriptions":[{"mid":"0","description":"101audio"},{"mid":"1","description":"102LCamera"},{"mid":"2","description":"103RCamera"},{"mid":"3","description":"104TSYScreen"}]}

got event

……{"type": "video","mindex": 4,"mid": "4","disabled": true}……

step 4:Re-added 105MCamera via configure, but the stream remains disabled and gets a new mid=5 without description

 {"request":"configure","descriptions":[{"mid":"0","description":"101audio"},{"mid":"1","description":"102LCamera"},{"mid":"2","description":"103RCamera"},{"mid":"3","description":"104TSYScreen"},{"mid":"4","description":"105MCamera"}]}

got event, “description”: “105MCamera” is missing,and mid=4 still there.

{"type": "video","mindex": 4,"mid": "4","disabled": true},{"type": "video","mindex": 5,"mid": "5","codec": "h264","h264_profile": "42e01f"}

We’ve observed that the midvalue increments monotonically each time we remove and then re-add a stream via the configurerequest.

Issue:​​ When re-adding a previously removed stream:

  • The original mid=4 stays disabled

  • A new mid=5 is created without the expected description

  • I cannot properly reuse the same mid after removal

Question:​​ What is the correct API approach to properly add/remove streams without accumulating disabled tracks, while maintaining correct mid and description mapping?

You don’t create the mid in configure, you only reference existing ones in the SDP. You adding the camera again very likely results in a new m-line in the SDP, which is called mid:5 (while mid:4 is the previous one, still disabled), so when you pass a description for mid 4 and not mid 5, this results in the description for 4 being ignored, and the one for 5 not being available. As such, the code is doing exactly what it should.

You should check how you’re adding streams on the client side, and then take whatever mid was generated there to reference it properly in the VideoRoom API.