mirror of
https://github.com/opensim/opensim.git
synced 2026-05-13 01:46:07 +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)
|
||||
{
|
||||
AudioBridgeResp ret = null;
|
||||
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)
|
||||
{
|
||||
m_log.ErrorFormat("{0} SendPluginMsg. Exception {1}", LogHeader, e);
|
||||
m_log.Error($"{LogHeader} SendPluginMsg. Exception", e);
|
||||
}
|
||||
return ret;
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -86,7 +90,7 @@ namespace osWebRtcVoice
|
||||
try
|
||||
{
|
||||
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}'");
|
||||
switch (abResp.AudioBridgeReturnCode)
|
||||
@@ -132,22 +136,21 @@ namespace osWebRtcVoice
|
||||
|
||||
public async Task<bool> DestroyRoom(JanusRoom janusRoom)
|
||||
{
|
||||
bool ret = false;
|
||||
try
|
||||
{
|
||||
JanusMessageResp resp = await SendPluginMsg(new AudioBridgeDestroyRoomReq(janusRoom.RoomId));
|
||||
ret = true;
|
||||
JanusMessageResp resp = await SendPluginMsg(new AudioBridgeDestroyRoomReq(janusRoom.RoomId)).ConfigureAwait(false);
|
||||
return true;
|
||||
}
|
||||
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)
|
||||
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.
|
||||
// The attempt is to deterministicly create a room number so all regions will generate the
|
||||
|
||||
@@ -529,7 +529,7 @@ namespace osWebRtcVoice
|
||||
{ "record", false }
|
||||
})
|
||||
{
|
||||
if (!String.IsNullOrEmpty(pDesc))
|
||||
if (!string.IsNullOrEmpty(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
|
||||
public class AudioBridgeJoinRoomResp : AudioBridgeResp
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace osWebRtcVoice
|
||||
// and, if removed, the viewer complains that the "m=" sections are
|
||||
// out of order. Not "cleaning" (removing the data section) seems to work.
|
||||
// string cleanSdp = CleanupSdp(pSdp);
|
||||
AudioBridgeJoinRoomReq joinReq = new(RoomId, pVSession.AgentId.ToString());
|
||||
AudioBridgeAgentJoinRoomReq joinReq = new(RoomId, pVSession.AgentId);
|
||||
// joinReq.SetJsep("offer", cleanSdp);
|
||||
joinReq.SetJsep("offer", pVSession.Offer);
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace osWebRtcVoice
|
||||
bool recovered = await RecoverAlreadyInRoomAndLeave(pVSession.AgentId.ToString());
|
||||
if (recovered)
|
||||
{
|
||||
AudioBridgeJoinRoomReq retryJoinReq = new(RoomId, pVSession.AgentId.ToString());
|
||||
AudioBridgeAgentJoinRoomReq retryJoinReq = new(RoomId, pVSession.AgentId);
|
||||
retryJoinReq.SetJsep("offer", pVSession.Offer);
|
||||
JanusMessageResp retryResp = await _AudioBridge.SendPluginMsg(retryJoinReq);
|
||||
AudioBridgeJoinRoomResp retryJoinResp = new(retryResp);
|
||||
|
||||
@@ -54,7 +54,6 @@ namespace osWebRtcVoice
|
||||
public OMV.UUID AgentId { get; set; }
|
||||
|
||||
// Janus keeps track of the user by this ID
|
||||
// public int ParticipantId { get; set; }
|
||||
public long ParticipantId { get; set; }
|
||||
|
||||
// Connections to the Janus server
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace osWebRtcVoice
|
||||
// Delay between a disconnect and next join for same agent.
|
||||
private int _RejoinCooldownMs = 250;
|
||||
|
||||
private readonly ConcurrentDictionary<UUID, DateTime> _LastDisconnectByAgent = new ConcurrentDictionary<UUID, DateTime>();
|
||||
private readonly ConcurrentDictionary<UUID, DateTime> _LastDisconnectByAgent = new();
|
||||
private long _VoiceFlowCounter;
|
||||
|
||||
// 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)
|
||||
{
|
||||
// WebRtcDebugControl.ApplyFromConfig(pConfig);
|
||||
|
||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
string version = assembly.GetName().Version?.ToString() ?? "unknown";
|
||||
|
||||
_log.Debug($"{LogHeader} WebRtcJanusService version {version}");
|
||||
_Config = pConfig;
|
||||
IConfig webRtcVoiceConfig = _Config.Configs["WebRtcVoice"];
|
||||
|
||||
@@ -156,13 +150,13 @@ namespace osWebRtcVoice
|
||||
|
||||
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))
|
||||
{
|
||||
_log.DebugFormat("{0} JanusSession created", LogHeader);
|
||||
|
||||
// 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))
|
||||
{
|
||||
|
||||
@@ -58,8 +58,6 @@ namespace osWebRtcVoice
|
||||
|
||||
public WebRtcVoiceServerConnector(IConfigSource pConfig, IHttpServer pServer, string pConfigName)
|
||||
{
|
||||
// WebRtcDebugControl.ApplyFromConfig(pConfig);
|
||||
|
||||
IConfig moduleConfig = pConfig.Configs["WebRtcVoice"];
|
||||
|
||||
if (moduleConfig is not null)
|
||||
|
||||
@@ -52,8 +52,6 @@ namespace osWebRtcVoice
|
||||
|
||||
public WebRtcVoiceServiceConnector(IConfigSource pConfig)
|
||||
{
|
||||
// WebRtcDebugControl.ApplyFromConfig(pConfig);
|
||||
|
||||
m_Config = pConfig;
|
||||
IConfig moduleConfig = m_Config.Configs["WebRtcVoice"];
|
||||
|
||||
|
||||
@@ -79,8 +79,6 @@ namespace osWebRtcVoice
|
||||
// ISharedRegionModule.Initialize
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
// WebRtcDebugControl.ApplyFromConfig(config);
|
||||
|
||||
m_Config = config.Configs["WebRtcVoice"];
|
||||
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.
|
||||
public void Initialise(IConfigSource pConfig)
|
||||
{
|
||||
// WebRtcDebugControl.ApplyFromConfig(pConfig);
|
||||
|
||||
m_Config = pConfig;
|
||||
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