summaryrefslogtreecommitdiffstats
path: root/audio/out
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-03-22 13:07:24 +0100
committerwm4 <wm4@nowhere>2020-03-22 13:07:36 +0100
commit63311762ede9a29354383448582b89769db7ab94 (patch)
treef91a87112e3e3e99337310452ad7a1baa7107ce1 /audio/out
parentde53155971395a25cf8c6a5af8be867256f18f81 (diff)
downloadmpv-63311762ede9a29354383448582b89769db7ab94.tar.bz2
mpv-63311762ede9a29354383448582b89769db7ab94.tar.xz
encode: add some shit that does some shit
????????????? Makes no sense, can endless loop, but whatever. Part of #7524.
Diffstat (limited to 'audio/out')
-rw-r--r--audio/out/ao_lavc.c9
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;