mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
nvcodec: Assume 25fps if framerate is invalid when calculating latency
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1826>
This commit is contained in:
parent
1a5862dd39
commit
64f96facca
1 changed files with 11 additions and 3 deletions
|
@ -323,13 +323,21 @@ gst_nvdec_get_max_display_delay (GstNvDec * nvdec)
|
||||||
static gint64
|
static gint64
|
||||||
gst_nvdec_get_latency (GstNvDec * nvdec)
|
gst_nvdec_get_latency (GstNvDec * nvdec)
|
||||||
{
|
{
|
||||||
|
gint fps_n, fps_d;
|
||||||
|
|
||||||
if (!nvdec->input_state)
|
if (!nvdec->input_state)
|
||||||
return 0;
|
return 0;
|
||||||
|
fps_n = GST_VIDEO_INFO_FPS_N (&nvdec->input_state->info);
|
||||||
|
fps_d = GST_VIDEO_INFO_FPS_D (&nvdec->input_state->info);
|
||||||
|
|
||||||
|
/* We assume 25 fps if the input framerate is invalid */
|
||||||
|
if (fps_n < 1 || fps_d < 1) {
|
||||||
|
fps_n = 25;
|
||||||
|
fps_d = 1;
|
||||||
|
}
|
||||||
|
|
||||||
return gst_util_uint64_scale_int ((nvdec->num_decode_surface +
|
return gst_util_uint64_scale_int ((nvdec->num_decode_surface +
|
||||||
gst_nvdec_get_max_display_delay (nvdec)) * GST_SECOND,
|
gst_nvdec_get_max_display_delay (nvdec)) * GST_SECOND, fps_d, fps_n);
|
||||||
GST_VIDEO_INFO_FPS_D (&nvdec->input_state->info),
|
|
||||||
GST_VIDEO_INFO_FPS_N (&nvdec->input_state->info));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 0: fail, 1: succeeded, > 1: override dpb size of parser
|
/* 0: fail, 1: succeeded, > 1: override dpb size of parser
|
||||||
|
|
Loading…
Reference in a new issue