Ticket #1822: fix_for_latest_problem.diff

File fix_for_latest_problem.diff, 3.4 KB (added by skamithi, 20 years ago)

robin reported that initcodec is called too many times on a certain dvd causing blue screen. attaching small rewrite to the patch to prevent this.

  • libs/libmythtv/avformatdecoder.cpp

     
    10341034        GetNVP()->SetVideoParams(align_width, align_height, fps,
    10351035                                 keyframedist, aspect_ratio, kScan_Detect,
    10361036                                 dvd_video_codec_changed);
    1037         dvd_video_codec_changed = false;
    10381037    }
    10391038}
    10401039
     
    13901389                        /* force_xv     */ force_xv);
    13911390                    bool vcd, idct, mc;
    13921391                    enc->codec_id = myth2av_codecid(mcid, vcd, idct, mc);
    1393                     if (ringBuffer->isDVD() && (mcid != video_codec_id))
    1394                         dvd_video_codec_changed = true;
    13951392                    video_codec_id = mcid;
    13961393                    if (!force_xv && kCodec_NORMAL_END < mcid && kCodec_STD_XVMC_END > mcid)
    13971394                    {
     
    28482845            {
    28492846                int current_width = curstream->codec->width;
    28502847                int video_width = GetNVP()->GetVideoWidth();
    2851                 bool switch_to_xv = false;
    2852                 bool switch_to_xvmc = false;
    28532848                if (dvd_xvmc_enabled && GetNVP() && GetNVP()->getVideoOutput())
    28542849                {
    28552850                    bool dvd_xvmc_active = GetNVP()->getVideoOutput()->hasMCAcceleration();
    28562851                    bool indvdmenu   = ringBuffer->InDVDMenuOrStillFrame();
    2857                     if (indvdmenu && dvd_xvmc_active)
    2858                         switch_to_xv = true;
    2859                     else if (!indvdmenu && !dvd_xvmc_active)
    2860                         switch_to_xvmc = true;
     2852                    if ((indvdmenu && dvd_xvmc_active) ||
     2853                        (!(indvdmenu && dvd_xvmc_active)))
     2854                    {
     2855                        VERBOSE(VB_PLAYBACK, LOC + QString("DVD Codec Change "
     2856                                    "indvdmenu %1 dvd_xvmc_active %2")
     2857                                .arg(indvdmenu).arg(dvd_xvmc_active));
     2858                        dvd_video_codec_changed = true;
     2859                    }
    28612860                }
    28622861               
    28632862                if ((video_width > 0 && video_width != current_width) ||
    2864                     switch_to_xv || switch_to_xvmc)
     2863                    dvd_video_codec_changed)
    28652864                {
    2866                     VERBOSE(VB_PLAYBACK, LOC + QString("DVD Stream/Codec Change"
    2867                                 "video_width %1 current_width %2"
    2868                                 "switch_to_xv %3 switch_to_xvmc %4")
     2865                    VERBOSE(VB_PLAYBACK, LOC + QString("DVD Stream/Codec Change "
     2866                                "video_width %1 current_width %2 "
     2867                                "dvd_video_codec_changed %3")
    28692868                            .arg(video_width).arg(current_width)
    2870                             .arg(switch_to_xv).arg(switch_to_xvmc));
     2869                            .arg(dvd_video_codec_changed));
    28712870                    av_free_packet(pkt);
    28722871                    CloseCodecs();
    28732872                    ScanStreams(false);
     
    28752874                    allowedquit = true;
    28762875                    if (ringBuffer->DVD()->InStillFrame())
    28772876                        ringBuffer->DVD()->SeekCellStart();
     2877                    dvd_video_codec_changed = false;
    28782878                    continue;
    28792879                }
    28802880            }