mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-29 19:50:40 +00:00
videodecoder: don't overflow in bytes<->time conversion
fps_n and _d values can be large and this can overflow a uint. Also fix copy'n'paste mistake in comments.
This commit is contained in:
parent
b5bcd73015
commit
9269bee9bd
1 changed files with 4 additions and 4 deletions
|
@ -605,15 +605,15 @@ gst_video_rawvideo_convert (GstVideoCodecState * state,
|
||||||
res = TRUE;
|
res = TRUE;
|
||||||
} else if (src_format == GST_FORMAT_TIME &&
|
} else if (src_format == GST_FORMAT_TIME &&
|
||||||
*dest_format == GST_FORMAT_BYTES && fps_d && vidsize) {
|
*dest_format == GST_FORMAT_BYTES && fps_d && vidsize) {
|
||||||
/* convert time to frames */
|
/* convert time to bytes */
|
||||||
*dest_value = gst_util_uint64_scale (src_value,
|
*dest_value = gst_util_uint64_scale (src_value,
|
||||||
fps_n * vidsize, GST_SECOND * fps_d);
|
fps_n * (guint64) vidsize, GST_SECOND * fps_d);
|
||||||
res = TRUE;
|
res = TRUE;
|
||||||
} else if (src_format == GST_FORMAT_BYTES &&
|
} else if (src_format == GST_FORMAT_BYTES &&
|
||||||
*dest_format == GST_FORMAT_TIME && fps_n && vidsize) {
|
*dest_format == GST_FORMAT_TIME && fps_n && vidsize) {
|
||||||
/* convert frames to time */
|
/* convert bytes to time */
|
||||||
*dest_value = gst_util_uint64_scale (src_value,
|
*dest_value = gst_util_uint64_scale (src_value,
|
||||||
GST_SECOND * fps_d, fps_n * vidsize);
|
GST_SECOND * fps_d, fps_n * (guint64) vidsize);
|
||||||
res = TRUE;
|
res = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue