Common questions and errors with WebRTC 2.0 (MConnect). For the first steps see the Quick Start.
Connection
What is the channel URL?
https://<signaling server>/<room>/<channel>, for example https://videosdk.medialooks.com:8080/MyRoom/MyChannel. The application that creates it (Channel_Create) is the Host; applications that connect to it (Channel_Connect) are Guests. The Host sends to all Guests, a Guest sends to the Host. Guests do not receive each other directly: the Host can mix them and send the result to everybody, as the Meeting Sample does.
The receiver is connected, but no frames arrive
- Wait a few seconds: the connection between the peers is set up after
Channel_Connectreturns. Until thenChannelReceivefails. - The sender has to send frames. A Host that only created the channel produces nothing.
- On the Host,
ChannelInfoGetshows the number of connected peers (nChannelsConnected). - Check that both sides use exactly the same URL.
- Peers in different networks may need a TURN server, see below.
ChannelReceive returns 0x800705B4, 0x80070490 or 0x80070015
0x800705B4 is a timeout: no frame arrived in the given time. 0x80070490 and 0x80070015 mean that the connection to the peer is not complete yet. Treat all of them as "no frame yet" and wait a little, for example 100 ms: while the connection is not ready, the call fails at once. In .NET catch Exception, not only COMException: 0x80070015 arrives as a FileNotFoundException.
Login to the signaling server times out
Check that the address and port are reachable, and that the server is a WebRTC 2.0 signaling server. WebRTC 1.0 and 2.0 signaling servers are not compatible, see the difference and how to switch.
The connection to the signaling server is lost. Do I have to reconnect?
No. MConnect reconnects by itself; the interval is set with sgn.reconnect_interval_msec (5000 by default) and the attempts are counted in the stat::sgn.reconnect_* properties. The state is in ChannelInfoGet (eSGNState). Video and audio between peers do not pass through the signaling server.
Can I use the Medialooks test servers in production?
No, they are for tests. Run your own, see Signaling server WebRTC 2.0 usage.
Network and TURN
When is a TURN server needed?
When peers cannot connect directly, for example behind a firewall that blocks UDP, or behind a symmetric NAT. For users in unknown networks, set one up. A TURN server configured on the signaling server is passed to browsers and to SDK applications. In an application you can also set it with the property turn_server, with the user name and password inside the value:
connect.PropsSet("turn_server", "<user>:<password>@turn.example.com:3478");
See TURN Server Configuration for WebRTC 2.0.
Is my connection direct or through TURN?
Read connected[i]::webrtc_stat[<peer id>]::ice.type of the channel; relay means a TURN server. The Meeting Sample of the MFormats SDK (C#) shows it for every guest in a tooltip. To test the TURN server, set ice_transports to relay: only relayed connections are then allowed.
Video, audio and frames
The traffic counters of ChannelInfoGet stay at zero
With MConnect only eSGNState and nChannelsConnected are filled. Read the traffic from the properties of the channel, for example stat::send_total_kbps, stat::recv_total_kbps, stat::pipe_video.fps and stat::latency_avg.
The memory grows while the program runs
Release every frame returned by SourceFrameGet or ChannelReceive: Marshal.ReleaseComObject in .NET, a smart pointer in C++, nil in Delphi.
How do I change the codec and the bitrate?
var props = (MCChannelClass)channel; // in C#, MCChannelClass has PropsSet and PropsGet
props.PropsSet("video_encoder", "gpu_h264"); // gpu_h264, cpu_h264, vp8, vp9
props.PropsSet("video_bitrate", "5M");
Both can be changed while streaming, as the codec list of the Duplex Sample does. All properties are listed in MConnect properties.
A guest hears its own voice
Switch mix-minus on: ((MCChannelClass)channel).PropsSet("mix_minus.enabled", "true"), see WebRTC Mix-Minus.
Browsers and security
Can a browser take part?
Yes. For a Host with the ID <id>, https://<server>/wg2/<id> joins with a camera and a microphone and https://<server>/<id> only watches. Read the ID with IMCChannelSGN.VTSG_InfoGet. The ID changes every time unless the channel is created with the property id=<name>. See also web page parameters.
Is a channel protected?
By default everybody who knows the URL can join, so use names that are hard to guess. A channel created with secured='true' asks web guests for a login and a password. The Host checks them in the remote_offer event. A guest is accepted unless the handler sets the attribute succeeded to false, so the handler has to reject first and accept only a valid login, see Duplex Sample: step by step. The check applies to web guests, not to applications that use Channel_Connect.
A guest with a wrong or missing password is accepted
Check the remote_offer handler. The attribute is succeeded, its default is true, and the handler has to set it to false before it reads guest_login and guest_password: reading a missing attribute throws, and the guest then stays accepted. If your copy of the C# Duplex sample sets succeded, correcting the spelling is not enough: replace the handler with the one in the step-by-step article.
Languages
Can an MFormats application talk to an MPlatform application?
Yes. Both use the same MConnect objects.
Which type does Channel_Create return in C#?
MCChannel: connect.Channel_Create(url, "", "", null, out MCChannel channel);. Cast it to IMCChannelSGN for the signaling methods, and to MCChannelClass for PropsSet and PropsGet.
Delphi: the type library unit does not compile (Undeclared identifier 'tagSIZE')
Move the declaration of tagSIZE in the generated unit above MF_VID_PTR, as in the units of the samples. Add Winapi;System.Win;System to the unit scope names.
C++: where do the headers come from?
The sample projects compile the IDL file of the SDK (Include\MFormats.idl or Include\MPlatform.idl) with MIDL into the MIDL folder of the project and include the generated header. The Include folder of the SDK also contains the generated MFormats.h and MPlatform.h, which can be included directly. Initialize COM in every thread that uses the objects, and release all interface pointers before CoUninitialize.
WebRTC 1.0
Are the web links of WebRTC 1.0 valid in WebRTC 2.0?
No, the WebRTC 2.0 signaling server and its pages have their own links.
Do I have to rewrite my WebRTC 1.0 application?
No. The MWebRTC API keeps working and can use the new core with one property. Many-to-many channels and mix-minus need MConnect. With MWebRTC on the new core, read the links from stat::path (web) and stat::my_upi (applications). See the difference and how to switch.
Still have questions?
Tell us what didn’t work or what you’d like clarified.