## 3 System Design
### Fault Detection and Link Self-Healing
Through these mechanisms, SRT maximizes packet recovery while ensuring real-time performance, preventing outdated packets from impacting overall smoothness, and effectively enhancing video quality and stability in chain multi-hop transmission. Upon detection of node failure, the system initiates a _dynamic topology reconstruction algorithm_. This process first involves _fault impact assessment_, evaluating the scope of the affected nodes:  
\[ImpactScope=\{n_{i}|i>FailedNodeIndex\text{ and }n_{i}\in ActiveNodes\} \tag{16}\]  
Following this, the optimal reconstruction path calculation determines the best new path based on the network status and load of the remaining nodes:  
\[OptimalPath=\arg\min_{path}\sum_{i=1}^{|path|-1}w_{delay}\times RTT_{i,i+1}+w _{load}\times Load_{i} \tag{17}\]  
where \(w_{delay}\) and \(w_{load}\) represent the weights for delay and load, respectively. To ensure continuous service, the system implements a multi-level fallback self-healing strategy. This includes local buffer playback, where each node maintains a circular buffer to provide short-term cached playback if the upstream connection is interrupted:  
\[BufferDuration=\max(MinBuffer,\frac{AvailableMemory}{VideoDataRate}\times SafetyFactor) \tag{18}\]  
In addition, the system uses backup link switching. Pre-established backup transmission links are quickly activated if the primary link fails. The algorithm for backup link switching is described as follows (Algorithm 3):  
```
1:procedureBackupLinkSwitching
2:if\(primaryLinkFailed\)then
3:\(backupLink\gets selectBestBackup()\)
4:\(establConnection(backupLink)\)
5:\(seamlessSwitch(primaryLink,backupLink)\)
6:\(notifyDownstream(newUpstreamInfo)\)
7:endif
8:endprocedure
```  
**Algorithm 3** Backup Link Switching Algorithm  
The system's fault recovery performance metrics were obtained from output logs and task manager monitoring during experiments. In a specific test case as an example, fault detection delay was measured as \(T_{detection}\) (time from breakdown to interrupt trigger), topology reconstruction delay as \(T_{reconstruction}\) (time for reconnection and chain rebuilding), and service recovery delay as \(T_{recovery}\) (time until video playback resumed normally). The total fault recovery time is therefore calculated as  
\[T_{total}=T_{detection}+T_{reconstruction}+T_{recovery} \tag{19}\]  
Through the synergistic operation of these mechanisms, the system maintains high availability and service continuity in complex network environments, effectively addressing various fault scenarios. As shown in Figure 3, the fallback self-healing mechanism is triggered when a link break occurs, which is detected by the SRT protocol layer through packet loss and timeout monitoring. Each node will immediately signal the coordination server to report that it is still online and ready for a new connection right after the link break is detected. The video streaming is down soon after all buffer data is consumed, but the video player process will keep waiting until a new video stream is received. No crash will happen during this period, and the video player will not be interrupted. The new chain is reconstructed by the coordination server and broadcast to all nodes, which will then establish new SRT connections. The video streaming process of each node will automatically switch to the new chain and stream the received video data to the new downstream nodes. The video player will then resume playback. This procedure ensures that the system can quickly recover from link breaks and continue to provide uninterrupted video streaming services. The entire response process of this fallback mechanism is designed with latency optimization in mind. Fault confirmation is typically completed within 10 to 100 ms of detecting a WebSocket link break. Subsequently, chain reconstruction and the dissemination of jump-point control commands consume approximately 100 to 300 ms.