generic/video: better A/V sync with clutterfb

This commit is contained in:
Stefan Seyfried
2017-02-19 17:53:30 +01:00
parent 9348cef2a6
commit 9715204498

View File

@@ -598,10 +598,17 @@ void VDec::run(void)
f->height(c->height); f->height(c->height);
int64_t vpts = av_frame_get_best_effort_timestamp(frame); int64_t vpts = av_frame_get_best_effort_timestamp(frame);
/* a/v delay determined experimentally :-) */ /* a/v delay determined experimentally :-) */
#if USE_OPENGL
if (v_format == VIDEO_FORMAT_MPEG2) if (v_format == VIDEO_FORMAT_MPEG2)
vpts += 90000*4/10; /* 400ms */ vpts += 90000*4/10; /* 400ms */
else else
vpts += 90000*3/10; /* 300ms */ vpts += 90000*3/10; /* 300ms */
#endif
#if USE_CLUTTER
/* no idea why there's a difference between OpenGL and clutter rendering... */
if (v_format == VIDEO_FORMAT_MPEG2)
vpts += 90000*3/10; /* 300ms */
#endif
f->pts(vpts); f->pts(vpts);
AVRational a = av_guess_sample_aspect_ratio(avfc, avfc->streams[0], frame); AVRational a = av_guess_sample_aspect_ratio(avfc, avfc->streams[0], frame);
f->AR(a); f->AR(a);