From 05d52ee3a7a123bf1d078f23c9fa92625cdcd52c Mon Sep 17 00:00:00 2001 From: tt2468 Date: Sat, 11 Nov 2023 02:24:46 -0800 Subject: [PATCH] libobs: Fix PTS incrementation when FPS divisor is enabled When using a PTS divisor, OBS would still increment the PTS by only the original `fps_den` value, not considering that PTS values should be multiplied by the divisor. For example, `60/1` increases like `0,1,2,3`. `60000/1001` increases like `0,1001,2002,3003`. Without this fix, `60/1` main OBS framerate with a divisor of `2` produces `0,1,2,3`, while the correct pattern would be `0,2,4,6` --- libobs/obs-encoder.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libobs/obs-encoder.c b/libobs/obs-encoder.c index 3e7c3c811..ab1bfde5a 100644 --- a/libobs/obs-encoder.c +++ b/libobs/obs-encoder.c @@ -1398,7 +1398,8 @@ static void receive_video(void *param, struct video_data *frame) enc_frame.pts = encoder->cur_pts; if (do_encode(encoder, &enc_frame)) - encoder->cur_pts += encoder->timebase_num; + encoder->cur_pts += + encoder->timebase_num * encoder->frame_rate_divisor; wait_for_audio: profile_end(receive_video_name);