[pinpoint] Don't divide by zero when thumbnailing videos
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pinpoint] Don't divide by zero when thumbnailing videos
- Date: Thu, 1 Aug 2013 09:15:13 +0000 (UTC)
commit 09b77c924496d5f4d38119de8bac0377cbdfaa7d
Author: Stef Walter <stefw gnome org>
Date: Thu Feb 21 23:09:36 2013 +0100
Don't divide by zero when thumbnailing videos
Just pick a point halfway through the video, if a divide by zero
would have occurred.
https://bugzilla.gnome.org/show_bug.cgi?id=694392
gst-video-thumbnailer.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/gst-video-thumbnailer.c b/gst-video-thumbnailer.c
index 8f0a3ea..4d7a0ea 100644
--- a/gst-video-thumbnailer.c
+++ b/gst-video-thumbnailer.c
@@ -224,8 +224,10 @@ gst_video_thumbnailer_get_shot (const gchar *location,
if (duration > 0) {
if (duration / (3 * GST_SECOND) > 90) {
seekpos = (rand () % (duration / (3 * GST_SECOND))) * GST_SECOND;
- } else {
+ } else if (duration > GST_SECOND) {
seekpos = (rand () % (duration / (GST_SECOND))) * GST_SECOND;
+ } else {
+ seekpos = duration / 2;
}
} else {
seekpos = 5 * GST_SECOND;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]