diff options
Diffstat (limited to 'audio')
-rw-r--r-- | audio/out/ao_lavc.c | 9 |
1 files changed, 6 insertions, 3 deletions
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; |