Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using DCL.Multiplayer.Connections.Rooms.Nulls;
using LiveKit;
using LiveKit.Rooms.Tracks;
using LiveKit.RtcSources.Video;

namespace DCL.Multiplayer.Connections.Rooms.Interior
{
public class InteriorLocalTracks: ILocalTracks, IInterior<ILocalTracks>
{
private ILocalTracks assigned = NullLocalTracks.INSTANCE;

public ITrack CreateAudioTrack(string name, IRtcAudioSource source) =>
assigned.EnsureAssigned().CreateAudioTrack(name, source);

public ITrack CreateVideoTrack(string name, RtcVideoSource source) =>
assigned.EnsureAssigned().CreateVideoTrack(name, source);

public void Assign(ILocalTracks value, out ILocalTracks? previous)
{
previous = assigned;
assigned = value;

previous = previous is NullLocalTracks ? null : previous;
}
}
}

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

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class InteriorRoom : IRoom, IInterior<IRoom>
private readonly InteriorDataPipe dataPipe = new ();
private readonly InteriorVideoStreams videoStreams = new ();
private readonly InteriorAudioStreams audioStreams = new ();
private readonly InteriorAudioTracks audioTracks = new ();
private readonly InteriorLocalTracks localTracks = new ();

private const int RESET_ROOM_TIMEOUT_SECONDS = 5;

Expand All @@ -38,7 +38,7 @@ public class InteriorRoom : IRoom, IInterior<IRoom>
public IRoomInfo Info => assigned.Info;
public IVideoStreams VideoStreams => videoStreams;
public IAudioStreams AudioStreams => audioStreams;
public IAudioTracks AudioTracks => audioTracks;
public ILocalTracks LocalTracks => localTracks;

internal IRoom assigned { get; private set; } = NullRoom.INSTANCE;

Expand Down Expand Up @@ -156,7 +156,7 @@ private void Subscribe(IRoom room)
dataPipe.Assign(room.DataPipe);
videoStreams.Assign(room.VideoStreams);
audioStreams.Assign(room.AudioStreams);
audioTracks.Assign(room.AudioTracks);
localTracks.Assign(room.LocalTracks);

room.RoomMetadataChanged += RoomOnRoomMetadataChanged;
room.RoomSidChanged += RoomOnRoomSidChanged;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using LiveKit.Rooms.Streaming.Audio;
using LiveKit.Rooms.TrackPublications;
using LiveKit.Rooms.Tracks;
using LiveKit.Rooms.Tracks.Factory;
using LiveKit.Rooms.Tracks.Hub;
using LiveKit.Rooms.VideoStreaming;
using System.Threading;
Expand All @@ -30,7 +31,7 @@ public class LogRoom : IRoom
public IRoomInfo Info { get; }
public IVideoStreams VideoStreams { get; }
public IAudioStreams AudioStreams { get; }
public IAudioTracks AudioTracks { get; }
public ILocalTracks LocalTracks { get; }

public event LocalPublishDelegate? LocalTrackPublished;
public event LocalPublishDelegate? LocalTrackUnpublished;
Expand Down Expand Up @@ -62,7 +63,7 @@ public LogRoom(IRoom origin, string roomName)
Info = new LogRoomInfo(origin.Info);
VideoStreams = new LogVideoStreams(origin.VideoStreams);
AudioStreams = new LogAudioStreams(origin.AudioStreams);
AudioTracks = new LogAudioTracks(origin.AudioTracks);
LocalTracks = new LogLocalTracks(origin.LocalTracks);

this.origin.LocalTrackPublished += OriginOnLocalTrackPublished;
this.origin.LocalTrackUnpublished += OriginOnLocalTrackUnpublished;
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using DCL.Diagnostics;
using LiveKit;
using LiveKit.Rooms.Tracks;
using LiveKit.RtcSources.Video;

namespace DCL.Multiplayer.Connections.Rooms.Logs
{
public class LogLocalTracks: ILocalTracks
{
private const string PREFIX = "LogLocalTracks:";

private readonly ILocalTracks origin;

public LogLocalTracks(ILocalTracks origin)
{
this.origin = origin;
}

public ITrack CreateAudioTrack(string name, IRtcAudioSource source)
{
ReportHub
.WithReport(ReportCategory.LIVEKIT)
.Log($"{PREFIX} {nameof(CreateAudioTrack)} called name:{name} sourceType:{source.GetType().Name}");

ITrack track = origin.CreateAudioTrack(name, source);

ReportHub
.WithReport(ReportCategory.LIVEKIT)
.Log($"{PREFIX} {nameof(CreateAudioTrack)} result trackType:{track.GetType().Name}");

return track;
}

public ITrack CreateVideoTrack(string name, RtcVideoSource source)
{
ReportHub
.WithReport(ReportCategory.LIVEKIT)
.Log($"{PREFIX} {nameof(CreateVideoTrack)} called name:{name} sourceType:{source.GetType().Name}");

ITrack track = origin.CreateVideoTrack(name, source);

ReportHub
.WithReport(ReportCategory.LIVEKIT)
.Log($"{PREFIX} {nameof(CreateVideoTrack)} result trackType:{track.GetType().Name}");

return track;
}
}
}

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

Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,22 @@
using System.Threading;
using System.Threading.Tasks;
using RichTypes;
using System;

