Skip to content

Commit

Permalink
libobs: Fix PTS incrementation when FPS divisor is enabled
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
tt2468 authored and derrod committed Nov 29, 2023
1 parent e9ecb6c commit 05d52ee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libobs/obs-encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 05d52ee

Please sign in to comment.