Kiến trúc tổng thể
HDCBS được xây dựng theo kiến trúc microservices event-driven trên nền tảng Kubernetes. Mỗi thành phần là một service độc lập, giao tiếp qua Message Bus (Apache Kafka hoặc NATS JetStream tùy môi trường triển khai) cho sự kiện bất đồng bộ và gRPC cho lệnh đồng bộ độ trễ thấp.
Luồng tín hiệu từ trường quay đến người xem
Trường quay
Encoder SRT
SRT dual-path
500ms-2s
Signal_Input
Gateway + Buffer
Alignment
B_target
Virtual_Mixer
Dual Active
≤100ms
switch
Broadcast_Output
Main + Backup
CDN
Người xem
Trường quay
Preview
WebRTC <100ms
SDI/NDI <1 frame
MCR Service
WebRTC Gateway
UTC timestamp
per-frame
MCR Operator
Browser / Monitor
Sơ đồ hệ thống - 1 kênh, luồng tín hiệu và cơ chế chuyển mạch
TRƯỜNG QUAY INGEST / MEDIA SYNC / CONTROL OUTPUT Trường quay Encoder SRT NTP sync ±1-10ms Signal_Input Gateway Ingest Alignment Buffer hold = B_target − D_ingest Sync_Controller Latency Compensation T_execute = T_frame + D_ingest Virtual_Mixer Chuyển mạch ≤100ms Cut / Dissolve / Fade / Wipe SwitchAtUTC(T_execute) Broadcast Output CDN / HLS Player_Engine Video Server – decode file đọc từ local disk Playout_Engine Nhận lệnh MCR, hỏi Sync_Controller ra lệnh Virtual_Mixer switch Graphics_Engine Render GPU – composite Lower third / Ticker / Logo MCR Operator Browser / Monitor WebRTC <100ms SRT ingest UTC/frame LIVE stream aligned UTC preview LIVE FILE GFX UTC/frame SwitchCommand + T_frame FILE stream GFX stream hỏi T_execute trả T_execute Schedule Switch Play(file, pos) Activate(element) LIVE sync FILE sync GFX sync Tally Signal ON-AIR ≤50ms Cơ chế tính T_execute 1. MCR thấy frame F (UTC = T_frame) 2. MCR gửi lệnh → Playout_Engine 3. Playout_Engine hỏi Sync_Controller T_execute = T_frame + D_ingest 4. Playout_Engine → Virtual_Mixer switch → Output chuyển đúng frame F NTP / PTP – Đồng bộ UTC toàn hệ thống Trường quay, MCR, Signal_Input, Sync_Controller, Virtual_Mixer – tất cả dùng chung trục thời gian UTC CHÚ THÍCH: Luồng LIVE (SRT ingest) Luồng video / FILE stream Preview + lệnh MCR ScheduleSwitch / T_execute Tally Signal ON-AIR GFX stream Điều phối nội bộ (dashed)
Event-driven qua Message Bus
Các thành phần publish/subscribe sự kiện qua Message Bus (Apache Kafka hoặc NATS JetStream). Mỗi thành phần consume topic liên quan và phản ứng độc lập - không coupling trực tiếp. Đảm bảo khả năng mở rộng và fault isolation.
gRPC cho lệnh đồng bộ
Các lệnh yêu cầu độ trễ thấp (switch signal, play file, activate graphics) dùng gRPC - binary protocol, multiplexing, streaming. Đảm bảo lệnh được thực thi trong ≤100ms.
Kubernetes native
Mỗi service là một Deployment/StatefulSet độc lập. Horizontal Pod Autoscaler tự động scale theo CPU/memory. Liveness/Readiness probe phát hiện sự cố và restart tự động.
Redis cho state sync
Trạng thái real-time (playhead position, current playlist item, tally state) được sync qua Redis pub/sub. Standby instance subscribe và apply state changes ngay lập tức - failover không mất state.
Các thành phần hệ thống
14 service độc lập, mỗi service có trách nhiệm rõ ràng, giao tiếp qua Message Bus và gRPC. Mô hình dự phòng được thiết kế riêng cho từng loại service.
Thành phần Trách nhiệm Dự phòng Failover SLA
HDCBS Orchestrator Điều phối trung tâm Control Plane - nhận sự kiện từ Message Bus, điều phối các thành phần, health monitoring, auto-scaling Active/Standby ≤3 giây
Scheduler Quản lý Playlist hybrid, lịch phát sóng, versioning, RecurrenceRule Active/Standby ≤3 giây
Sync_Controller Đồng bộ UTC, latency compensation, Tally Signal, Ingest Alignment Buffer, pre-roll Active/Standby ≤1 giây
Playout_Engine Điều phối phát sóng - nhận lịch từ Scheduler, ra lệnh Player_Engine, điều phối Virtual_Mixer Active/Standby ≤3 giây
Signal_Input Gateway Tiếp nhận SRT dual-path, NDI, SDI, WebRTC ingest; Ingest Alignment Buffer; health monitor 100ms Stateless ≤500ms (path switch)
Player_Engine Video Server - decode và stream file theo lệnh Playout_Engine. Built-in (FFmpeg/GPU) hoặc third-party qua driver Dual Active ≤1 giây
Graphics_Engine Render lower third, ticker, logo, full-screen graphics; composite lên video frame trên GPU Dual Active ≤1 giây
Virtual_Mixer Chuyển mạch tín hiệu ≤100ms, transition effects, DVE (PiP/Split/Squeeze/DSK), output bus per channel Dual Active N/A (luôn song song)
MCR Service WebSocket real-time cho MCR UI, WebRTC Gateway preview, REST API điều khiển Stateless ≤3 giây
Channel_Manager Vòng đời kênh, phân bổ Resource_Pool, phân quyền theo Channel Active/Standby ≤3 giây
MAM Upload, metadata, tìm kiếm, vòng đời file, phân quyền, trigger Transcode Stateless ≤3 giây
Transcode Convert file gốc sang proxy 720p/360p H.264 qua Message Bus queue Stateless workers ≤3 giây
FileManager Pre-fetch file từ Media Storage về local disk Player Server theo lịch Playlist (tối thiểu 2 ngày) Per Player Server N/A
As-run Log Service Subscribe Message Bus events từ Playout_Engine, ghi nhật ký phát sóng thực tế vào database riêng (HdcbsAsRunDb), tính drift, báo cáo đối chiếu. Publish asrun.entry.created chỉ để notify realtime MCR UI qua SignalR. Stateless ≤3 giây
Evidence Service Ghi Broadcast_Output phân giải thấp với burn-in timestamp, tạo bookmark khi switch Stateless ≤3 giây
Auth Service Xác thực username/password + MFA, JWT, SSO SAML/OIDC, session revocation Stateless ≤3 giây
Giao thức tín hiệu và truyền thông
HDCBS hỗ trợ đầy đủ các giao thức broadcast hiện đại cho ingest, preview và phân phối tín hiệu.
SRT
Secure Reliable Transport
Giao thức UDP-based với ARQ tùy chỉnh. Chịu được packet loss cao và mạng không ổn định. Giao thức ingest chính từ trường quay qua internet/WAN. Mỗi nguồn có 2 luồng song song (dual-path). Hỗ trợ mang UTC timestamp trong metadata.
Latency: 500ms-2s UDP-based + ARQ Dual-path 1+1 DTLS encryption
NDI
Network Device Interface
Giao thức IP-based cho mạng LAN/WAN nội bộ. Độ trễ rất thấp (<1 frame), chất lượng cao. Phù hợp cho trường quay trong cùng data center hoặc mạng nội bộ. Dùng cho cả ingest và preview.
Latency: <1 frame LAN/WAN nội bộ Broadcast quality
WebRTC
Web Real-Time Communication
Peer-to-peer qua browser, low-latency mode (tắt jitter buffer lớn). Dùng cho remote MCR preview và trường quay từ xa. Mỗi frame mang UTC timestamp để Sync_Controller tính điểm chuyển chính xác. DTLS/SRTP bảo mật.
Latency: <100ms Browser-based UTC timestamp/frame DTLS/SRTP
SDI
Serial Digital Interface
Kết nối vật lý cho trường quay local trong cùng facility/data center. Độ trễ <1 frame, chất lượng broadcast. Dùng cho local MCR preview và ingest từ trường quay gần. Qua SDI capture card hoặc SDI-over-IP gateway.
Latency: <1 frame Local facility Broadcast quality
NTP / PTP
Network / Precision Time Protocol
NTP (Stratum 1/2) cho đồng bộ đồng hồ qua internet (±1-10ms). PTP/IEEE 1588 v2 cho mạng nội bộ (sub-millisecond). PTP grandmaster clock triển khai trong Kubernetes cluster.
NTP: ±1-10ms PTP: <1ms UTC wall-clock
gRPC / Message Bus
Internal Communication
gRPC (Protocol Buffers) cho lệnh đồng bộ yêu cầu độ trễ thấp (switch, play, activate graphics). Message Bus (Apache Kafka hoặc NATS JetStream) cho sự kiện bất đồng bộ (signal.connected, playout.item.started, ...). WebSocket cho MCR real-time updates.
gRPC: binary + streaming Message Bus: event bus WebSocket: MCR UI
Đồng bộ UTC toàn hệ thống
HDCBS sử dụng mô hình single source of truth cho đồng hồ thời gian thực - mọi điểm trong hệ thống đều đồng bộ về cùng một nguồn UTC duy nhất qua mạng IP.
NTP - Internet nodes
Cloud server, encoder trường quay, máy MCR, thiết bị hiện trường đồng bộ với NTP Stratum 1/2 (pool.ntp.org, time.cloudflare.com). Độ chính xác ~1-10ms qua internet - đủ cho latency compensation và timestamp sự kiện.
PTP - Mạng nội bộ
Các node trong cùng data center hoặc LAN nội bộ (cloud cluster, local MCR) dùng PTP/IEEE 1588 v2. Độ chính xác sub-millisecond (<1ms) - phù hợp cho frame-accurate switching. PTP grandmaster clock trong Kubernetes cluster.
UTC timestamp trong SRT
Encoder tại trường quay nhúng UTC wall-clock timestamp (từ NTP/PTP đã đồng bộ) vào metadata mỗi SRT packet. Sync_Controller biết chính xác "frame này được capture lúc mấy giờ UTC" để align LIVE stream với file đang phát.
UTC timestamp trong WebRTC
Mỗi frame WebRTC preview mang UTC timestamp (nhúng vào RTP extension header hoặc data channel song song). MCR client gửi timestamp này kèm lệnh chuyển - Sync_Controller tính T_execute = T_frame + D_ingest chính xác đến từng frame.
Latency Compensation và Ingest Alignment Buffer
Cơ chế bù trừ độ trễ đảm bảo lệnh chuyển từ MCR luôn khớp chính xác với cảnh đang thấy trong preview, bất kể độ trễ mạng.
Công thức Latency Compensation
execution_offset = D_ingest - D_preview - D_cmd