namespace DCL.Multiplayer.Connections.Rooms
{
public class NullRoom : IRoom
{
public static readonly NullRoom INSTANCE = new ();
public static readonly WeakReference<IRoom> WEAK_INSTANCE = new (INSTANCE);

public IActiveSpeakers ActiveSpeakers => NullActiveSpeakers.INSTANCE;
public IParticipantsHub Participants => NullParticipantsHub.INSTANCE;
public IDataPipe DataPipe => NullDataPipe.INSTANCE;
public IRoomInfo Info => NullRoomInfo.INSTANCE;
public IVideoStreams VideoStreams => NullVideoStreams.INSTANCE;
public IAudioStreams AudioStreams => NullAudioStreams.INSTANCE;
public IAudioTracks AudioTracks => NullAudioTracks.INSTANCE;
public ILocalTracks LocalTracks => NullLocalTracks.INSTANCE;

public event LocalPublishDelegate? LocalTrackPublished;
public event LocalPublishDelegate? LocalTrackUnpublished;
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using LiveKit;
using LiveKit.Internal;
using LiveKit.Proto;
using LiveKit.Rooms;
using LiveKit.Rooms.Participants;
using LiveKit.Rooms.Tracks;
using LiveKit.RtcSources.Video;
using System;

namespace DCL.Multiplayer.Connections.Rooms.Nulls
{
public class NullLocalTracks : ILocalTracks
{
public static readonly NullLocalTracks INSTANCE = new ();

public ITrack CreateAudioTrack(string name, IRtcAudioSource source) =>
NullTrack.INSTANCE;

public ITrack CreateVideoTrack(string name, RtcVideoSource source) =>
NullTrack.INSTANCE;

private class NullTrack : ITrack
{
public static readonly NullTrack INSTANCE = new ();

public Origin Origin => Origin.Local;
public string Sid => "NullTrack: Sid null";
public string Name => "NullTrack: Name null";
public TrackKind Kind => TrackKind.KindUnknown;
public StreamState StreamState => StreamState.StateUnknown;
public bool Muted => true;
public WeakReference<IRoom> Room => NullRoom.WEAK_INSTANCE;
public WeakReference<Participant> Participant => NullParticipantsHub.WEAK_NULL_PARTICIPANT;
public FfiHandle? Handle => null;

public void UpdateMuted(bool muted) { }
}
}
}

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

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ public class NullParticipantsHub : IParticipantsHub
private static readonly IReadOnlyDictionary<string, Participant> EMPTY_DICTIONARY = new Dictionary<string, Participant>();

public static readonly NullParticipantsHub INSTANCE = new ();
private static readonly Participant NULL_PARTICIPANT = new ();
public static readonly Participant NULL_PARTICIPANT = new ();
public static readonly WeakReference<Participant> WEAK_NULL_PARTICIPANT = new (NULL_PARTICIPANT);
Comment thread
mihakrajnc marked this conversation as resolved.

public event ParticipantDelegate? UpdatesFromParticipant;

Expand Down
3 changes: 2 additions & 1 deletion Explorer/Assets/DCL/PluginSystem/DCL.Plugins.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@
"GUID:f8127c6ac263abf468221dcbccbde182",
"GUID:d0fdd32139c48634e9a421636d17ce04",
"GUID:b3ea857cc09201a4fb44cae9ca69de08",
"GUID:9a1625cbfe83d3842a7b140fc34eabb2"
"GUID:9a1625cbfe83d3842a7b140fc34eabb2",
"GUID:03a95e8e68fa74ca9a0d562b5f4e25a6"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand Down
2 changes: 1 addition & 1 deletion Explorer/Assets/DCL/VoiceChat/VoiceChatTrackManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public async UniTaskVoid PublishLocalTrackAsync(CancellationToken ct)
MicrophoneRtcAudioSource rtcAudioSource = result.Value;
rtcAudioSource.Start();

ITrack livekitMicrophoneTrack = voiceChatRoom.AudioTracks.CreateAudioTrack(
ITrack livekitMicrophoneTrack = voiceChatRoom.LocalTracks.CreateAudioTrack(
voiceChatRoom.Participants.LocalParticipant().Name,
rtcAudioSource
);
Expand Down
2 changes: 1 addition & 1 deletion Explorer/Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask",
"com.dcl.gpui-assets": "git@github.com:decentraland/unity-explorer-packages.git?path=/GPUInstancerPro/com.dcl.gpui-assets",
"com.decentraland.filebrowserpro": "git@github.com:decentraland/unity-explorer-packages.git?path=/FileBrowserPro",
"com.decentraland.livekit-sdk": "https://github.com/decentraland/client-sdk-unity.git#chore/rust-audio-for-mac-intel",
"com.decentraland.livekit-sdk": "https://github.com/decentraland/client-sdk-unity.git#chore/update-livekit-ffi",
"com.decentraland.renum": "https://github.com/NickKhalow/REnum.git?path=REnum",
"com.decentraland.renum.sourcegen": "https://github.com/NickKhalow/REnum.git#sourcegen/1.1.4",
"com.decentraland.rpc-csharp": "https://github.com/decentraland/rpc-csharp.git?path=rpc-csharp/src#f3dd251c7837cc2d844e1c07e741177a53676064",
Expand Down
4 changes: 2 additions & 2 deletions Explorer/Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@
"hash": "f57b137a6bd76527ea144b7e03cd7743f1b39599"
},
"com.decentraland.livekit-sdk": {
"version": "https://github.com/decentraland/client-sdk-unity.git#chore/rust-audio-for-mac-intel",
"version": "https://github.com/decentraland/client-sdk-unity.git#chore/update-livekit-ffi",
"depth": 0,
"source": "git",
"dependencies": {
"com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask",
"com.nickkhalow.richtypes": "https://github.com/NickKhalow/RichTypesUnity.git?path=/Packages/RichTypes"
},
"hash": "57d3e3176d31337f81d66beaabc5bba084bb6112"
"hash": "2f7e586cca753b6b6b5f7ae3ba4c2d58427c954e"
},
"com.decentraland.renum": {
"version": "https://github.com/NickKhalow/REnum.git?path=REnum",
Expand Down
Loading