This commit is contained in:
cxh 2025-09-22 09:47:59 +08:00
parent 997c9155b8
commit 0ac1f0a670

View File

@ -22,7 +22,6 @@ void RTSPManager::init()
LOG_INFO("[RTSP] GStreamer initialized.");
}
// 创建 media factory
// 创建 media factory
GstRTSPMediaFactory *RTSPManager::create_media_factory(const Camera &cam)
{
@ -36,11 +35,11 @@ GstRTSPMediaFactory *RTSPManager::create_media_factory(const Camera &cam)
" ! video/x-raw,format=NV12,width=" + std::to_string(out_width) +
",height=" + std::to_string(out_height) +
",framerate=" + std::to_string(cam.fps) + "/1"
" ! queue max-size-buffers=2 leaky=downstream"
" ! mpph264enc bps=2000000 gop=" +
std::to_string(cam.fps) +
" ! h264parse"
" ! rtph264pay name=pay0 pt=96 config-interval=1 )";
" ! queue max-size-buffers=1 leaky=downstream" // 最小队列
" ! mpph264enc bps=4000000 gop=" +
std::to_string(cam.fps) + " " // 固定 4Mbps
" ! h264parse"
" ! rtph264pay name=pay0 pt=96 config-interval=1 )"; // 每秒发送 SPS/PPS
GstRTSPMediaFactory *factory = gst_rtsp_media_factory_new();
gst_rtsp_media_factory_set_launch(factory, launch_str.c_str());