diff --git a/plugins/mac-vth264/encoder.c b/plugins/mac-vth264/encoder.c index 4fec74de7..8551a1aee 100644 --- a/plugins/mac-vth264/encoder.c +++ b/plugins/mac-vth264/encoder.c @@ -660,17 +660,15 @@ static bool parse_sample(struct vt_h264_encoder *enc, CMSampleBufferRef buffer, CMTime pts = CMSampleBufferGetPresentationTimeStamp(buffer); CMTime dts = CMSampleBufferGetDecodeTimeStamp(buffer); - pts = CMTimeMultiplyByFloat64(pts, - ((Float64)enc->fps_num / enc->fps_den)); - dts = CMTimeMultiplyByFloat64(dts, - ((Float64)enc->fps_num / enc->fps_den)); - if (CMTIME_IS_INVALID(dts)) dts = pts; // imitate x264's negative dts when bframes might have pts < dts else if (enc->bframes) dts = CMTimeSubtract(dts, off); + pts = CMTimeMultiply(pts, enc->fps_num); + dts = CMTimeMultiply(dts, enc->fps_num); + bool keyframe = is_sample_keyframe(buffer); da_resize(enc->packet_data, 0); @@ -772,7 +770,7 @@ static bool vt_h264_encode(void *data, struct encoder_frame *frame, CMTime dur = CMTimeMake(enc->fps_den, enc->fps_num); CMTime off = CMTimeMultiply(dur, 2); - CMTime pts = CMTimeMultiply(dur, frame->pts); + CMTime pts = CMTimeMake(frame->pts, enc->fps_num); CVPixelBufferRef pixbuf = NULL;