|
DreamineVMS 1.0.0.0
Windows PC의 RTSP·USB 카메라 영상을 HLS로 변환해 원격 CCTV Viewer에 전달하는 데스크톱 에이전트입니다.
|


Public 멤버 함수 | |
| FfmpegHlsStreamService (ILogger< FfmpegHlsStreamService > logger, IVmsCameraRepository repository, ICameraRuntimeStateService runtimeState, IOptions< FfmpegOptions > options) | |
| override async Task | StopAsync (CancellationToken cancellationToken) |
| override void | Dispose () |
| async Task | StartAllAsync (CancellationToken cancellationToken=default) |
| async Task | StopAllAsync (CancellationToken cancellationToken=default) |
| async Task | StartAsync (string cameraId, CancellationToken cancellationToken=default) |
| async Task | StopAsync (string cameraId, CancellationToken cancellationToken=default) |
Protected 멤버 함수 | |
| override async Task | ExecuteAsync (CancellationToken stoppingToken) |
Private 멤버 함수 | |
| async Task | StartInternalAsync (string cameraId, CancellationToken cancellationToken) |
| async Task | StopInternalAsync (string cameraId, CancellationToken cancellationToken) |
| async Task | WatchdogAsync (CancellationToken cancellationToken) |
| void | StartProcessUnsafe (CameraDevice camera) |
| async Task | ShutdownProcessAsync (string cameraId, Process process, CancellationToken cancellationToken) |
| void | ForceKillProcessUnsafe (string cameraId) |
| SemaphoreSlim | GetCameraOperationLock (string cameraId) |
| string | BuildArguments (CameraDevice camera) |
| void | InitWatchStats (string cameraId) |
| string | GetOutputRoot () |
| string | GetCameraOutputDirectory (string cameraId) |
| string | GetPlaylistPath (string cameraId) |
| void | PreparePlaylistForNewSession (string cameraId) |
| void | CleanupOldSegmentFiles (string cameraId, TimeSpan minimumAge) |
정적 Private 멤버 함수 | |
| static long DateTime writeTime | ReadSequenceAndWriteTime (string path) |
| static string | Quote (string value) |
Private 속성 | |
| readonly ILogger< FfmpegHlsStreamService > | _logger |
| readonly IVmsCameraRepository | _repository |
| readonly ICameraRuntimeStateService | _runtimeState |
| readonly FfmpegOptions | _options |
| readonly Dictionary< string, Process > | _processes = new() |
| readonly Dictionary< string, long > | _lastSequences = new() |
| readonly Dictionary< string, DateTime > | _lastWrites = new() |
| readonly ConcurrentDictionary< string, SemaphoreSlim > | _cameraOperationLocks = new() |
| readonly ConcurrentDictionary< string, byte > | _intentionalStops = new() |
| readonly SemaphoreSlim | _sync = new(1, 1) |
| readonly? ChildProcessJob | _processJob |
| bool | _disposed |
정적 Private 속성 | |
| static readonly Regex | MediaSeqRegex = new(@"#EXT-X-MEDIA-SEQUENCE:(\d+)", RegexOptions.Compiled) |
| static readonly TimeSpan | GracefulExitTimeout = TimeSpan.FromMilliseconds(800) |
| static readonly TimeSpan | KillWaitTimeout = TimeSpan.FromSeconds(2) |
| static long | sequence |
FFmpeg 프로세스를 사용해서 RTSP 스트림을 HLS 스트림으로 변환하는 서비스입니다.
FfmpegHlsStreamService.cs 파일의 23 번째 라인에서 정의되었습니다.
|
inline |
FfmpegHlsStreamService 클래스의 새 인스턴스를 초기화합니다.
| logger | 로거입니다. |
| repository | 카메라 저장소입니다. |
| runtimeState | 카메라 런타임 상태 서비스입니다. |
| options | FFmpeg 옵션입니다. |
| ArgumentNullException | 필수 입력 인자 중 하나가 null인 경우 발생합니다. |
FfmpegHlsStreamService.cs 파일의 217 번째 라인에서 정의되었습니다.
다음을 참조함 : _logger, _options, _repository, _runtimeState.
|
inlineprivate |
Arguments 값을 구성합니다.
| camera | camera에 사용할 CameraDevice 값입니다. |
string 결과입니다.FfmpegHlsStreamService.cs 파일의 1135 번째 라인에서 정의되었습니다.
다음을 참조함 : _options, GetCameraOutputDirectory(), GetPlaylistPath(), DreamineVMS.Models.CameraDevice.Id, Quote(), DreamineVMS.Models.CameraDevice.RtspUrl.
다음에 의해서 참조됨 : StartProcessUnsafe().


