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:
Stefan Sauer 2013-10-08 09:13:50 +02:00
parent b5bcd73015
commit 9269bee9bd

View file

@ -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;
} }