Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebRTC - CPU reduction, settings to tweak

PRE-SCRIPTUM:

I have searched over StackOverflow and there is no Q/A explaining all possibilities of tweaking WebRTC to make it more viable for end products.

PROBLEM:

WebRTC has a very nice UX and it is cutting the edge. It should be perfect for mesh calls (3-8 people), but it is not yet. The biggest issue with mesh calls (all participants exchange streams with each other) is resource consumption, especially CPU.

Here are some stats I would like to share:

2.3 GHz Intel Core i5 (2 cores), OSX 10.10.2 (14C109), 4GB RAM, Chrome 40.0.2214.111 (64-bit)

+------------------------------------+----------+----------+
| Condition                          | CPU      | Delta    |
+------------------------------------+----------+----------+
| Chrome (idle after getUserMedia)   | 11%      | 11%      |
| Chrome-Chrome                      | 55%      | 44%      |
| Chrome-Chrome-Chrome               | 74%      | 19%      |
| Chrome-Chrome-Chrome-Chrome        | 102%     | 28%      |
+------------------------------------+----------+----------+

QUESTION:

I would like to create a table with WebRTC tweaks, which can improve resource consumption and make overall experience better. Are there any other settings I can play with apart from those which are in the table below?

+------------------------------------+--------------+----------------------+
| Tweak                              | CPU Effect   | Affects              |
+------------------------------------+--------------+----------------------+
| Lower FPS                          | Low to high  | Video quality lower  |
| Lower video bitrate                | Low to high  | Video quality lower  |
| Turn off echo cancellation         | Low          | Audio quality lower  |
| Lower source video resolution      | Low to high  | Video quality lower  |
| Get audio only source              | Very high    | No video             |
| Codecs? Compression? More?..       |              |                      |
+------------------------------------+--------------+----------------------+

P.S.

I would like to leave the same architecture (mesh), so MCU is not the thing I am searching for.

like image 771
igorpavlov Avatar asked Feb 18 '15 17:02

igorpavlov


1 Answers

You can change the audio rate and codec(OPUS -> PCMA/U) and you could also reduce the channels. Changing audio will help but video is your main CPU hog.

Firefox does support H.264. Using it could bring significant reductions to the CPU utilization as a ton of different architectures support hardware encoding/decoding of H.264. I am not 100% sure if Firefox will take advantage of that but it is worth a shot.

As for chrome, VP8 is really your only option for video at the moment and your codec agnostic changes(resolution, bitrate, etc.) are really the only way to address the cycles utilized there.

You may also be able to force Chrome to use a lower quality stream by negotiating the maximum bandwith in your SDP. Though, in the past, this has not worked with Firefox.

like image 162
Benjamin Trent Avatar answered Nov 04 '22 09:11

Benjamin Trent