We were assigning to a guint64 value (frame->dts) the sum of a unsigned
and signed value... resulting it the result never being < 0.
Instead just check if it is smaller before assigning to frame->dts.
}
}
- frame->dts = pic_out.i_dts + encoder->dts_offset;
- /* should be ok now, surprise if not */
- if (frame->dts < 0) {
+ if (pic_out.i_dts + encoder->dts_offset < 0) {
+ /* should be ok now, surprise if not */
GST_WARNING_OBJECT (encoder, "negative dts after offset compensation");
frame->dts = GST_CLOCK_TIME_NONE;
- }
+ } else
+ frame->dts = pic_out.i_dts + encoder->dts_offset;
+
if (pic_out.b_keyframe) {
GST_DEBUG_OBJECT (encoder, "Output keyframe");