Opened 13 years ago

Closed 13 years ago

#3125 closed defect (fixed)

DVD player hangs if xvmc and UseXvMCForHDOnly is 1

Reported by: foom@… Owned by: skamithi
Priority: minor Milestone: 0.21
Component: mythtv Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

In avformatdecoder.cpp, if dvd_xvmc_enabled is true, but GetBestSupportedCodec? returns a non-xvmc codec, the dvd code will continuously think that the codec should be changed to enable xvmc, which will never happen.

This is because of this code (summarized) on line 2805:

                if (dvd_xvmc_enabled)
                    if ((indvdmenu && dvd_xvmc_active) ||
                        ((!indvdmenu && !dvd_xvmc_active)))
                    {
                        dvd_video_codec_changed = true;

Thus, it tries to reinitialize the codec every time it tries to get a new frame, and gets stuck on a blank screen. The attached patch appears to fix it, by turning off dvd_xvmc_enabled when xvmc doesn't actually manage to get turned on. (it also removes the redundant force_xv check from the first if clause: GetBestVideoCodec? won't return one of those codecs if force_xv).

Index: avformatdecoder.cpp
===================================================================
--- avformatdecoder.cpp (revision 12786)
+++ avformatdecoder.cpp (working copy)
@@ -1338,11 +1338,13 @@
                     bool vcd, idct, mc;
                     enc->codec_id = myth2av_codecid(mcid, vcd, idct, mc);
                     video_codec_id = mcid;
-                    if (!force_xv && kCodec_NORMAL_END < mcid && kCodec_STD_XVMC_END > mcid)
+                    if (kCodec_NORMAL_END < mcid && kCodec_STD_XVMC_END > mcid)
                     {
                         enc->pix_fmt = (idct) ?
                             PIX_FMT_XVMC_MPEG2_IDCT : PIX_FMT_XVMC_MPEG2_MC;
-                    }
+                    } else if(!force_xv)
+                        // if we wanted an xvmc codec but didn't get one, don't try to get one again.
+                        dvd_xvmc_enabled = false;
                 }
                 else
                 {

BTW, the name "dvd_xvmc_enabled" is quite misleading. My first attempt to fix the problem was to simply set it to false always, but that also disabled xvmc in normal playback.

Attachments (3)

fix_for_ticket_3125.diff (633 bytes) - added by skamithi 13 years ago.
disable attempt to try and activate xvmc if UseXvmcForHDOnly is enabled. in the mythtv-vid branch, this type of fix is not needed cause video profiles better addresses this issue. So this is a workaround til mythtv-vid branch is merged back to svn.
disable_dvd_xvmc_if_codec_change_fails.diff (1.7 KB) - added by skamithi 13 years ago.
disable xvmc for dvd if codec check fails, like the ticket submitter stated. i have a pc with intel graphics card. xvmc compiles but it doesn't support it. so it was a good pc to test out this code.
disable_dvd_xvmc_if_codec_change_fails_svn.diff (1.5 KB) - added by skamithi 13 years ago.
patch against svn trunk. previous patch against mythtv-vid.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 13 years ago by skamithi

Owner: changed from Isaac Richards to skamithi

Changed 13 years ago by skamithi

Attachment: fix_for_ticket_3125.diff added

disable attempt to try and activate xvmc if UseXvmcForHDOnly is enabled. in the mythtv-vid branch, this type of fix is not needed cause video profiles better addresses this issue. So this is a workaround til mythtv-vid branch is merged back to svn.

comment:2 Changed 13 years ago by skamithi

Status: newassigned

comment:3 Changed 13 years ago by foom@…

Seems like that would work, but I thought it would be better to address it on the other side, just in case there are other possible reasons why GetBestVideoCodec? might not return an XVMC codec, even when one was requested.

comment:4 Changed 13 years ago by skamithi

Resolution: fixed
Status: assignedclosed

(In [12862]) Closes #3125. internal dvd player: disable attempt to try and activate xvmc if UseXvmcForHDOnly is enabled. this patch is a workaround until video profiles is merged from the mythtv-vid. problem should not be present in the mythtv-vid branch.

comment:5 Changed 13 years ago by anonymous

Resolution: fixed
Status: closedreopened

Changed 13 years ago by skamithi

disable xvmc for dvd if codec check fails, like the ticket submitter stated. i have a pc with intel graphics card. xvmc compiles but it doesn't support it. so it was a good pc to test out this code.

Changed 13 years ago by skamithi

patch against svn trunk. previous patch against mythtv-vid.

comment:6 Changed 13 years ago by skamithi

(In [12955]) Refs #3125: internal dvd player: if xvmc is enabled and video codec change is not possible then disable xvmc for dvd viewing.

comment:7 Changed 13 years ago by skamithi

(In [12956]) Refs #3125. apply [12955] to svn head.

comment:8 Changed 13 years ago by skamithi

Milestone: unknown0.21
Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.