-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
针对手动推流后又被自动断下来的问题进行处理,数据库中Camera.Activated=false时CameraAutoKeeper将不再对…
…此类设备进行自动推拉流自动结束推拉流进行控制
- Loading branch information
Showing
3 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using System; | ||
using System.Threading; | ||
using CommonFunctions; | ||
using CommonFunctions.ManageStructs; | ||
|
||
namespace StreamNodeWebApi.AutoTasker | ||
{ | ||
/// <summary> | ||
/// 未完成 | ||
/// </summary> | ||
public class MediaKeeperCheckKeepAlive | ||
{ | ||
private void KeepAlive() | ||
{ | ||
while (true) | ||
{ | ||
lock (Common.MediaServerList) | ||
{ | ||
for (int i = Common.MediaServerList.Count - 1; i <= 0; i--) | ||
{ | ||
var ret = Common.MediaServerList[i].GetIsRunning(out ResponseStruct rs); | ||
if (ret == true && rs.Code == ErrorNumber.None) | ||
{ | ||
Common.MediaServerList[i].KeepAlive = DateTime.Now; | ||
Common.MediaServerList[i].UpdateTime = DateTime.Now; | ||
} | ||
|
||
if ((DateTime.Now - Common.MediaServerList[i].KeepAlive).TotalMinutes > 20) | ||
{ | ||
|
||
Common.MediaServerList[i] = null; | ||
} | ||
} | ||
Common.RemoveNull(Common.MediaServerList); | ||
} | ||
|
||
|
||
Thread.Sleep(10000); | ||
} | ||
} | ||
public MediaKeeperCheckKeepAlive() | ||
{ | ||
new Thread(new ThreadStart(delegate | ||
{ | ||
try | ||
{ | ||
KeepAlive(); | ||
} | ||
catch (Exception ex) | ||
{ | ||
// | ||
} | ||
})).Start(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters