Skip to content

Commit

Permalink
Don't divide by zero when thumbnailing videos
Browse files Browse the repository at this point in the history
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
  • Loading branch information
stefwalter committed Aug 1, 2013
1 parent 80a056c commit 09b77c9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gst-video-thumbnailer.c
Expand Up @@ -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;
Expand Down

0 comments on commit 09b77c9

Please sign in to comment.