encode: add some shit that does some shit

?????????????

Makes no sense, can endless loop, but whatever.

Part of #7524.
This commit is contained in:
wm4 2020-03-22 13:07:24 +01:00
parent de53155971
commit 63311762ed
1 changed files with 6 additions and 3 deletions

View File

@ -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;