-------------------------------------------------------------------------------------------------------------------------------------------------
Recommended Teams version : latest version. Update history for Microsoft Teams App Version here.
The following article provides guidelines for troubleshooting the HDX optimization for Microsoft Teams in Citrix Virtual Apps and Desktops.
Citrix strongly recommends the latest current release Workspace app version. Most of the new features require an upgrade of the Workspace app, hence the Current Release model is the preferred delivery mechanism.
-------------------------------------------------------------------------------------------------------------------------------------------------
Live updates on known issues
Public details about the Multi-Window feature can be found in the Tech Community article: New Meeting and Calling Experience in Microsoft Teams!
-------------------------------------------------------------------------------------------------------------------------------------------------
Please note that, generally, fully quitting Teams (Systray icon / right click / quit) and restarting it clears all the components involved and can fix whatever issue you were experiencing.
Also, keep in mind that Teams feature set is different when comparing optimized vs non-optimized. When Teams is not optimized, it runs on the VDA with its native media engine and all the features are supported (although multimedia rendering happens on the VDA, incurring in a CPU tax)
[Warning: If your VDA is 7.15 (any CU) and you still want to use Teams in unoptimized mode (the only mode supported in these VDA versions), scroll here. Teams HDX optimization will not be backported to the LTSR 7.15].
Step-by-step:
Microsoft Teams optimization mechanisms can be divided into 5 main areas
5. Monitoring
More information on how to leverage HDX Monitor to monitor Teams optimization can be found here.
Proper troubleshooting requires the Admin to verify each area progressively, moving down the list.
Please note that the presence of a Citrix Gateway as an HDX proxy should have no impact, so you can discard that from your troubleshooting. If you are also using the Gateway for VPN, make sure you are allowing the client machine to reach the O365 Teams servers.
#1: Media Engine instantiation
The quickest way to determine if the user is running in optimized mode is to look for HdxRtcEngine.exe running on the user’s client machine:
For Linux, run:
#ps -ef | grep -i hdxrtcengine
If the process is not found, then point #1.1 should be investigated first.
#1.1: Teams must launch in optimized mode
Click on the avatar / About / Version. “Citrix HDX Optimized" should be displayed. This means Teams is ready for an optimized call.
If the legend is not there, and instead you see "Citrix HDX Not Connected" then Teams did not load in VDI mode correctly.
Citrix HDX Not Connected means Teams loaded the Citrix API correctly, but it could not complete an end-to-end check because there was an error in subsequent parts of the stack. Most likely, VDA Services (Citrix HDX HTML5 Video Redirection, Citrix HDX Teams Redirection) or in Workspace app.
If there is no legend with the word Citrix, then Teams did not load in VDI mode at all:
The VDA regkey MsTeamsRedir is set by a Citrix service (CtxSvcHost.exe) when the user logs on or reconnects to the virtual desktop. Teams will read this key when starting, and if the value is 1, it will load in VDI mode.
The value is set to 1 automatically if and only if:
If = 0 or missing – trouble!
Action: Quit Teams from the systray itself (right click on the icon / Quit).
Sometimes, if Teams auto-updated while the session was in disconnected state, it can fail to read the key properly upon reconnections.
Lastly, if the regkey value is 1 but Teams still fails to display "Citrix HDX Optimized" or "Citrix HDX Not Connected", there is likely a problem with Teams itself. Common issues could be erroneous cached items (settings.json and storage.json) in AppData\Roaming\Microsoft\Teams , or even dual Teams installations (under %appdata% and Program Files). Customers are advised to contact Microsoft support in this case.
#1.2: WebSocket phase
The VDA Service “Citrix HDX HTML5 Video Redirection” [WebSocketService.exe] is the point of entry for Teams into the VDA. In other words, Teams must open a secure websocket connection to this service, which listens at 127.0.0.1:9002 in the VDA.
If WebSocketService.exe is not actively listening, optimization will fail. In some cases, the Service will show as “Running” in the services.msc console, but when you run netstat you will not see the socket.
Therefore, you must make sure it is running and LISTENING :
`
After a successful connection, you will see the state change to “ESTABLISHED”:
[Note: WebSocketService.exe listens also at 9001 – this socket is used for other HDX features (Browser Content Redirection and HTML5 Video Redirection, and they are independent of Teams)]
-Proxies: If an explicit proxy server is configured in the VDA, make sure connections to localhost are not routed through it. Otherwise, redirection will fail. You must "bypass proxy servers for local address" 127.0.0.1:9002
-PAC files: make sure your VDA pac file script is returning DIRECT for wss://127.0.0.1:9002. If not, optimization will fail. One way to do this:
shExpMatch(url, "wss://127.0.0.1:9002/*")
-Anti-Virus: Some security software products interfere with the proper functioning of WebSocketService.exe
and its certificates. While the actual service (Citrix HDX HTML5 Video Redirection) might be running in the services.msc
console, the localhost 127.0.0.1:9002
TCP socket is never in listening mode as seen in netstat. Trying to restart the service causes it to hang (“Stopping…”). Ensure you apply the proper exclusions for the WebScoketService.exe
process.
Once there is a successful secure WebSocket (wss) connection, WebSocketService.exe will create a new process in the user’s session called WebSocketAgent.exe:
This process can also be spotted in Director:
[Note: WebSocketAgent.exe is also used for BCR and HTML5 Video Redirection]
Action: if WebSocketAgent.exe is not being created while 127.0.0.1:9002 is ESTABLISHED, restart the WebSocketService.exe service. Relaunching Teams might be required. Also, in some rare cases, you might see WebSocketAgent.exe coming up but closing within a second, and in this case this could be related to a crash in HdxRtcEngine.exe in the client machine (hence make sure to collect EventViewer entries on the client).
The last part of this second phase is the establishment of the Teams virtual channel (CTXMTOP), and this process is ultimately handled by the “Citrix HDX Teams Redirection” Service (CtxSvcHost.exe in the VDA).
CTXMTOP is a Command & Control virtual channel only – no media is exchanged between CWA and VDA. All the media is handled by CWA in a Client-Fetch-Client-Render manner.
Action: If WebSocketAgent.exe is running on the VDA but HdxRtcEngine.exe is not running on the client, restart “Citrix HDX Teams Redirection”.
Notes on HdxRtcEngine.exe : |
If you are locking down the endpoint in Kiosk-mode, or restricting users to interact only with whitelisted apps by using GPOs for "Assigned Access Configuration", then make sure HdxRtcEngine.exe is allowed to run. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\AssignedAccessConfiguration\Profiles\ |
Some Anti-Virus programs might interfere with HdxRtcEngine.exe (which will open and close instantly) . Make sure you are applying proper exclusions. |
#1.3: HdxRtcEngine.exe
Once the virtual channel is established, the Citrix HDX Engine in CWA (wfica32.exe) will spawn the media engine on the client:
At this point, Teams is ready to handle calls.
If HdxRtcEngine.exe launches, then the respective webrpc log will be created.
-Windows Logs:
They can be found on the user’s machine in %userprofile%\AppData\Local\Temp\HdxRtcEngine folder.
Each HDX session will create its own separate folder.
-Mac Logs:
1. vdwebrtc log -- records the execution of Virtual Channel vdwebrtc
Location: /Users/<User Name>/Library/Logs/Citrix Workspace/CitrixViewer_<Y_M_D_H_M_S>.txt
2. HdxRtcEngine log -- records the execution of process HdxRtcEngine
Location: /Users/<User Name>/Library/Logs/HdxRtcEngine/hdxrtcengine/<W_M_D_H_M_S_Y>/hdxrtcengine.log
Note that Hdxrtcengine log is enabled by default.
-Linux Logs:
The /tmp/webrpc/<current date>/ and /tmp/hdxrtcengine/<current date>/ directory will have log files.
#2:Media Engine peripheral acquisition
In Teams, go to Settings à Devices. All the peripherals should now be mapped, and the video self-preview visible. You should be able to toggle between the cameras too.
The "Make a test call" button is a very handy tool to assess peripheral acquisition and performance. Go to Settings/Devices/Audio devices.
Note: when Teams enumerates Playback/Recording peripherals, it will select the ones that are defaults at the endpoint. Open mmsys.cpl on the endpoint, and you can see what the default devices are in the user's client machine. These are the ones that will be auto-selected by Teams.
You can toggle these devices in the middle of a call - in that case, a 1 sec audio glitch might be experienced while the new devices are remapped.
The peripheral acquisition process is captured in the webrpc.txt logs.
All device enumeration entries will have “webrtcapi.RPCStubs” in the respective lines.
============================= Thu Nov 28 15:08:30 2019 ============================= Nov 28 15:08:30.947 webrtcapi.DeviceManager Info: Audio device IMMNotificationClient registration successful. Nov 28 15:08:30.948 webrtcapi.VideoOverlay Info: setProvider. set overlay provider (current = 0, new = 10168640)! Nov 28 15:08:30.949 webrtcapi.DeviceManager Info: operator (). Device monitor message window created Nov 28 15:08:31.287 webrtcapi.RPCStubs Info: -> device id = {0.0.1.00000000}.{100c5b9e-8f9f-4bc4-8ff2-196c45c88f76} label = Headset Microphone (Jabra EVOLVE LINK MS) groupId = 1445567130 Nov 28 15:08:31.305 webrtcapi.RPCStubs Info: -> device id = {0.0.1.00000000}.{ee2e77ed-f871-4c65-8476-a40942ea913f} label = Microphone Array (Realtek High Definition Audio(SST)) groupId = 152748168 Nov 28 15:08:31.348 webrtcapi.RPCStubs Info: -> device id = {0.0.0.00000000}.{c11106bd-8a8e-441e-8bba-1740b9b9934b} label = Headset Earphone (Jabra EVOLVE LINK MS) groupId = 1445567130 Nov 28 15:08:31.351 webrtcapi.RPCStubs Info: -> device id = {0.0.0.00000000}.{d10485d5-ddbb-4568-a3ee-214d73dc6b09} label = Speakers (Realtek High Definition Audio(SST)) groupId = 152748168 Nov 28 15:08:31.385 webrtcapi.RPCStubs Info: -> device id = \\?\display#int3470#4&1835d135&0&uid13424#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\{bf89b5a5-61f7-4127-a279-e187013d7caf} label = Microsoft Camera Front groupId = Nov 28 15:08:31.397 webrtcapi.RPCStubs Info: -> device id = \\?\display#int3470#4&1835d135&0&uid13424#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\{7c9bbcea-909c-47b3-8cf9-2aa8237e1d4b} label = Microsoft Camera Rear groupId = […] Nov 28 15:15:01.197 webrtcapi.CameraCapture Info: start. capabilities: width = 1280 height = 720 fps = 30 fmt = 9 Nov 28 15:15:01.553 webrtcapi.DxVideoRenderer Info: configure. window = 203588 frameWidth =1280 frameHeight = 720 […] |
============================= Sun Mar 29 13:23:57 2020 ============================= Mar 29 13:23:57.232 webrtcapi.WebRTCEngine Info: init. initializing... Mar 29 13:23:57.520 webrtcapi.WebRTCEngine Error: init. couldn't create audio module! |
HdxTeams.exe supports only these specific audio device formats (channels, bit depth, and sample rate):
Even if one speaker or microphone does not match the expected settings, device enumeration in Teams fails and None displays under Settings > Devices. As a workaround, open the Sound Control Panel (mmsys.cpl), select the playback or recording device, go to Properties > Advanced and change the settings to a supported mode. |
TRICKLE ICE snippet [...] >>> begin:sdp candidate:780896439 1 udp 2122063615 10.0.0.140 52811 typ host generation 0 ufrag 9gep network-id 1 network-cost 10 candidate:1938109490 1 udp 24911871 52.114.188.57 51757 typ relay raddr 73.205.xxx.xxx rport 5039 generation 0 ufrag 9gep network-id 1 network-cost 10 <<< end:sdp [...] |
SDP ANSWER: […] a=candidate:1 1 UDP 36044286 52.114.138.158 3480 typ relay raddr 10.0.136.233 rport 3480 a=candidate:2 1 TCP 18086910 52.114.138.158 3478 typ relay raddr 10.0.136.233 rport 3478 […] |
The VDI user caller will register remote ICE candidate and begin connectivity checks (STUN Bind request/response). Sometimes, the calling peer can be behind a Firewall that blocks STUN/UDP packets, and in such a case there will no answer to the STUN Bind requests:
[Warning: STUN Bind requests are essential for a healthy call setup, as this allows candidate discovery with optimal call routing (especially in p2p calls). If your branch office Firewalls are blocking STUN and UDP destination ports 3478-81, then a transport relay in O365 must be contacted using TCP which adds additional latency and degrades call quality experience].
Since the Firewall is blocking UDP, the calling peer must attempt a TCP connection to the other candidate:2
If that also fails, it will have to use his transport relay (“relay raddr”) seen in the Trickle ice snippet above (52.114.188.57).
Important note for branch-office proxies: HdxRtcEngine.exe cannot read explicit proxy configurations on the endpoint.
This was fixed in:
or higher versions. In those releases, the HDX media engine will read the system proxy settings and honor the configuration (e.g. explicit proxies or pac files).
#3.3 RTP media flows
If the connection was established using TCP through a TURN server, you will not be able to decode the traffic in Wireshark as RTP since it is encrypted using TLS.
In case of a peer-to-peer connection or conference via UDP, then Wireshark will show more detailed info that can be used to understand the traffic flow between the participants.
Wireshark recommendations:
RTP cannot be automatically analyzed by Wireshark. Applying the Display filter ‘rtp’ won’t result in any RTP packets displayed.
Instead, first set the Display Filter to ‘udp’ to spot UDP traffic. After the connection is established, there will be UDP traffic sent regularly between the peers. RTP over UDP traffic will begin with 90 hexa (or 80 hexa if no RTP header extensions are present) in Data, the first octet of the RTP header.
By selecting one of these UDP packets and selecting "Analyze/Decode As" … then selecting RTP, Wireshark will process the packets as RTP.
The WebRTC media engine in Workspace app (HdxRtcEngine.exe) uses the Secure RTP and DTLS protocols for multimedia streams that are offloaded to the client. SRTP provides confidentiality and authentication to RTP, using symmetric keys to encrypt media and control messages, and uses the AES encryption cipher.
4. Media Engine multimedia stream processing
Once the call set up is finalized and the ICE connectivity checks are completed, the media will be exchanged between the parties.
Currently we support video resolutions up to 720p@30fps, with 360p being common [H264 and VP9].
-The video streams are captured in the webrp.txt logs as "DxVideoRenderer ":
webrtcapi.DxVideoRenderer Info: configure. window = 657170 frameWidth = 640 frameHeight = 360
-The webcam captures entries in webrp.txt are"CameraCapture":
webrtcapi.CameraCapture Info: start. capabilities: width = 640 height = 360 fps = 30 fmt = 9
Lip sync issues might be caused by high CPU usage on the endpoint. The encoding process (camera capture and subsequent encoding) is more expensive in CPU terms than decoding. Some endpoints might not have enough processing power (see here for system requirements), resulting in 100% CPU utilization and causing audio/video to be out of sync.
Important note: Workspace app for Windows 1912 LTSR and 2002 CR (and any posterior version) introduced a performance estimator that is designed to measure the encoding capabilities of the endpoint's CPU. As a result, the video encoding is limited to a certain resolution (240p, 360p, 720p, 1080p). This is particularly useful for endpoints that have low CPU speeds/amount of cores. The estimator is run on HdxRtcEngine.exe launch time, transparent to the user. The estimator might return a value that is lower for VP9 vs H264, since VP9 consumes more CPU. If you would like to tweak the resolution values, or disable VP9 and use H264 exclusively, this can be controlled via regkeys on the endpoint. See here for more details. Citrix Workspace app (Windows 2103.1, Linux 2103, Mac 2102) does not support VP9 anymore for p2p video calls. H264 will be used instead for every type of call now (meetings or p2p), preserving client CPU. |
The RTP protocol can be decoded in Wireshark to understand what type of codecs are being used and how much bandwidth is consumed.
#4.1 As an example we will investigate a p2p audio call between two VDI users. HdxRtcEngine.exe will select the Opus codec for this scenario, which can be seen clearly in the SDP Offer/Answer negotiation.
The calling party will state all his supported codecs, and the callee will then reply with his preferred choice in the SDP answer.
[Note: The notification audio (ringtone) is played by Teams out of the VDA’s default playout device.]
The call bandwidth usage can then be plotted in Wireshark using the Statisticsà IO Graph option.
Apply the proper filters to display only the traffic associated with the call.
We can see that the typical bandwidth for a voice call is ~40-70 kbps (each way).
Green: outgoing | Blue: incoming | Red: outgoing + incoming
Screensharing
In the Skype for Business optimization pack (RTOP), screensharing was not optimized. In other words, there was no offloading of such streams and therefore they were rendered server-side natively by Skype for Business.
But in terms of HDX optimization for Microsoft Teams, incoming screensharing is no different than incoming webcam video streams, since Teams relies on video-based-screen-sharing. Hence it is optimized by default.
However, a VDI user sharing his monitor (i.e. outgoing screensharing) will result in HdxRtcEngine.exe performing display captures at the endpoint (with H.264). Currently it is only possible to share the primary (default) monitor with CWA 2105 or older.
HdxRtcEngine.exe crops the sharing to the Desktop Viewer window only (if CWA's Desktop Viewer is in Windowed mode).
If Desktop Viewer (cdviewer.exe) is in full screen mode, then of course the entire monitor is shared.
In multi-monitor setups, only the primary monitor is shared, and the screen picker button in Teams will label the preview as 'Screen #1'.
Multimonitor setups are now supported with CWA 2106 for Win/Linux/Mac or higher.
In the Windows case, Desktop Viewer must be enabled in StoreFront/ICA file and in full screen mode in order for the picker to display all available monitors.
Troubleshooting screensharing issues:
Common issues with screensharing, as perceived by the other peer, are:
- low resolution or low fps
- black window instead of the actual screen
- screen freeze from the sender's side
The webrpc.txt logs (AppData\Local\Temp\HdxRtcEngine in the user's device, not the VDA) are the best source for troubleshooting such issues.
The outgoing screensharing flow is as follows:
[CreateDisplayTrack --> VideoTrackSource (id = ########) --> startVideoTrackSource --> DesktopCapture.start]
Oct 01 10:06:24.222 webrtcapi.WebRTCEngine Info: createDisplayTrack. id = DV-9d1651420da4 sourceId = Oct 01 10:06:24.223 webrtcapi.VideoTrackSource Info: VideoTrackSource. id = 03B28CB8 source-id = 0 width = 1920 height = 1080 fps = 15 Oct 01 10:06:24.224 webrtcapi.MediaStreamTrack Trace: MediaStreamTrack. video track-id = DV-9d1651420da4 label = display-track state = 0 Oct 01 10:06:24.224 webrtcapi.WebRTCEngine Trace: startVideoTrackSource. first capture consumer, source-id = 0 Oct 01 10:06:24.224 webrtcapi.DesktopCapture Info: start. |
HdxRtcEngine.exe contains a bandwidth estimator that will allow Teams to pick the best resolution that can be sustained by the network, and sometimes it can take a few seconds for it to converge to the right value. So screensharing might actually start with a low resolution before it jumps to a higher one.
In the webrpc logs, look for "webrtcapi.VideoTrackSource Info: setOptions" to spot what resolution and fps is being applied:
[2716.921] Oct 04 11:35:10.670 webrtcapi.VideoTrackSource Info: setOptions. id = 03457800 width = 1920 height = 1080 fps = 15 |
In the logs, also the parameter "webrtcapi.DesktopCapture" can be used for quick finds, and if there are errors they would be logged as "webrtcapi.DesktopCapture Error:".
Black windows can be caused by issues on the sender's side (user capturing) or the receiver's side (user rendering the stream).
For example, if the error is on the sender's side the following entry could be seen:
webrtcapi.DesktopCapture Error: OnCaptureResult. invalid cropping rectangle (x = 0 y = 0 width = 0 height = 0)
Monitoring Teams with HDX Monitor
On 1912 VDAs (or higher), you can monitor an optimized active call using HDX Monitor (3.5.2 or higher).
Important : make sure you are matching the HDX monitor version with the right VDA version (HDX Monitor is packaged with the CVAD .iso)
To turn this on, create the following WebrtcDirectorIntegration regkey on the VDA:
HKLM\Software\Citrix\HDXMediaStream\
Or
HKLM\SOFTWARE\WOW6432Node\Citrix\HdxMediaStream
- reg key value:
name: WebrtcDirectorIntegration
type: DWORD
value: enable(1), disable(0)
The information is displayed under the WebRTC icon :
The following data content will be populated when an active Teams redirection is going on.
Please see below for the detailed field description:
Guidelines for 7.15 LTSR
If you are using 7.15 LTSR (with any CU), please note that the new HDX Optimization for Microsoft Teams is not (and will not be) available in this version and the only way to use Teams is through the legacy HDX technologies:
Name | Type | Mandatory | Acceptable values |
EnableSimulcast | Int | YES | 1 to 3 (Set it to 1) |
MaxOutgoingResolution | int | YES | 180,240,360,540,720,1080 (Teams supported Resolutions) |
MaxIncomingResolution | int | YES | 180,240,360,540,720,1080 (Teams supported Resolutions) |
MaxIncomingStreams | int | YES | 1 to 8 |
MaxSimulcastLayers | int | YES | 1 to 3 (set it to 1) |
MaxVideoFrameRate | int | NO | 1 to 30 |
MaxScreenshareFrameRate | int | NO | 1 to 15 |
********************************************************************************************