summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/dec_video.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c
index f366a54c57..c8b8bc972e 100644
--- a/libmpcodecs/dec_video.c
+++ b/libmpcodecs/dec_video.c
@@ -337,7 +337,7 @@ void *decode_video(sh_video_t *sh_video, unsigned char *start, int in_size,
unsigned int t2;
double tt;
- if (correct_pts) {
+ if (correct_pts && pts != MP_NOPTS_VALUE) {
int delay = get_current_video_decoder_lag(sh_video);
if (delay >= 0) {
if (delay > sh_video->num_buffered_pts)
@@ -395,8 +395,15 @@ void *decode_video(sh_video_t *sh_video, unsigned char *start, int in_size,
mpi->fields &= ~MP_IMGFIELD_TOP_FIRST;
if (correct_pts) {
- sh_video->num_buffered_pts--;
- sh_video->pts = sh_video->buffered_pts[sh_video->num_buffered_pts];
+ if (sh_video->num_buffered_pts) {
+ sh_video->num_buffered_pts--;
+ sh_video->pts = sh_video->buffered_pts[sh_video->num_buffered_pts];
+ }
+ else {
+ mp_msg(MSGT_CPLAYER, MSGL_ERR, "No pts value from demuxer to "
+ "use for frame!\n");
+ sh_video->pts = MP_NOPTS_VALUE;
+ }
}
return mpi;
}