Fixes Coverity CID 709343: Division or modulo by zero (DIVIDE_BY_ZERO)
Division by expression "mlt_properties_get_int(properties, "frame_rate_num")" which may be zero has undefined behavior
On this path, function call "mlt_properties_get_int(properties, "frame_rate_num")" has return value of 0
442 int frame_duration =
1000000 / mlt_properties_get_int( properties, "frame_rate_num" ) *
443 mlt_properties_get_int( properties, "frame_rate_den" );
}
// Set the frame duration in microseconds for the frame-dropping heuristic
- int frame_duration = 1000000 / mlt_properties_get_int( properties, "frame_rate_num" ) *
- mlt_properties_get_int( properties, "frame_rate_den" );
+ int frame_rate_num = mlt_properties_get_int( properties, "frame_rate_num" );
+ int frame_rate_den = mlt_properties_get_int( properties, "frame_rate_den" );
+ int frame_duration = 0;
+
+ if ( frame_rate_num && frame_rate_den )
+ {
+ frame_duration = 1000000 / frame_rate_num * frame_rate_den;
+ }
+
mlt_properties_set_int( properties, "frame_duration", frame_duration );
// Check and run an ante command