Khi MCR ra lệnh tại T_cmd:
T_execute = T_cmd + execution_offset

Nếu WebRTC preview mang UTC timestamp per-frame:
T_execute = T_frame_utc + D_ingest
Các thành phần độ trễ
D_ingest (SRT): 500ms - 2s
D_preview (WebRTC): <100ms (50-150ms thực tế)
D_preview (SDI/NDI): <1 frame (~40ms)
D_cmd (MCR → cloud): 10-100ms
B_target (Alignment Buffer): max(D_ingest) + 200ms
Ingest Alignment Buffer - Đồng bộ timestamp trước Virtual_Mixer
SIG-001 Studio A
D_ingest = 850ms
Buffer A
hold = 700ms
UTC = T_now - 1550ms
SIG-002 Hà Nội
D_ingest = 1200ms
Buffer B
hold = 350ms
UTC = T_now - 1550ms
SIG-004 TP.HCM
D_ingest = 1350ms
Buffer C
hold = 200ms
UTC = T_now - 1550ms
B_target = max(850, 1200, 1350) + 200 = 1550ms
Tất cả frame release tại UTC = T_now - 1550ms → Virtual_Mixer chuyển mạch frame-accurate
Mô hình dự phòng 1+1 ba tầng
Ba tầng dự phòng độc lập - mỗi tầng bảo vệ một loại sự cố khác nhau. Failover tự động không cần can thiệp thủ công.
Thành phần Mô hình Cơ chế sync state Failover SLA Điều kiện trigger
Signal Input (SRT) Dual-path 1+1 Buffer sẵn backup stream ≤500ms packet loss >10% hoặc bitrate <500kbps hoặc no data >200ms
HDCBS Orchestrator Active/Standby Redis pub/sub + snapshot 1s ≤3 giây Health check fail (interval 30s)
Scheduler Active/Standby Database streaming replication ≤3 giây Health check fail
Sync_Controller Active/Standby Redis real-time (critical path) ≤1 giây Health check fail (interval 200ms)
Playout_Engine Active/Standby Redis real-time (controller state) ≤3 giây Health check fail (interval 1s)
Player_Engine Dual Active Playhead sync mỗi frame/GOP ≤1 giây Primary stream fail - Virtual_Mixer switch sang Backup
Graphics_Engine Dual Active Redis real-time (graphics state) ≤1 giây Primary stream fail - Virtual_Mixer switch sang Backup
Virtual_Mixer Dual Active State sync real-time N/A Luôn output song song ra 2 hạ tầng CDN độc lập
Cấu trúc Playlist hybrid
Playlist có cấu trúc cây phân cấp (hybrid tree) - mỗi node có thể là FILE, LIVE, BACKUP hoặc SEGMENT chứa node con. Cho phép lên khung chương trình cả ngày trước, lập lịch chi tiết từng buổi sau mà không gián đoạn phát sóng.
Các loại node
SEGMENT - Nhóm chứa node con. isPlaceholder=true: chỉ giữ khung giờ, chưa lập lịch chi tiết.

