feat: initialize .NET 10 Clean Architecture solution
Create Heimdall solution with 17 projects following Clean Architecture for a maintainable and loosely coupled codebase. src/ (9 projects): - Domain, Domain.Primitives, Contracts (core layer, no deps) - Application (ref. Domain) — CQRS/MediatR ready - Infrastructure (ref. Application + Domain) — EF Core PostgreSQL ready - Api, Web (Blazor), Agent, Workers (hosts, ref. Application + Infrastructure) tests/ (8 projects): - xUnit + Shouldly + NSubstitute + bUnit (Web.Tests) - One test project per source project (Domain -> IntegrationTests) Config: Directory.Build.props (Nullable, ImplicitUsings, TreatWarningsAsErrors)
This commit is contained in:
1 parent
698520cce9
commit
bfb3e06bc1
103 files changed
+61393
-44
No files matched your search
+174
-16
@@ -187,6 +187,7 @@ Mais orientée :
|
||||
* Worker Service
|
||||
* Communication API
|
||||
* Camera management
|
||||
* **WebRTC streaming** (SIPSorcery + SIPSorceryMedia.FFmpeg)
|
||||
|
||||
---
|
||||
|
||||
@@ -568,6 +569,162 @@ Implémentation :
|
||||
|
||||
---
|
||||
|
||||
# Phase 8b - WebRTC Streaming
|
||||
|
||||
Ajoutée après Phase 8 (Video Pipeline) — dépend de FFmpeg et de l'Agent.
|
||||
|
||||
## Objectif
|
||||
|
||||
Permettre la visualisation en direct des caméras depuis le navigateur via WebRTC P2P.
|
||||
|
||||
## Architecture
|
||||
|
||||
```text
|
||||
Agent (SIPSorcery) ◄═════ WebRTC P2P (SRTP/H264) ═════► Navigateur (Blazor)
|
||||
│ │
|
||||
│ SignalR (SDP + ICE candidates) │
|
||||
└────────────────── Heimdall API ────────────────────────┘
|
||||
```
|
||||
|
||||
## Dépendances NuGet (Agent)
|
||||
|
||||
```
|
||||
dotnet add package SIPSorcery
|
||||
dotnet add package SIPSorceryMedia.FFmpeg
|
||||
```
|
||||
|
||||
Dépendances côté Central :
|
||||
|
||||
* SignalR (déjà dans ASP.NET Core)
|
||||
|
||||
## Étapes d'implémentation
|
||||
|
||||
### 8b.1 — SignalR Hub de signaling
|
||||
|
||||
Créer dans `Heimdall.Api` :
|
||||
|
||||
```csharp
|
||||
public class StreamingHub : Hub
|
||||
{
|
||||
// Agent → Central : enregistrement des flux disponibles
|
||||
// Browser → Central : demande de flux
|
||||
// Central relay SDP / ICE entre Agent et Browser
|
||||
}
|
||||
```
|
||||
|
||||
Tests :
|
||||
|
||||
```
|
||||
Agent can register camera stream
|
||||
Browser requests stream
|
||||
SDP offer is relayed to browser
|
||||
ICE candidates are exchanged
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 8b.2 — WebRTC Peer dans l'Agent (SIPSorcery)
|
||||
|
||||
Créer dans `Heimdall.Agent` :
|
||||
|
||||
```csharp
|
||||
IWebRtcStreamingService
|
||||
|
||||
RunAsync() // Démarre le pipeline
|
||||
AddCameraTrack() // Ajoute un flux H264 depuis FFmpeg
|
||||
CreateOffer() // Génère l'offre SDP
|
||||
SetAnswer() // Reçoit l'answer du navigateur
|
||||
AddIceCandidate() // Ajoute un ICE candidate
|
||||
```
|
||||
|
||||
Utilise SIPSorcery :
|
||||
|
||||
```csharp
|
||||
var pc = new RTCPeerConnection(null);
|
||||
|
||||
var ffmpegSource = new FFmpegVideoSource(rtspUrl);
|
||||
ffmpegSource.OnVideoSourceEncodedSample += pc.SendVideo;
|
||||
|
||||
var track = new MediaStreamTrack(
|
||||
ffmpegSource.GetVideoSourceFormats(),
|
||||
MediaStreamStatusEnum.SendOnly);
|
||||
pc.addTrack(track);
|
||||
|
||||
pc.onconnectionstatechange += async (state) => { ... };
|
||||
```
|
||||
|
||||
Tests :
|
||||
|
||||
```
|
||||
RTSP stream produces H264 frames
|
||||
WebRTC offer contains H264 codec
|
||||
ICE candidates are generated
|
||||
Connection state transitions correctly
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 8b.3 — Client Blazor WebRTC
|
||||
|
||||
Dans `Heimdall.Web` :
|
||||
|
||||
```typescript
|
||||
// wwwroot/js/liveStream.js
|
||||
const pc = new RTCPeerConnection({
|
||||
iceServers: [{ urls: 'stun:stun.l.google.com:19302' }]
|
||||
});
|
||||
|
||||
pc.ontrack = (evt) => {
|
||||
video.srcObject = evt.streams[0];
|
||||
};
|
||||
|
||||
// Connexion SignalR au hub /hubs/streaming
|
||||
// Échange SDP + ICE
|
||||
// Lecture du flux dans <video controls>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 8b.4 — TURN relay (optionnel)
|
||||
|
||||
Ajouter `coturn` dans docker-compose si nécessaire :
|
||||
|
||||
```yaml
|
||||
coturn:
|
||||
image: coturn/coturn:latest
|
||||
command: -n --min-port=49160 --max-port=49200
|
||||
ports:
|
||||
- "3478:3478/udp"
|
||||
- "3478:3478/tcp"
|
||||
- "49160-49200:49160-49200/udp"
|
||||
```
|
||||
|
||||
Configuré dans les ICE servers du client :
|
||||
|
||||
```json
|
||||
{ "iceServers": [
|
||||
{ "urls": "stun:heimdall.local:3478" },
|
||||
{ "urls": "turn:heimdall.local:3478",
|
||||
"username": "...", "credential": "..." }
|
||||
] }
|
||||
```
|
||||
|
||||
## Tests de bout en bout
|
||||
|
||||
```
|
||||
Browser requests camera stream
|
||||
→ Agent reçoit signaling → établit WebRTC
|
||||
→ Video feed visible in browser < 3s
|
||||
→ ICE candidate exchange works through NAT
|
||||
→ Stream stops cleanly on disconnect
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Phase 9 - IA Pipeline
|
||||
|
||||
---
|
||||
|
||||
# Phase 9 - IA Pipeline
|
||||
|
||||
## Abstraction
|
||||
@@ -808,21 +965,22 @@ Une fonctionnalité est terminée uniquement si :
|
||||
# Ordre global résumé
|
||||
|
||||
```
|
||||
1. Solution .NET 10
|
||||
2. Clean Architecture
|
||||
3. Tests Framework
|
||||
4. CI DockerHub
|
||||
5. Domain Model
|
||||
6. Application Layer
|
||||
7. API Core
|
||||
8. Agent Core
|
||||
9. ONVIF
|
||||
1. Solution .NET 10
|
||||
2. Clean Architecture
|
||||
3. Tests Framework
|
||||
4. CI DockerHub
|
||||
5. Domain Model
|
||||
6. Application Layer
|
||||
7. API Core
|
||||
8. Agent Core
|
||||
9. ONVIF
|
||||
10. FFmpeg
|
||||
11. CodeProject.AI
|
||||
12. Storage
|
||||
13. Hangfire
|
||||
14. Security
|
||||
15. Blazor UI
|
||||
16. Dashboard
|
||||
17. Production Hardening
|
||||
11. WebRTC Streaming (SIPSorcery + SignalR)
|
||||
12. CodeProject.AI
|
||||
13. Storage
|
||||
14. Hangfire
|
||||
15. Security
|
||||
16. Blazor UI
|
||||
17. Dashboard
|
||||
18. Production Hardening
|
||||
```
|
||||
Reference in new issue
Block a user