|
inlineprivate |
Cleanup Old Segment Files 작업을 수행합니다.
| cameraId | camera Id에 사용할 string 값입니다. |
| minimumAge | minimum Age에 사용할 TimeSpan 값입니다. |
FfmpegHlsStreamService.cs 파일의 1458 번째 라인에서 정의되었습니다.
다음을 참조함 : GetCameraOutputDirectory().
다음에 의해서 참조됨 : StartInternalAsync(), StartProcessUnsafe(), StopInternalAsync().


|
inline |
서비스 Dispose 시 남은 ffmpeg 프로세스와 Job Object를 정리합니다.
FfmpegHlsStreamService.cs 파일의 329 번째 라인에서 정의되었습니다.
다음을 참조함 : _cameraOperationLocks, _disposed, _intentionalStops, _processes, _processJob, _sync, ForceKillProcessUnsafe().

|
inlineprotected |
Execute Async 작업을 수행합니다.
| stoppingToken | stopping Token에 사용할 CancellationToken 값입니다. |
Task 결과입니다.FfmpegHlsStreamService.cs 파일의 253 번째 라인에서 정의되었습니다.
다음을 참조함 : _logger, _options, GetOutputRoot(), StartAllAsync(), WatchdogAsync().

|
inlineprivate |
Dispose 등 비동기 호출이 불가능한 시점에 사용하는 동기 강제 종료입니다.
| cameraId | 카메라 ID입니다. |
FfmpegHlsStreamService.cs 파일의 1055 번째 라인에서 정의되었습니다.
다음을 참조함 : _logger, _processes.
다음에 의해서 참조됨 : Dispose().

|
inlineprivate |
Camera Operation Lock 값을 가져옵니다.
| cameraId | camera Id에 사용할 string 값입니다. |
SemaphoreSlim 결과입니다.FfmpegHlsStreamService.cs 파일의 1106 번째 라인에서 정의되었습니다.
다음을 참조함 : _cameraOperationLocks.
다음에 의해서 참조됨 : StartAsync(), StopAsync().

|
inlineprivate |
Camera Output Directory 값을 가져옵니다.
| cameraId | camera Id에 사용할 string 값입니다. |
string 결과입니다.FfmpegHlsStreamService.cs 파일의 1357 번째 라인에서 정의되었습니다.
다음을 참조함 : GetOutputRoot().
다음에 의해서 참조됨 : BuildArguments(), CleanupOldSegmentFiles(), GetPlaylistPath(), PreparePlaylistForNewSession(), StartProcessUnsafe().


|
inlineprivate |
Output Root 값을 가져옵니다.
string 결과입니다.FfmpegHlsStreamService.cs 파일의 1326 번째 라인에서 정의되었습니다.
다음을 참조함 : _options.
다음에 의해서 참조됨 : ExecuteAsync(), GetCameraOutputDirectory().

|
inlineprivate |
Playlist Path 값을 가져옵니다.
| cameraId | camera Id에 사용할 string 값입니다. |
string 결과입니다.FfmpegHlsStreamService.cs 파일의 1386 번째 라인에서 정의되었습니다.
다음을 참조함 : GetCameraOutputDirectory().
다음에 의해서 참조됨 : BuildArguments(), InitWatchStats(), PreparePlaylistForNewSession(), WatchdogAsync().


|
inlineprivate |
Init Watch Stats 작업을 수행합니다.
| cameraId | camera Id에 사용할 string 값입니다. |
FfmpegHlsStreamService.cs 파일의 1254 번째 라인에서 정의되었습니다.
다음을 참조함 : _lastSequences, _lastWrites, GetPlaylistPath(), ReadSequenceAndWriteTime(), sequence.
다음에 의해서 참조됨 : StartProcessUnsafe().


|
inlineprivate |
Prepare Playlist For New Session 작업을 수행합니다.
| cameraId | camera Id에 사용할 string 값입니다. |
FfmpegHlsStreamService.cs 파일의 1407 번째 라인에서 정의되었습니다.
다음을 참조함 : _logger, GetCameraOutputDirectory(), GetPlaylistPath().
다음에 의해서 참조됨 : StartProcessUnsafe().


|
inlinestaticprivate |
Quote 작업을 수행합니다.
| value | 적용할 값입니다. |
string 결과입니다.FfmpegHlsStreamService.cs 파일의 1514 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : BuildArguments().

|
inlinestaticprivate |
FfmpegHlsStreamService.cs 파일의 1294 번째 라인에서 정의되었습니다.
다음을 참조함 : MediaSeqRegex, sequence.
다음에 의해서 참조됨 : InitWatchStats(), WatchdogAsync().

