mirror of
https://github.com/ossrs/srs.git
synced 2025-11-24 11:54:21 +08:00
This PR refactors the RTMP to RTC bridge to support multiple video tracks by implementing lazy initialization of audio and video tracks. Instead of pre-determining track parameters during bridge construction, tracks are now initialized dynamically when the first packet of each type is received, allowing proper codec detection and track configuration for dual video track scenarios. Failed to view WHEP with HEVC before publishing RTMP, because the default codec is AVC and will not be updated until the stream is published. This enables better handling of streams with multiple video tracks in RTMP to WebRTC bridging scenarios. Now, you are able to: 1. View WHEP with HEVC: Play with WebRTC: http://localhost:8080/players/whep.html?schema=http&&codec=hevc 2. Then publish by RTMP: `ffmpeg -stream_loop -1 -re -i doc/source.flv -c:v libx265 -profile:v main -preset fast -b:v 2000k -maxrate 2000k -bufsize 2000k -bf 0 -c:a aac -b:a 48k -ar 44100 -ac 2 -f flv rtmp://localhost/live/livestream` Or publish RTMP with HEVC, then view by WHEP. Note that if the codecs do not match, the error log will display RTC: `Drop for ssrc xxxxxx not found`. For example, this can occur if you publish RTMP with HEVC while viewing the stream with AVC.