mirror of
https://github.com/opensim/opensim.git
synced 2026-05-14 18:55:39 +08:00
we decide participantId (test);cosmetics; update libomv
This commit is contained in:
@@ -58,16 +58,20 @@ namespace osWebRtcVoice
|
|||||||
|
|
||||||
public async Task<AudioBridgeResp> SendAudioBridgeMsg(PluginMsgReq pMsg)
|
public async Task<AudioBridgeResp> SendAudioBridgeMsg(PluginMsgReq pMsg)
|
||||||
{
|
{
|
||||||
AudioBridgeResp ret = null;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ret = new AudioBridgeResp(await SendPluginMsg(pMsg));
|
JanusMessageResp ret = await SendPluginMsg(pMsg).ConfigureAwait(false);
|
||||||
|
if(ret is not null)
|
||||||
|
return new AudioBridgeResp(ret);
|
||||||
|
else
|
||||||
|
m_log.Error($"{LogHeader} AudioBridge SendPluginMsg returned null");
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("{0} SendPluginMsg. Exception {1}", LogHeader, e);
|
m_log.Error($"{LogHeader} SendPluginMsg. Exception", e);
|
||||||
}
|
}
|
||||||
return ret;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -86,7 +90,7 @@ namespace osWebRtcVoice
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
JanusMessageResp resp = await SendPluginMsg(new AudioBridgeCreateRoomReq(pRoomId, pSpatial, pRoomDesc));
|
JanusMessageResp resp = await SendPluginMsg(new AudioBridgeCreateRoomReq(pRoomId, pSpatial, pRoomDesc));
|
||||||
AudioBridgeResp abResp = new AudioBridgeResp(resp);
|
AudioBridgeResp abResp = new(resp);
|
||||||
|
|
||||||
m_log.Debug($"{LogHeader} CreateRoom. ReturnCode: '{abResp.AudioBridgeReturnCode}'");
|
m_log.Debug($"{LogHeader} CreateRoom. ReturnCode: '{abResp.AudioBridgeReturnCode}'");
|
||||||
switch (abResp.AudioBridgeReturnCode)
|
switch (abResp.AudioBridgeReturnCode)
|
||||||
@@ -132,22 +136,21 @@ namespace osWebRtcVoice
|
|||||||
|
|
||||||
public async Task<bool> DestroyRoom(JanusRoom janusRoom)
|
public async Task<bool> DestroyRoom(JanusRoom janusRoom)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
JanusMessageResp resp = await SendPluginMsg(new AudioBridgeDestroyRoomReq(janusRoom.RoomId));
|
JanusMessageResp resp = await SendPluginMsg(new AudioBridgeDestroyRoomReq(janusRoom.RoomId)).ConfigureAwait(false);
|
||||||
ret = true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("{0} DestroyRoom. Exception {1}", LogHeader, e);
|
m_log.Error($"{LogHeader} DestroyRoom. Exception ", e);
|
||||||
}
|
}
|
||||||
return ret;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constant used to denote that this is a spatial audio room for the region (as opposed to parcels)
|
// Constant used to denote that this is a spatial audio room for the region (as opposed to parcels)
|
||||||
public const int REGION_ROOM_ID = -999;
|
public const int REGION_ROOM_ID = -999;
|
||||||
private Dictionary<int, JanusRoom> _rooms = new Dictionary<int, JanusRoom>();
|
private Dictionary<int, JanusRoom> _rooms = [];
|
||||||
|
|
||||||
// Calculate a room number for the given parameters. The room number is a hash of the parameters.
|
// Calculate a room number for the given parameters. The room number is a hash of the parameters.
|
||||||
// The attempt is to deterministicly create a room number so all regions will generate the
|
// The attempt is to deterministicly create a room number so all regions will generate the
|
||||||
|
|||||||
@@ -529,7 +529,7 @@ namespace osWebRtcVoice
|
|||||||
{ "record", false }
|
{ "record", false }
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
if (!String.IsNullOrEmpty(pDesc))
|
if (!string.IsNullOrEmpty(pDesc))
|
||||||
AddStringToBody("description", pDesc);
|
AddStringToBody("description", pDesc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -558,6 +558,18 @@ namespace osWebRtcVoice
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class AudioBridgeAgentJoinRoomReq : PluginMsgReq
|
||||||
|
{
|
||||||
|
public AudioBridgeAgentJoinRoomReq(int pRoomId, UUID Agent) : base(new OSDMap() {
|
||||||
|
{ "request", "join" },
|
||||||
|
{ "room", pRoomId },
|
||||||
|
{ "id", new OSDNLong(Math.Abs((long)(Agent.ulonga ^ Agent.ulongb)))},
|
||||||
|
{ "display", Agent.ToString() }
|
||||||
|
})
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// A successful response contains the participant ID and the SDP
|
// A successful response contains the participant ID and the SDP
|
||||||
public class AudioBridgeJoinRoomResp : AudioBridgeResp
|
public class AudioBridgeJoinRoomResp : AudioBridgeResp
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ namespace osWebRtcVoice
|
|||||||
// and, if removed, the viewer complains that the "m=" sections are
|
// and, if removed, the viewer complains that the "m=" sections are
|
||||||
// out of order. Not "cleaning" (removing the data section) seems to work.
|
// out of order. Not "cleaning" (removing the data section) seems to work.
|
||||||
// string cleanSdp = CleanupSdp(pSdp);
|
// string cleanSdp = CleanupSdp(pSdp);
|
||||||
AudioBridgeJoinRoomReq joinReq = new(RoomId, pVSession.AgentId.ToString());
|
AudioBridgeAgentJoinRoomReq joinReq = new(RoomId, pVSession.AgentId);
|
||||||
// joinReq.SetJsep("offer", cleanSdp);
|
// joinReq.SetJsep("offer", cleanSdp);
|
||||||
joinReq.SetJsep("offer", pVSession.Offer);
|
joinReq.SetJsep("offer", pVSession.Offer);
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ namespace osWebRtcVoice
|
|||||||
bool recovered = await RecoverAlreadyInRoomAndLeave(pVSession.AgentId.ToString());
|
bool recovered = await RecoverAlreadyInRoomAndLeave(pVSession.AgentId.ToString());
|
||||||
if (recovered)
|
if (recovered)
|
||||||
{
|
{
|
||||||
AudioBridgeJoinRoomReq retryJoinReq = new(RoomId, pVSession.AgentId.ToString());
|
AudioBridgeAgentJoinRoomReq retryJoinReq = new(RoomId, pVSession.AgentId);
|
||||||
retryJoinReq.SetJsep("offer", pVSession.Offer);
|
retryJoinReq.SetJsep("offer", pVSession.Offer);
|
||||||
JanusMessageResp retryResp = await _AudioBridge.SendPluginMsg(retryJoinReq);
|
JanusMessageResp retryResp = await _AudioBridge.SendPluginMsg(retryJoinReq);
|
||||||
AudioBridgeJoinRoomResp retryJoinResp = new(retryResp);
|
AudioBridgeJoinRoomResp retryJoinResp = new(retryResp);
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ namespace osWebRtcVoice
|
|||||||
public OMV.UUID AgentId { get; set; }
|
public OMV.UUID AgentId { get; set; }
|
||||||
|
|
||||||
// Janus keeps track of the user by this ID
|
// Janus keeps track of the user by this ID
|
||||||
// public int ParticipantId { get; set; }
|
|
||||||
public long ParticipantId { get; set; }
|
public long ParticipantId { get; set; }
|
||||||
|
|
||||||
// Connections to the Janus server
|
// Connections to the Janus server
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace osWebRtcVoice
|
|||||||
// Delay between a disconnect and next join for same agent.
|
// Delay between a disconnect and next join for same agent.
|
||||||
private int _RejoinCooldownMs = 250;
|
private int _RejoinCooldownMs = 250;
|
||||||
|
|
||||||
private readonly ConcurrentDictionary<UUID, DateTime> _LastDisconnectByAgent = new ConcurrentDictionary<UUID, DateTime>();
|
private readonly ConcurrentDictionary<UUID, DateTime> _LastDisconnectByAgent = new();
|
||||||
private long _VoiceFlowCounter;
|
private long _VoiceFlowCounter;
|
||||||
|
|
||||||
// An extra "viewer session" that is created initially. Used to verify the service
|
// An extra "viewer session" that is created initially. Used to verify the service
|
||||||
@@ -71,12 +71,6 @@ namespace osWebRtcVoice
|
|||||||
|
|
||||||
public WebRtcJanusService(IConfigSource pConfig) : base(pConfig)
|
public WebRtcJanusService(IConfigSource pConfig) : base(pConfig)
|
||||||
{
|
{
|
||||||
// WebRtcDebugControl.ApplyFromConfig(pConfig);
|
|
||||||
|
|
||||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
|
||||||
string version = assembly.GetName().Version?.ToString() ?? "unknown";
|
|
||||||
|
|
||||||
_log.Debug($"{LogHeader} WebRtcJanusService version {version}");
|
|
||||||
_Config = pConfig;
|
_Config = pConfig;
|
||||||
IConfig webRtcVoiceConfig = _Config.Configs["WebRtcVoice"];
|
IConfig webRtcVoiceConfig = _Config.Configs["WebRtcVoice"];
|
||||||
|
|
||||||
@@ -156,13 +150,13 @@ namespace osWebRtcVoice
|
|||||||
|
|
||||||
private async Task<bool> ConnectToSessionAndAudioBridge(JanusViewerSession pViewerSession)
|
private async Task<bool> ConnectToSessionAndAudioBridge(JanusViewerSession pViewerSession)
|
||||||
{
|
{
|
||||||
JanusSession janusSession = new JanusSession(_JanusServerURI, _JanusAPIToken, _JanusAdminURI, _JanusAdminToken, _MessageDetails);
|
JanusSession janusSession = new(_JanusServerURI, _JanusAPIToken, _JanusAdminURI, _JanusAdminToken, _MessageDetails);
|
||||||
if (await janusSession.CreateSession().ConfigureAwait(false))
|
if (await janusSession.CreateSession().ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
_log.DebugFormat("{0} JanusSession created", LogHeader);
|
_log.DebugFormat("{0} JanusSession created", LogHeader);
|
||||||
|
|
||||||
// Once the session is created, create a handle to the plugin for rooms
|
// Once the session is created, create a handle to the plugin for rooms
|
||||||
JanusAudioBridge audioBridge = new JanusAudioBridge(janusSession);
|
JanusAudioBridge audioBridge = new(janusSession);
|
||||||
|
|
||||||
if (await audioBridge.Activate(_Config).ConfigureAwait(false))
|
if (await audioBridge.Activate(_Config).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,8 +58,6 @@ namespace osWebRtcVoice
|
|||||||
|
|
||||||
public WebRtcVoiceServerConnector(IConfigSource pConfig, IHttpServer pServer, string pConfigName)
|
public WebRtcVoiceServerConnector(IConfigSource pConfig, IHttpServer pServer, string pConfigName)
|
||||||
{
|
{
|
||||||
// WebRtcDebugControl.ApplyFromConfig(pConfig);
|
|
||||||
|
|
||||||
IConfig moduleConfig = pConfig.Configs["WebRtcVoice"];
|
IConfig moduleConfig = pConfig.Configs["WebRtcVoice"];
|
||||||
|
|
||||||
if (moduleConfig is not null)
|
if (moduleConfig is not null)
|
||||||
|
|||||||
@@ -52,8 +52,6 @@ namespace osWebRtcVoice
|
|||||||
|
|
||||||
public WebRtcVoiceServiceConnector(IConfigSource pConfig)
|
public WebRtcVoiceServiceConnector(IConfigSource pConfig)
|
||||||
{
|
{
|
||||||
// WebRtcDebugControl.ApplyFromConfig(pConfig);
|
|
||||||
|
|
||||||
m_Config = pConfig;
|
m_Config = pConfig;
|
||||||
IConfig moduleConfig = m_Config.Configs["WebRtcVoice"];
|
IConfig moduleConfig = m_Config.Configs["WebRtcVoice"];
|
||||||
|
|
||||||
|
|||||||
@@ -79,8 +79,6 @@ namespace osWebRtcVoice
|
|||||||
// ISharedRegionModule.Initialize
|
// ISharedRegionModule.Initialize
|
||||||
public void Initialise(IConfigSource config)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
// WebRtcDebugControl.ApplyFromConfig(config);
|
|
||||||
|
|
||||||
m_Config = config.Configs["WebRtcVoice"];
|
m_Config = config.Configs["WebRtcVoice"];
|
||||||
if (m_Config is not null)
|
if (m_Config is not null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -74,8 +74,6 @@ namespace osWebRtcVoice
|
|||||||
// Get configuration and load the modules that will handle spatial and non-spatial voice.
|
// Get configuration and load the modules that will handle spatial and non-spatial voice.
|
||||||
public void Initialise(IConfigSource pConfig)
|
public void Initialise(IConfigSource pConfig)
|
||||||
{
|
{
|
||||||
// WebRtcDebugControl.ApplyFromConfig(pConfig);
|
|
||||||
|
|
||||||
m_Config = pConfig;
|
m_Config = pConfig;
|
||||||
IConfig moduleConfig = m_Config.Configs["WebRtcVoice"];
|
IConfig moduleConfig = m_Config.Configs["WebRtcVoice"];
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user