Kick from edge forward

This commit is contained in:
2023-08-01 11:25:31 +01:00
parent 9a8aca72ab
commit 0634622c4d
20 changed files with 523 additions and 74 deletions

View File

@ -33,19 +33,19 @@ public class SrsController : Controller
}
var appSplit = req.App.Split("/");
var streamManager = await _streamManagerFactory.ForStream(new StreamInfo
var info = new StreamInfo
{
App = appSplit[0],
Variant = appSplit.Length > 1 ? appSplit[1] : "",
ClientId = req.ClientId!,
StreamId = req.StreamId ?? req.ClientId!,
StreamKey = req.Stream,
EdgeIp = req.Ip!
});
};
if (req.Action == "on_forward")
{
var urls = await streamManager.OnForward();
var newStream = await _streamManagerFactory.CreateStream(info);
var urls = await newStream.OnForward();
if (urls.Count > 0)
{
return new SrsForwardHookReply
@ -63,6 +63,7 @@ public class SrsController : Controller
};
}
var streamManager = await _streamManagerFactory.ForStream(info);
if (req.App.EndsWith("/source"))
{
if (req.Action == "on_publish")
@ -132,7 +133,7 @@ public class SrsHook
[JsonProperty("client_id")]
public string? ClientId { get; set; }
[JsonProperty("stream_id")]
public string? StreamId { get; set; }