Can we control the Bandwidth for webrtc Screensharing

257 views
Skip to first unread message

chetan batra

unread,
Feb 10, 2020, 7:50:44 AM2/10/20
to discuss-webrtc

I am familiar with webrtc bandwidth control for video streams. I am able to specify maximum bandwidth for video steams(P2P connections). But when I tried to set max bitrate i.e. specify the bandwidth for screen sharing P2P connection I am getting following error.

Uncaught (in promise) DOMException: Read-only field modified in setParameters().

For code reference I am using following method for bandwidth

'RTCRtpSender' in window

'setParameters' in window.RTCRtpSender.prototype

I just want to know if we can control the bandwidth of screen share over webrtc or I am doing something wrong.


Thanks in advance

Chetan

Philipp Hancke

unread,
Feb 10, 2020, 7:56:38 AM2/10/20
to discuss...@googlegroups.com
modifying https://webrtc.github.io/samples/src/content/peerconnection/bandwidth/ to use getDisplayMedia instead of getUserMedia works just fine here. Are you calling getParameters before calling setParameters?

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/2ce8f2f0-a13e-4541-9220-6db9d451601b%40googlegroups.com.

chetan batra

unread,
Feb 10, 2020, 8:02:10 AM2/10/20
to discuss-webrtc
Thanks Philipp for replying.

yes I am calling getParamets before setParameters.

Also I am simply doing following
```
let sender = pc.getSenders()[1]; 
let parameters = sender.getParameters();
if (isEmpty(parameters.encodings)) {
parameters.encodings = [{}];
}
parameters.encodings[0].maxBitrate = bitrate;
sender.setParameters(parameters); ```` 

chetan batra

unread,
Feb 10, 2020, 8:06:08 AM2/10/20
to discuss-webrtc
Thanks Philipp for replying.

yes I am calling getParamets before setParameters.

Also I am simply doing following

let sender = pc.getSenders()[1];
let parameters = sender.getParameters();
if (isEmpty(parameters.encodings)) {
parameters.encodings = [{}];
}
parameters.encodings[0].maxBitrate = bitrate;
sender.setParameters(parameters);

On Monday, 10 February 2020 18:26:38 UTC+5:30, Philipp Hancke wrote:
modifying https://webrtc.github.io/samples/src/content/peerconnection/bandwidth/ to use getDisplayMedia instead of getUserMedia works just fine here. Are you calling getParameters before calling setParameters?

Am Mo., 10. Feb. 2020 um 13:50 Uhr schrieb chetan batra <chetan...@gmail.com>:

I am familiar with webrtc bandwidth control for video streams. I am able to specify maximum bandwidth for video steams(P2P connections). But when I tried to set max bitrate i.e. specify the bandwidth for screen sharing P2P connection I am getting following error.

Uncaught (in promise) DOMException: Read-only field modified in setParameters().

For code reference I am using following method for bandwidth

'RTCRtpSender' in window

'setParameters' in window.RTCRtpSender.prototype

I just want to know if we can control the bandwidth of screen share over webrtc or I am doing something wrong.


Thanks in advance

Chetan

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss...@googlegroups.com.

Philipp Hancke

unread,
Feb 10, 2020, 10:29:08 AM2/10/20
to discuss...@googlegroups.com
which looks similar enough to the sample code. Have you checked what is different in your code, like the timing of when this is called?

To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/58a0e4e6-9757-4a3e-ac8c-51a772250279%40googlegroups.com.

chetan batra

unread,
Feb 10, 2020, 11:26:53 AM2/10/20
to discuss...@googlegroups.com
Its working fine for P2P video streams, not working for screen share only. So checking if its possible to set bandwidth for screen sharing connection.

Reply all
Reply to author
Forward
0 new messages