diff options
author | Edward Hervey <edward@centricular.com> | 2017-11-21 10:15:02 +0100 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2017-12-01 10:02:04 +0100 |
commit | 6743778e6c7392d23505ed614282e98464b0f4f6 (patch) | |
tree | a17a9b156b7b3de6d76621fc32ee391f3ccc2fca | |
parent | 64ed90827ce391bdc6d38a4a56b0b0fb4487f5df (diff) | |
download | gstreamer-plugins-base-6743778e6c7392d23505ed614282e98464b0f4f6.tar.gz |
videotestsrc: Avoid overflow calculation
n_frames could end up being quite big (potentially up to G_MAXINT64). Which
would result in overflowing 64bits when multiplying it by GST_SECOND.
Instead move GST_SECOND to the num argument
-rw-r--r-- | gst/videotestsrc/gstvideotestsrc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gst/videotestsrc/gstvideotestsrc.c b/gst/videotestsrc/gstvideotestsrc.c index cfa66197d..93d0b1320 100644 --- a/gst/videotestsrc/gstvideotestsrc.c +++ b/gst/videotestsrc/gstvideotestsrc.c @@ -1138,7 +1138,7 @@ gst_video_test_src_fill (GstPushSrc * psrc, GstBuffer * buffer) } GST_LOG_OBJECT (src, - "creating buffer from pool for frame %d", (gint) src->n_frames); + "creating buffer from pool for frame %" G_GINT64_FORMAT, src->n_frames); if (!gst_video_frame_map (&frame, &src->info, buffer, GST_MAP_WRITE)) goto invalid_frame; @@ -1172,8 +1172,8 @@ gst_video_test_src_fill (GstPushSrc * psrc, GstBuffer * buffer) } GST_BUFFER_OFFSET_END (buffer) = GST_BUFFER_OFFSET (buffer) + 1; if (src->info.fps_n) { - next_time = gst_util_uint64_scale_int (src->n_frames * GST_SECOND, - src->info.fps_d, src->info.fps_n); + next_time = gst_util_uint64_scale (src->n_frames, + src->info.fps_d * GST_SECOND, src->info.fps_n); if (src->reverse) { GST_BUFFER_DURATION (buffer) = src->running_time - next_time; } else { |