|
inlineprivate |
ffmpeg 프로세스를 graceful → kill 순서로 비동기 종료합니다.
| cameraId | 카메라 ID입니다. |
| process | 종료할 프로세스입니다. |
| cancellationToken | 취소 토큰입니다. |
FfmpegHlsStreamService.cs 파일의 970 번째 라인에서 정의되었습니다.
다음을 참조함 : _logger, GracefulExitTimeout, KillWaitTimeout.
다음에 의해서 참조됨 : StartInternalAsync(), StopInternalAsync(), WatchdogAsync().

|
inline |
Start All Async 작업을 수행합니다.
| cancellationToken | 취소 요청을 감시하는 토큰입니다. |
Task 결과입니다.DreamineVMS.Services.Streaming.ICameraStreamService를 구현.
FfmpegHlsStreamService.cs 파일의 398 번째 라인에서 정의되었습니다.
다음을 참조함 : _repository, DreamineVMS.Models.CameraDevice.Enabled, DreamineVMS.Models.CameraDevice.Id, DreamineVMS.Models.CameraDevice.IsDirectHls, StartAsync().
다음에 의해서 참조됨 : ExecuteAsync().


|
inline |
Start Async 작업을 수행합니다.
| cameraId | camera Id에 사용할 string 값입니다. |
| cancellationToken | 취소 요청을 감시하는 토큰입니다. |
Task 결과입니다.DreamineVMS.Services.Streaming.ICameraStreamService를 구현.
FfmpegHlsStreamService.cs 파일의 476 번째 라인에서 정의되었습니다.
다음을 참조함 : GetCameraOperationLock(), StartInternalAsync().
다음에 의해서 참조됨 : StartAllAsync().


|
inlineprivate |
Start Internal Async 작업을 수행합니다.
| cameraId | camera Id에 사용할 string 값입니다. |
| cancellationToken | 취소 요청을 감시하는 토큰입니다. |
Task 결과입니다.| InvalidOperationException | 현재 객체 상태에서 Start Internal Async 작업을 수행할 수 없는 경우 발생합니다. |
FfmpegHlsStreamService.cs 파일의 576 번째 라인에서 정의되었습니다.
다음을 참조함 : _intentionalStops, _lastSequences, _lastWrites, _processes, _repository, _runtimeState, _sync, CleanupOldSegmentFiles(), DreamineVMS.Models.CameraDevice.Id, ShutdownProcessAsync(), StartProcessUnsafe().
다음에 의해서 참조됨 : StartAsync().


|
inlineprivate |
Start Process Unsafe 작업을 수행합니다.
| camera | camera에 사용할 CameraDevice 값입니다. |
FfmpegHlsStreamService.cs 파일의 850 번째 라인에서 정의되었습니다.
다음을 참조함 : _intentionalStops, _logger, _options, _processes, _processJob, _runtimeState, BuildArguments(), CleanupOldSegmentFiles(), GetCameraOutputDirectory(), DreamineVMS.Models.CameraDevice.Id, InitWatchStats(), DreamineVMS.Models.CameraDevice.IsDirectHls, PreparePlaylistForNewSession(), DreamineVMS.Models.CameraDevice.RtspUrl.
다음에 의해서 참조됨 : StartInternalAsync(), WatchdogAsync().


|
inline |
Stop All Async 작업을 수행합니다.
| cancellationToken | 취소 요청을 감시하는 토큰입니다. |
Task 결과입니다.DreamineVMS.Services.Streaming.ICameraStreamService를 구현.
FfmpegHlsStreamService.cs 파일의 432 번째 라인에서 정의되었습니다.
다음을 참조함 : _repository, DreamineVMS.Models.CameraDevice.Id, StopAsync().
다음에 의해서 참조됨 : StopAsync().


|
inline |
Stop Async 작업을 수행합니다.
| cancellationToken | 취소 요청을 감시하는 토큰입니다. |
Task 결과입니다.FfmpegHlsStreamService.cs 파일의 314 번째 라인에서 정의되었습니다.
다음을 참조함 : _processJob, StopAllAsync().
다음에 의해서 참조됨 : StopAllAsync().


|
inline |
Stop Async 작업을 수행합니다.
| cameraId | camera Id에 사용할 string 값입니다. |
| cancellationToken | 취소 요청을 감시하는 토큰입니다. |
Task 결과입니다.DreamineVMS.Services.Streaming.ICameraStreamService를 구현.
FfmpegHlsStreamService.cs 파일의 522 번째 라인에서 정의되었습니다.
다음을 참조함 : GetCameraOperationLock(), StopInternalAsync().

|
inlineprivate |
Stop Internal Async 작업을 수행합니다.
| cameraId | camera Id에 사용할 string 값입니다. |
| cancellationToken | 취소 요청을 감시하는 토큰입니다. |
Task 결과입니다.FfmpegHlsStreamService.cs 파일의 664 번째 라인에서 정의되었습니다.
다음을 참조함 : _intentionalStops, _lastSequences, _lastWrites, _processes, _runtimeState, _sync, CleanupOldSegmentFiles(), ShutdownProcessAsync().
다음에 의해서 참조됨 : StopAsync().


