mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-14 03:15:47 +00:00
vaapidecode: calculate decoding latency
This is a naïve approach to the calculation of the VA-API decoding latency. It takes into consideration when the frame-rate has some insane value. https://bugzilla.gnome.org/show_bug.cgi?id=740419
This commit is contained in:
parent
dff6b7cb31
commit
26cedfa9fa
1 changed files with 16 additions and 0 deletions
|
@ -226,6 +226,22 @@ gst_vaapidecode_update_src_caps (GstVaapiDecode * decode)
|
||||||
gst_caps_set_features (state->caps, 0, features);
|
gst_caps_set_features (state->caps, 0, features);
|
||||||
gst_caps_replace (&decode->srcpad_caps, state->caps);
|
gst_caps_replace (&decode->srcpad_caps, state->caps);
|
||||||
gst_video_codec_state_unref (state);
|
gst_video_codec_state_unref (state);
|
||||||
|
|
||||||
|
gint fps_n = GST_VIDEO_INFO_FPS_N (vi);
|
||||||
|
gint fps_d = GST_VIDEO_INFO_FPS_D (vi);
|
||||||
|
if (fps_n <= 0 || fps_d <= 0) {
|
||||||
|
GST_DEBUG_OBJECT (decode, "forcing 25/1 framerate for latency calculation");
|
||||||
|
fps_n = 1;
|
||||||
|
fps_d = 25;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* For parsing/preparation purposes we'd need at least 1 frame
|
||||||
|
* latency in general, with perfectly known unit boundaries (NALU,
|
||||||
|
* AU), and up to 2 frames when we need to wait for the second frame
|
||||||
|
* start to determine the first frame is complete */
|
||||||
|
GstClockTime latency = gst_util_uint64_scale (2 * GST_SECOND, fps_d, fps_n);
|
||||||
|
gst_video_decoder_set_latency (vdec, latency, latency);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue