paullouisageneau / libdatachannel

C/C++ WebRTC network library featuring Data Channels, Media Transport, and WebSockets
https://libdatachannel.org/
Mozilla Public License 2.0
1.81k stars 364 forks source link

Disable audio in SDP answer #898

Open rHina24 opened 1 year ago

rHina24 commented 1 year ago

I have the requirement for sending audio frames captured by openRTSP client through the WebRTC. Need to send audio if audio packets are available, Otherwise will send the video only.

Please find below description

  1. Receiving offer with audio and video
  2. sending audio and video both in answer
  3. Wanted to disable audio if audio packets are not available

Is it possible or any any option to disable audio in answer irrespective of offer message?

paullouisageneau commented 1 year ago

Sure, if you drop or close the track immedialety in the onTrack() callback, the track should be marked as removed in the answer.

However, for such a use case it is a better design for the sender to offer, so you can offer only the existing tracks.