From 63311762ede9a29354383448582b89769db7ab94 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 22 Mar 2020 13:07:24 +0100 Subject: encode: add some shit that does some shit ????????????? Makes no sense, can endless loop, but whatever. Part of #7524. --- audio/out/ao_lavc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'audio/out') diff --git a/audio/out/ao_lavc.c b/audio/out/ao_lavc.c index bc4177ae03..e4700d7f1b 100644 --- a/audio/out/ao_lavc.c +++ b/audio/out/ao_lavc.c @@ -228,14 +228,17 @@ static void encode(struct ao *ao, double apts, void **data) int64_t frame_pts = av_rescale_q(frame->pts, encoder->time_base, ac->worst_time_base); - if (ac->lastpts != AV_NOPTS_VALUE && frame_pts <= ac->lastpts) { - // this indicates broken video - // (video pts failing to increase fast enough to match audio) + while (ac->lastpts != AV_NOPTS_VALUE && frame_pts <= ac->lastpts) { + // whatever the fuck this code does? MP_WARN(ao, "audio frame pts went backwards (%d <- %d), autofixed\n", (int)frame->pts, (int)ac->lastpts); + int64_t prets = frame->pts; frame_pts = ac->lastpts + 1; + ac->lastpts = frame_pts; frame->pts = av_rescale_q(frame_pts, ac->worst_time_base, encoder->time_base); + frame_pts = av_rescale_q(frame->pts, encoder->time_base, + ac->worst_time_base); } ac->lastpts = frame_pts; -- cgit v1.2.3