FILE - Phát file media từ Media Storage (S3 hoặc Local Disk).

LIVE - Phát tín hiệu LIVE từ Signal_Input (SRT/NDI).

BACKUP - Nội dung dự phòng tự động kích hoạt khi nguồn chính gặp sự cố.
Versioning
Mỗi lần chỉnh sửa Playlist tạo một PlaylistVersion mới - snapshot toàn bộ cây tại thời điểm đó. Lưu: người thực hiện, thời điểm, mô tả thay đổi. Hỗ trợ xem lịch sử, so sánh 2 phiên bản, restore về bất kỳ phiên bản nào.
CuePoint
Điểm đánh dấu trong file tại timecodeOffset giây. Actions: SWITCH_TO_LIVE, SWITCH_TO_FILE, ALERT. Kích hoạt tự động khi Playout_Engine đến vị trí đó - Virtual_Mixer thực thi trong ≤100ms.
RecurrenceRule
Lịch phát lặp lại: DAILY, WEEKLY, MONTHLY. Cấu hình interval, endDate, daysOfWeek. Scheduler tự động tạo PlaylistItem cho các ngày trong tương lai.
// Playlist hybrid - VTV1 ngày 18/04/2026 (tại thời điểm demo 19:12:35)
Playlist: "VTV1 - Lịch phát sóng 18/04/2026" [version 3, ACTIVE]
│
├── SEGMENT "Buổi sáng" (05:30-11:30) [isPlaceholder=false]
│   ├── FILE  "Nhạc hiệu mở đầu ngày"              (05:30, 0:02) [COMPLETED]
│   ├── LIVE  "Chào buổi sáng - Studio A"          (05:32, 1:28) [COMPLETED]
│   ├── FILE  "Phim hoạt hình thiếu nhi"           (07:00, 1:00) [COMPLETED]
│   ├── LIVE  "Thời sự sáng - Studio B"            (08:00, 0:30) [COMPLETED]
│   └── FILE  "Phim truyện sáng: Hương vị tình thân" (08:30, 3:00) [COMPLETED]
│
├── SEGMENT "Buổi trưa" (11:30-13:30) [isPlaceholder=false]
│   ├── FILE  "Thời sự 11h30"                      (11:30, 0:30) [COMPLETED]
│   ├── FILE  "Phim truyện trưa: Về nhà đi con"    (12:00, 1:00) [COMPLETED]
│   └── FILE  "Thời sự 13h"                        (13:00, 0:30) [COMPLETED]
│
├── SEGMENT "Buổi chiều" (13:30-18:00) [isPlaceholder=false]
│   ├── FILE  "Phim tài liệu: Biển đảo Việt Nam"   (13:30, 1:30) [COMPLETED]
│   ├── FILE  "Chương trình thiếu nhi"             (15:00, 1:00) [COMPLETED]
│   ├── FILE  "Phim truyện chiều: Sống chung với mẹ chồng" (16:00, 1:30) [COMPLETED]
│   └── LIVE  "Thời sự 17h30 - Studio A"           (17:30, 0:30) [COMPLETED]
│
├── SEGMENT "Buổi tối" (18:00-23:00) [isPlaceholder=false]
│   ├── FILE  "Chào buổi tối - Nhạc hiệu"          (18:00, 0:05) [COMPLETED]
│   ├── LIVE  "Thời sự 18h05 - Studio A"           (18:05, 0:55) [COMPLETED]
│   ├── FILE  "Quảng cáo break 19h"                (19:00, 0:05) [COMPLETED]
│   ├── LIVE  "Bản tin thời sự 19h - Studio A"     (19:05, 0:30) [PLAYING] ← ON-AIR
│   │   └── CuePoint +0:20:00 → SWITCH_TO_LIVE SIG-002 (hiện trường Hà Nội)
│   ├── FILE  "Quảng cáo break 19h35"              (19:35, 0:05) [PENDING]
│   ├── FILE  "Đất phương Nam - Tập 12"            (19:40, 0:45) [PENDING]
│   ├── FILE  "Quảng cáo break 20h25"              (20:25, 0:05) [PENDING]
│   ├── LIVE  "Thể thao 20h30 - Studio B"          (20:30, 0:30) [PENDING]
│   ├── FILE  "Đất phương Nam - Tập 13"            (21:00, 0:45) [PENDING]
│   ├── FILE  "Quảng cáo break 21h45"              (21:45, 0:05) [PENDING]
│   └── FILE  "Thời sự 22h - Tóm tắt ngày"         (21:50, 0:30) [PENDING]
│
└── SEGMENT "Đêm khuya" (23:00-05:30) [isPlaceholder=true]
    └── (placeholder - MCR lập lịch chi tiết trước 22:00)
