Ticket #4685: ticket_4685_potential_fix_#2.diff

File ticket_4685_potential_fix_#2.diff, 2.9 KB (added by skamithi, 16 years ago)
  • libs/libmythtv/avformatdecoder.cpp

     
    30033003                int numVidFrames = 0;
    30043004                if (GetNVP() && GetNVP()->getVideoOutput())
    30053005                    numVidFrames = GetNVP()->getVideoOutput()->ValidVideoFrames();
    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 &&
    30083019                    ringBuffer->DVD()->InStillFrame())
    30093020                {
    30103021                    VERBOSE(VB_PLAYBACK, LOC + "DVD: in still frame but "
     
    36533664
    36543665                    long long temppts = pts;
    36553666
    3656                     // Validate the video pts against the last pts. If it's
    3657                     // a little bit smaller or equal, compute it from the last.
    3658                     // Otherwise assume a wraparound.
    3659                     if (temppts <= lastvpts && temppts + 10000 > lastvpts)
     3667                    if (!ringBuffer->isDVD())
    36603668                    {
    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                        }
    36663680                    }
    36673681
    36683682                    VERBOSE(VB_PLAYBACK|VB_TIMESTAMP, LOC +