Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Runtime/Scripts/Room.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public Proto.IceServer ToProto()
var proto = new Proto.IceServer();
proto.Username = Username;
proto.Password = Password;
proto.Urls.AddRange(Urls);
if (Urls != null)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets revisit if we can make this code path private or internal or remove completely if unused in our examples.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also ask DevSup if we ever get requests for custom ICE servers

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also remove ContinualGatheringPolicy?

proto.Urls.AddRange(Urls);

return proto;
}
Expand Down Expand Up @@ -72,9 +73,12 @@ public Proto.RtcConfig ToProto()
break;
}

foreach (var item in IceServers)
if (IceServers != null)
{
proto.IceServers.Add(item.ToProto());
foreach (var item in IceServers)
{
proto.IceServers.Add(item.ToProto());
}
}

return proto;
Expand Down
3 changes: 2 additions & 1 deletion Tests/EditMode/LiveKit.EditModeTests.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
"nunit.framework.dll",
"Google.Protobuf.dll"
],
"autoReferenced": false,
"defineConstraints": [
Expand Down
39 changes: 39 additions & 0 deletions Tests/EditMode/RoomOptionsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using NUnit.Framework;

namespace LiveKit.EditModeTests
{
public class RoomOptionsTests
{
[Test]
public void RTCConfiguration_ToProto_DefaultInstance_DoesNotThrow()
{
var config = new RTCConfiguration();
Assert.DoesNotThrow(() => config.ToProto());
}

[Test]
public void IceServer_ToProto_WithAllFieldsSet_Succeeds()
{
var server = new IceServer
{
Urls = new[] { "stun:stun.example.com:3478" },
Username = "user",
Password = "pass"
};

var proto = server.ToProto();

Assert.AreEqual("user", proto.Username);
Assert.AreEqual("pass", proto.Password);
Assert.AreEqual(1, proto.Urls.Count);
Assert.AreEqual("stun:stun.example.com:3478", proto.Urls[0]);
}

[Test]
public void IceServer_ToProto_WithNullUrls_DoesNotThrow()
{
var server = new IceServer { Username = "u", Password = "p" };
Assert.DoesNotThrow(() => server.ToProto());
}
}
}
11 changes: 11 additions & 0 deletions Tests/EditMode/RoomOptionsTests.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading