Use stream_id to identify stream

This commit is contained in:
2023-07-31 14:08:54 +01:00
parent 99efab6013
commit 8e18029101
12 changed files with 359 additions and 20 deletions

View File

@ -38,6 +38,7 @@ public class SrsController : Controller
App = appSplit[0],
Variant = appSplit.Length > 1 ? appSplit[1] : "",
ClientId = req.ClientId!,
StreamId = req.StreamId!,
StreamKey = req.Stream
});
@ -61,12 +62,6 @@ public class SrsController : Controller
};
}
if (req.App.EndsWith("720h") && req.Action == "on_hls" && !string.IsNullOrEmpty(req.File))
{
await streamManager.OnDvr(new Uri(_config.SrsHttpHost, $"{req.App}/{Path.GetFileName(req.File)}"));
return new();
}
if (req.App.EndsWith("/source"))
{
if (req.Action == "on_publish")
@ -84,6 +79,8 @@ public class SrsController : Controller
if (req.Action == "on_hls" && req.Duration.HasValue && !string.IsNullOrEmpty(req.ClientId))
{
await streamManager.ConsumeQuota(req.Duration.Value);
await streamManager.OnDvr(new Uri(_config.SrsHttpHost, $"{req.App}/{Path.GetFileName(req.File)}"));
return new();
}
/*if (req.Action == "on_dvr" && !string.IsNullOrEmpty(req.File))
@ -134,6 +131,9 @@ public class SrsHook
[JsonProperty("client_id")]
public string? ClientId { get; set; }
[JsonProperty("stream_id")]
public string? StreamId { get; set; }
[JsonProperty("ip")]
public string? Ip { get; set; }