3006 | | |
3007 | | if (numVidFrames == 0 && lastDVDStillFrame && |
| 3006 | |
| 3007 | if (numVidFrames > 20 && abs(lastapts - lastvpts) > 1000) |
| 3008 | { |
| 3009 | // discard video frames if dvd changes pts in the middle |
| 3010 | // of a title |
| 3011 | VERBOSE(VB_PLAYBACK, LOC + |
| 3012 | QString("DVD: discard video frames. " |
| 3013 | "audio & video pts have diverged alot. " |
| 3014 | "audio pts %1 video pts %2") |
| 3015 | .arg(lastapts).arg(lastvpts)); |
| 3016 | GetNVP()->DiscardVideoFrames(true); |
| 3017 | } |
| 3018 | else if (numVidFrames == 0 && lastDVDStillFrame && |
3661 | | temppts = lastvpts; |
3662 | | temppts += (long long)(1000 * av_q2d(context->time_base)); |
3663 | | // MPEG2 frames can be repeated, update pts accordingly |
3664 | | temppts += (long long)(mpa_pic.repeat_pict * 500 |
3665 | | * av_q2d(curstream->codec->time_base)); |
| 3669 | // Validate the video pts against the last pts. If it's |
| 3670 | // a little bit smaller or equal, compute it from the last. |
| 3671 | // Otherwise assume a wraparound. |
| 3672 | if (temppts <= lastvpts && temppts + 10000 > lastvpts) |
| 3673 | { |
| 3674 | temppts = lastvpts; |
| 3675 | temppts += (long long)(1000 * av_q2d(context->time_base)); |
| 3676 | // MPEG2 frames can be repeated, update pts accordingly |
| 3677 | temppts += (long long)(mpa_pic.repeat_pict * 500 |
| 3678 | * av_q2d(curstream->codec->time_base)); |
| 3679 | } |