optimize SDP input probing for video streams

Set max_ts_probe and fpsprobesize to 0 for SDP
video to reduce stream initialization latency.

Change-Id: Idfda66cfc72cb1a9d45c6da4e13c73f82859b1de
This commit is contained in:
pknellore
2025-06-12 15:15:07 -04:00
committed by Adrien Béraud
parent 3280fa373a
commit 38ac794295
3 changed files with 12 additions and 5 deletions

View File

@ -175,11 +175,14 @@ MediaDemuxer::openInput(const DeviceParams& params)
}
// Ask FFmpeg to open the input using the options set above
av_opt_set_int(
inputCtx_,
"fpsprobesize",
1,
AV_OPT_SEARCH_CHILDREN); // Don't waste time fetching framerate when finding stream info
if (params.disable_dts_probe_delay && params.format == "sdp") {
av_opt_set_int(inputCtx_, "max_ts_probe", 0, AV_OPT_SEARCH_CHILDREN);
av_opt_set_int(inputCtx_, "fpsprobesize", 0, AV_OPT_SEARCH_CHILDREN);
} else {
// Don't waste time fetching framerate when finding stream info
av_opt_set_int(inputCtx_, "fpsprobesize", 1, AV_OPT_SEARCH_CHILDREN);
}
int ret = avformat_open_input(&inputCtx_, input.c_str(), iformat, options_ ? &options_ : NULL);
if (ret) {

View File

@ -52,6 +52,8 @@ struct DeviceParams
int fd {}; // file descriptor for PipeWire (only relevant on Wayland)
std::string node {}; // node id for PipeWire
int is_area {};
// Skip DTS delay while finding stream info when PTS is sufficient
bool disable_dts_probe_delay = false;
};
} // namespace jami

View File

@ -138,6 +138,8 @@ VideoReceiveThread::setup()
videoDecoder_->setIOContext(&sdpContext_);
}
args_.disable_dts_probe_delay = true;
if (videoDecoder_->openInput(args_)) {
JAMI_ERR("Unable to open input \"%s\"", args_.input.c_str());
return false;