|
inlineprivate |
Watchdog Async 작업을 수행합니다.
| cancellationToken | 취소 요청을 감시하는 토큰입니다. |
Task 결과입니다.FfmpegHlsStreamService.cs 파일의 728 번째 라인에서 정의되었습니다.
다음을 참조함 : _intentionalStops, _lastSequences, _lastWrites, _options, _processes, _repository, _runtimeState, _sync, DreamineVMS.Models.CameraDevice.AutoReconnect, DreamineVMS.Models.CameraDevice.Enabled, GetPlaylistPath(), DreamineVMS.Models.CameraDevice.Id, DreamineVMS.Models.CameraDevice.IsDirectHls, ReadSequenceAndWriteTime(), sequence, ShutdownProcessAsync(), StartProcessUnsafe().
다음에 의해서 참조됨 : ExecuteAsync().


|
private |
camera Operation Locks 값을 보관합니다.
FfmpegHlsStreamService.cs 파일의 126 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : Dispose(), GetCameraOperationLock().
|
private |
|
private |
의도된 정지(StopAsync / Restart)로 인해 곧 종료될 프로세스의 카메라 ID 집합입니다. process.Exited 이벤트 핸들러는 이 집합에 포함된 카메라에 대해서는 Faulted 상태를 덮어쓰지 않습니다.
FfmpegHlsStreamService.cs 파일의 136 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : Dispose(), StartInternalAsync(), StartProcessUnsafe(), StopInternalAsync(), WatchdogAsync().
|
private |
last Sequences 값을 보관합니다.
FfmpegHlsStreamService.cs 파일의 108 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : InitWatchStats(), StartInternalAsync(), StopInternalAsync(), WatchdogAsync().
|
private |
last Writes 값을 보관합니다.
FfmpegHlsStreamService.cs 파일의 117 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : InitWatchStats(), StartInternalAsync(), StopInternalAsync(), WatchdogAsync().
|
private |
logger 값을 보관합니다.
FfmpegHlsStreamService.cs 파일의 63 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : ExecuteAsync(), FfmpegHlsStreamService(), ForceKillProcessUnsafe(), PreparePlaylistForNewSession(), ShutdownProcessAsync(), StartProcessUnsafe().
|
private |
options 값을 보관합니다.
FfmpegHlsStreamService.cs 파일의 90 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : BuildArguments(), ExecuteAsync(), FfmpegHlsStreamService(), GetOutputRoot(), StartProcessUnsafe(), WatchdogAsync().
|
private |
processes 값을 보관합니다.
FfmpegHlsStreamService.cs 파일의 99 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : Dispose(), ForceKillProcessUnsafe(), StartInternalAsync(), StartProcessUnsafe(), StopInternalAsync(), WatchdogAsync().
|
private |
자식 ffmpeg 프로세스를 부모와 묶는 Windows Job Object입니다.
FfmpegHlsStreamService.cs 파일의 156 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : Dispose(), StartProcessUnsafe(), StopAsync().
|
private |
repository 값을 보관합니다.
FfmpegHlsStreamService.cs 파일의 72 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : FfmpegHlsStreamService(), StartAllAsync(), StartInternalAsync(), StopAllAsync(), WatchdogAsync().
|
private |
runtime State 값을 보관합니다.
FfmpegHlsStreamService.cs 파일의 81 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : FfmpegHlsStreamService(), StartInternalAsync(), StartProcessUnsafe(), StopInternalAsync(), WatchdogAsync().
|
private |
sync 값을 보관합니다.
FfmpegHlsStreamService.cs 파일의 146 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : Dispose(), StartInternalAsync(), StopInternalAsync(), WatchdogAsync().
|
staticprivate |
ffmpeg에 'q'를 보내고 graceful exit를 기다리는 최대 시간입니다.
FfmpegHlsStreamService.cs 파일의 43 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : ShutdownProcessAsync().
|
staticprivate |
Kill 이후 프로세스 종료를 기다리는 최대 시간입니다.
FfmpegHlsStreamService.cs 파일의 53 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : ShutdownProcessAsync().
|
staticprivate |
Media Seq Regex 값을 보관합니다.
FfmpegHlsStreamService.cs 파일의 33 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : ReadSequenceAndWriteTime().
|
staticprivate |
Sequence And Write Time 데이터를 읽습니다.
| path | path에 사용할 string 값입니다. |
(long sequence, DateTime writeTime) 결과입니다.FfmpegHlsStreamService.cs 파일의 1294 번째 라인에서 정의되었습니다.
다음에 의해서 참조됨 : InitWatchStats(), ReadSequenceAndWriteTime(), WatchdogAsync().