1 | | [[Image()]] |
| 1 | = How to use WebRTC AEC = |
| 2 | To use WebRTC AEC, specify the value {{{PJMEDIA_ECHO_WEBRTC}}} in {{{pjsua_media_config.ec_options}}} ({{{MediaConfig.ecOptions}}} for PJSUA2), and specify the delay estimate for sound card and system buffers in {{{pjsua_media_config.ec_tail_len}}} ({{{MediaConfig.ecTailLen}}} for PJSUA2). WebRTC AEC's performance is very dependent on this delay calculation. A poor estimate, even by as little as 40ms, may affect the echo cancellation results greatly. Our WebRTC wrapper has enabled the delay agnostic feature, which will adjust the delay accordingly, however it may take some time (5-10s or more) for the AEC module to learn the optimal delay, thus a good initial estimate is necessary for good EC quality in the beginning of a call. |
| 3 | |
| 4 | The delay should be '''at least''' as much as frame time (by default, ptime is 20ms) + {{{PJMEDIA_WSOLA_DELAY_MSEC}}} (the default is 5ms). |
| 5 | |
| 6 | In PJSUA sample application, run it with the options {{{--ec-opt=3}}} and specify the delay estimate in {{{--ec-tail}}} options. For example: |
| 7 | {{{ |
| 8 | ./pjsua --ec-opt=3 --ec-tail=30 |
| 9 | }}} |
| 10 | |
| 11 | = Poor WebRTC EC quality = |
| 12 | Disable {{{PJMEDIA_WEBRTC_AEC_USE_MOBILE}}} (set it to 0), then change the definition of {{{SHOW_DELAY_METRICS}}} in {{{pjmedia/src/pjmedia/echo_webrtc.c}}} to a non-zero value. For example, if you set to 250, with ptime 20ms, it will print the delay metrics stats every 5 seconds or so. |
| 13 | {{{ |
| 14 | #define SHOW_DELAY_METRICS 250 |
| 15 | }}} |
| 16 | What you need to see in the log is the line: |
| 17 | {{{ |
| 18 | median=%d, std=%d, fraction of poor delays=%f |
| 19 | }}} |
| 20 | Fraction of poor delays is a value between 0 and 1. The closer the value to 1, the poorer the EC quality. |
| 21 | |
| 22 | To improve the EC quality, here are a few things you can try: |
| 23 | - Adjust the EC tail value to the median value. |
| 24 | - Activate noise suppression (pass the options when creating EC with flag {{{PJMEDIA_ECHO_USE_NOISE_SUPPRESSOR}}}). |
| 25 | - Increase EC aggressiveness (pass the options when creating EC with flag {{{PJMEDIA_ECHO_AGGRESSIVENESS_AGGRESSIVE}}}). |
| 26 | - Disable the mobile version by setting {{{PJMEDIA_WEBRTC_AEC_USE_MOBILE}}} to 0 (by doing this, AEC will operate in floating-point mode (instead of integer), which may decrease performance). |
| 27 | |
| 28 | [[br]][[br]]'''*Starting from release 2.6, the build instructions below is no longer required''' since WebRTC has been integrated into third_party. For more details, please refer to ticket #1954 instead.*[[br]][[br]] |
65 | | |
66 | | |
67 | | = How to use WebRTC AEC = |
68 | | To use WebRTC AEC, specify the value {{{PJMEDIA_ECHO_WEBRTC}}} in {{{pjsua_media_config.ec_options}}} ({{{MediaConfig.ecOptions}}} for PJSUA2), and specify the delay estimate for sound card and system buffers in {{{pjsua_media_config.ec_tail_len}}} ({{{MediaConfig.ecTailLen}}} for PJSUA2). WebRTC AEC's performance is very dependent on this delay calculation. A poor estimate, even by as little as 40ms, may affect the echo cancellation results greatly. Our WebRTC wrapper has enabled the delay agnostic feature, which will adjust the delay accordingly, however it may take some time (5-10s or more) for the AEC module to learn the optimal delay, thus a good initial estimate is necessary for good EC quality in the beginning of a call. |
69 | | |
70 | | The delay should be '''at least''' as much as frame time (by default, ptime is 20ms) + {{{PJMEDIA_WSOLA_DELAY_MSEC}}} (the default is 5ms). |
71 | | |
72 | | In PJSUA sample application, run it with the options {{{--ec-opt=3}}} and specify the delay estimate in {{{--ec-tail}}} options. For example: |
73 | | {{{ |
74 | | ./pjsua --ec-opt=3 --ec-tail=30 |
75 | | }}} |
76 | | |
77 | | = Poor WebRTC EC quality = |
78 | | Disable {{{PJMEDIA_WEBRTC_AEC_USE_MOBILE}}} (set it to 0), then change the definition of {{{SHOW_DELAY_METRICS}}} in {{{pjmedia/src/pjmedia/echo_webrtc.c}}} to a non-zero value. For example, if you set to 250, with ptime 20ms, it will print the delay metrics stats every 5 seconds or so. |
79 | | {{{ |
80 | | #define SHOW_DELAY_METRICS 250 |
81 | | }}} |
82 | | What you need to see in the log is the line: |
83 | | {{{ |
84 | | median=%d, std=%d, fraction of poor delays=%f |
85 | | }}} |
86 | | Fraction of poor delays is a value between 0 and 1. The closer the value to 1, the poorer the EC quality. |
87 | | |
88 | | To improve the EC quality, here are a few things you can try: |
89 | | - Adjust the EC tail value to the median value. |
90 | | - Activate noise suppression (pass the options when creating EC with flag {{{PJMEDIA_ECHO_USE_NOISE_SUPPRESSOR}}}). |
91 | | - Increase EC aggressiveness (pass the options when creating EC with flag {{{PJMEDIA_ECHO_AGGRESSIVENESS_AGGRESSIVE}}}). |
92 | | - Disable the mobile version by setting {{{PJMEDIA_WEBRTC_AEC_USE_MOBILE}}} to 0 (by doing this, AEC will operate in floating-point mode (instead of integer), which may decrease performance). |