Data model cốt lõi
Các entity chính trong hệ thống - từ Signal_Input, SwitchEvent, AsRunEntry đến User/RBAC và Channel multi-channel. Tất cả timestamp dùng UTC epoch.
SignalInput
id, name, protocol: SRT|NDI|SDI|WEBRTC
status: CONNECTED|DISCONNECTED|DEGRADED
quality: {bitrate, packetLoss, latency, isStable}
paths: SRTStreamPath[primary, backup]
latencyProfile: LatencyProfile - D_ingest, D_preview, executionOffsetMs
SwitchEvent
id, requestedAt, executedAt
requestedBy: userId | 'SCHEDULER' | 'CUE_POINT'
fromSource / toSource: {type, signalInputId, filePosition}
mode: HARD_CUT|DISSOLVE|FADE_TO_BLACK|FADE_TO_WHITE|WIPE
previewFrameUtcMs? - UTC timestamp frame MCR đang thấy
executionLatency - ms từ lệnh đến thực thi
AsRunEntry
id, channelId, playlistItemId?
contentName, contentType: FILE|LIVE
scheduledStartTime?, actualStartTime
actualEndTime?, actualDurationSeconds?
driftMs - actualStartTime - scheduledStartTime
status: PLAYED|SKIPPED|INTERRUPTED
EvidenceSegment
id, channelId
startTime / endTime (UTC)
storageUri - đường dẫn video phân giải thấp
fileSizeBytes, status: RECORDING|COMPLETED|ARCHIVED
bookmarks: EvidenceBookmark[] - điểm đánh dấu switch event
Retention tối thiểu 30 ngày
User / RBAC
role: ADMIN|MCR_OPERATOR|SCHEDULE_EDITOR|STUDIO_TECHNICIAN
mfaConfigs: UserMfaConfig[] - TOTP, EMAIL_OTP, SMS_OTP, BACKUP_CODE
mfaRequired - bắt buộc với ADMIN và MCR_OPERATOR
ssoProvider? - SAML/OIDC integration
passwordHash - bcrypt/Argon2, không lưu plaintext
Channel / ResourcePool
outputBusId - output bus riêng trên Virtual_Mixer dùng chung
subscribedSignalInputIds[] - Signal_Input đang subscribe
playerEngineSessionId? - session trên shared Player_Engine
graphicsEngineSessionId? - session trên shared Graphics_Engine
broadcastOutputEndpoint - endpoint output riêng của kênh
Entity Lưu trữ Retention Ghi chú
Playlist / PlaylistItemDatabase (PostgreSQL / SQL Server)Lịch sử 90 ngàyVersioning đầy đủ, snapshot mỗi lần chỉnh sửa
PlaylistVersionDatabase90 ngàySnapshot toàn bộ cây PlaylistItem
SwitchEventDatabase1 nămKèm AuditLogEntry
AsRunEntryDatabaseTối thiểu 1 nămĐối chiếu Playlist vs thực tế
EvidenceSegmentObject Storage S3 / Local DiskTối thiểu 30 ngàyVideo phân giải thấp + burn-in timestamp
AuditLogEntryDatabase1 nămMọi thao tác MCR, login, thay đổi quyền
MediaAssetDatabase (metadata) + Object Storage (file)Theo vòng đờiSoft delete, archive, restore
SystemHealthSnapshotRedis (real-time) + Database (history)7 ngàySnapshot mỗi 1 giây
API interfaces
Ba lớp giao tiếp: REST API cho CRUD và quản lý, gRPC cho lệnh đồng bộ độ trễ thấp, WebSocket cho real-time updates tại MCR.
REST API
HTTP/JSON - CRUD và quản lý
Dùng cho các thao tác quản lý không yêu cầu độ trễ cực thấp: quản lý Playlist, MAM, Auth, Channel, As-run Log, Evidence. Versioned tại /api/v1/.
JSON payloadJWT authVersioned /v1/
gRPC
Protocol Buffers - lệnh real-time
Dùng cho lệnh yêu cầu độ trễ thấp: switch signal, play/stop file, activate graphics, schedule switch. Binary protocol, multiplexing, streaming. Đảm bảo lệnh thực thi trong ≤100ms.
Binary + streamingMultiplexing≤100ms
WebSocket
Real-time MCR updates
MCR Service cung cấp WebSocket endpoint ws://{host}/mcr/ws cho real-time updates: trạng thái tín hiệu, Playlist thay đổi, Tally Signal, đếm ngược, cảnh báo hệ thống.
Persistent connectionPush eventsMCR UI
Message Bus Events
Async event bus nội bộ
Message Bus (Apache Kafka hoặc NATS JetStream) làm event bus nội bộ giữa các microservice. Các topic chính: signal.*, playout.*, player.*, sync.*, channel.*, media.*, asrun.entry.created. Lưu ý: asrun.entry.created là notification realtime cho MCR UI - As-run Log được lưu trữ trong Database riêng, không lưu trên Message Bus.
Async decoupledReplay capableInternal only
ServiceEndpoint mẫuGiao thứcMô tả
MCR Service POST /api/v1/mcr/switch REST + gRPC Ra lệnh chuyển tín hiệu - REST nhận lệnh, gRPC thực thi xuống Virtual_Mixer
MCR Service ws://{host}/mcr/ws WebSocket Real-time: signal_status_update, tally_update, countdown_tick, system_alert
Scheduler GET /api/v1/playlists/{id}/versions REST Lịch sử phiên bản Playlist - xem, so sánh, restore
Scheduler POST /api/v1/playlists/{id}/versions/{v}/restore REST Restore Playlist về phiên bản cũ - tạo PlaylistVersion mới từ snapshot
Signal_Input GetLatencyProfile(streamId) gRPC Lấy latency profile: D_ingest, D_preview, executionOffsetMs
Virtual_Mixer ScheduleSwitch(targetId, executeAt) gRPC Lên lịch chuyển mạch tại UTC timestamp chính xác
Virtual_Mixer SetDVELayout(layout) gRPC Cấu hình DVE: PiP, Split Screen, Squeeze & Tease, DSK
Graphics_Engine ActivateElement(templateId, data) gRPC Kích hoạt lower third, ticker, logo overlay, full-screen graphics
MAM POST /api/v1/media/upload REST Upload file media - tự động trigger Transcode tạo proxy preview
MAM GET /api/v1/media/{id}/preview REST Lấy URL proxy file (720p/360p H.264) để preview kiểm duyệt
As-run Log GET /api/v1/asrun/report?channelId=&from=&to= REST Xuất báo cáo đối chiếu Playlist dự kiến vs thực tế phát sóng
Auth Service POST /api/v1/auth/mfa/verify REST Xác thực MFA bước 2 - TOTP, Email OTP, SMS OTP, Backup Code
Channel_Manager POST /api/v1/channels/{id}/signals/{signal_id} REST Subscribe Signal_Input vào Channel - dùng chung tín hiệu LIVE
Sync_Controller MeasureLatencyProfile(streamId) gRPC Đo và lưu latency profile của luồng - cập nhật execution_offset
Hạ tầng và công nghệ
HDCBS chạy trên Kubernetes cluster, sử dụng Message Bus (Apache Kafka hoặc NATS JetStream) làm event bus, Redis cho state sync real-time, và hỗ trợ cả Object Storage S3-compatible lẫn Local Disk/NAS/SAN.
Kubernetes + Docker
Mỗi service là một Deployment hoặc StatefulSet độc lập. Horizontal Pod Autoscaler tự động scale theo CPU/memory. Liveness/Readiness probe phát hiện sự cố và restart tự động. PTP grandmaster clock triển khai trong cluster.
Message Bus (Kafka / NATS JetStream)
Event bus bất đồng bộ giữa tất cả microservice. Hỗ trợ Apache Kafka (enterprise, throughput cao) hoặc NATS JetStream (ops đơn giản, latency thấp) tùy môi trường triển khai - cấu hình qua IEventBus adapter. Các topic chính: signal.*, playout.*, player.*, sync.*, channel.*, media.*, transcode.*, asrun.entry.created (notification realtime, không lưu trữ), filemanager.*. As-run Log được lưu trữ trong Database riêng, không lưu trên Message Bus.
Redis Cluster
State cache và sync real-time cho các thành phần critical path: Playout_Engine state, Player_Engine playhead, Graphics_Engine state, Virtual_Mixer state, Orchestrator system state. Pub/sub cho Active/Standby failover. TTL 30s cho state entries.
Database
Hỗ trợ PostgreSQL hoặc SQL Server tùy hạ tầng triển khai. Trừu tượng hóa qua ORM layer - không phụ thuộc vendor. Sử dụng 3 database riêng biệt: ManagementDb (Channel, Playlist, MediaAsset, User), AsRunDb (AsRunEntry, EvidenceSegment - write-heavy, retention 1 năm / 30 ngày), AuditDb (AuditLog - write-heavy, retention 1 năm). As-run Log lưu trong AsRunDb, không lưu trên Message Bus.
Media Storage
Hỗ trợ Object Storage S3-compatible (AWS S3, MinIO, Azure Blob) hoặc Local Disk / NAS / SAN. Truy cập qua Storage Adapter layer thống nhất. FileManager tải trước file về local disk Player Server - Player_Engine không đọc trực tiếp từ storage khi phát sóng.
GPU Processing
Transition effects (Dissolve, Fade, Wipe), DVE (PiP, Split Screen, Squeeze & Tease, DSK), và Graphics composite đều chạy trên GPU. Toàn bộ pipeline phải hoàn thành trong ≤1 frame (~40ms ở 25fps) để không tăng độ trễ tổng thể.
LớpCông nghệMục đích
Container orchestrationKubernetes, DockerDeploy, scale, health check tự động
Message busApache Kafka hoặc NATS JetStreamEvent-driven async giữa microservices, cấu hình theo môi trường triển khai
State cacheRedis ClusterReal-time state sync, pub/sub failover
DatabasePostgreSQL hoặc SQL ServerPersistent data - Playlist, Log, User, Channel
Media StorageS3-compatible hoặc Local Disk/NAS/SANFile media gốc và proxy preview
IngestSRT (dual-path), NDITiếp nhận tín hiệu LIVE từ trường quay
PreviewWebRTC (<100ms), SDI/NDI (<1 frame)Preview tín hiệu về MCR
Internal RPCgRPC (Protocol Buffers)Lệnh đồng bộ độ trễ thấp giữa services
Real-time UIWebSocketMCR real-time updates
Time syncNTP (Stratum 1/2), PTP/IEEE 1588 v2UTC wall-clock đồng bộ toàn hệ thống
SecurityTLS 1.3, JWT, DTLS/SRTPMã hóa toàn bộ kênh truyền
AuthTOTP, Email/SMS OTP, SAML 2.0, OIDCMFA đa lớp, SSO enterprise
GPUCUDA / OpenCLTransition, DVE, Graphics composite
Video codecFFmpeg, H.264, H.265Decode file, encode proxy preview
Chỉ số hiệu năng Giá trị
Uptime đảm bảo99.99% (≤52 phút downtime/năm)
Độ trễ chuyển tín hiệu≤100ms
Tally Signal≤50ms
Đồng bộ UTC±1 frame (±40ms ở 25fps)
Failover tự động (Control Plane)≤3 giây
Failover Sync_Controller≤1 giây
Failover Player/Graphics Engine≤1 giây
Auto-switch SRT dual-path≤500ms
Black frame tối đa khi chuyển1 frame
SRT ingest latency500ms - 2s
WebRTC preview latency<100ms (50-150ms thực tế)
SDI/NDI preview latency<1 frame (~40ms ở 25fps)
Health check Playout_Engine1 giây
Health check Orchestrator30 giây
State snapshot OrchestratorMỗi 1 giây
Pre-fetch file tối thiểu2 ngày
Retention As-run LogTối thiểu 1 năm
Retention Evidence videoTối thiểu 30 ngày