Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Some DVD plugins improvements



I'm working on DVD plugins rev. dvd-0.3.4-rc10 patched to be compiled with
vdr 1.3.6.

I got two main bugs :
1) at DVD startup because of an unsafe multithreaded access to libdvdnav
functions. occasionally but not rarely ( most of time with DVD just
inserted in the reader ) plugin let vdr be crashed.
   I applied a small patch to libdvdnav to export a property of the nav
pseudo-object which let a caller to know if the nav internal virtual
machine is started or-not ( dvdnavopen function does not start the
internal virtual machine, which is instead started in some different
functions ), then I modified this way the
cDvdPlayer::DVDActiveAndRunning(void) function in the player-dvd.h modules

original :

    bool DVDActiveAndRunning(void) const { return active &&
nav!=NULL && running ; }


changed in :

    bool DVDActiveAndRunning(void) const { return active && running &&
(dvdnav_is_vm_started_tho68(nav)==1); }

In more detail the bug appear when :
A) the cDvdPlayerControl::ProcessKey (running in the vdr main thread env)
call cDvdPlayerControl::GetDisplayHeaderLine( ... )  which call
the  dvdnav_get_number_of_titles function of libdvdnav, which try to start
the nav virtual machine with no use of any mutex mechanism
and contemporaneously
B) is called the dvdnav_get_next_cache_block from the cDvdPlayer thread which try
 to start by himself the nav internal virtual machine.

when this happen the behaviour is unpredictable and drive always to a vdr
crash.

2) Menu handling was very unstable : I tested about 40 commercial DVD
title ( all awas original DVD's ) and about 15 of them has problems in
menu handling, in more detail in the show of Stillpicture acting as
background of menus. On some title was sistematic the lacking of the
background and only check was drawn, in other DVD's occasionally
background of menus was lost partially or totally.
I applied this simple patch and all previously described problems was out
( I rented and tested again all failing DVD's ):



original lines in player-dvd.c

      if (IframeCnt > 0) {
          DEBUG_IFRAME("I-Frame: DeviceStillPicture: IframeCnt=%d->-1,
used=%d, ",
			IframeCnt, IframeAssembler.Used());
	  DeviceStillPicture(IframeAssembler.Get(),
IframeAssembler.Used());
	  IframeAssembler.Clear();
	  IframeCnt = -1; // mark that we played an IFrame !
          if (blk_size <= 0 && !skipPlayVideo)
	      sleept = 1*90U;  // 1ms*90t/ms

          DEBUG_IFRAME("stc=%8ums vpts=%8ums sleept=%ums\n",
		(unsigned int)(stcPTS/90U),
		(unsigned int)(VideoPts/90U), sleept/90U);
	  continue;
      }


I added a call to DeviceClear() before DeviceStillPicture( ... )

      if (IframeCnt > 0) {
          DEBUG_IFRAME("I-Frame: DeviceStillPicture: IframeCnt=%d->-1,
used=%d, ",IframeCnt, IframeAssembler.Used());
// -----
          DeviceClear();  // tho68 added line
// -----
	  DeviceStillPicture(IframeAssembler.Get(), IframeAssembler.Used());
	  IframeAssembler.Clear();
	  IframeCnt = -1; // mark that we played an IFrame !
          if (blk_size <= 0 && !skipPlayVideo)
	      sleept = 1*90U;  // 1ms*90t/ms

          DEBUG_IFRAME("stc=%8ums vpts=%8ums sleept=%ums\n",
		(unsigned int)(stcPTS/90U),
		(unsigned int)(VideoPts/90U), sleept/90U);
	  continue;
      }


That's All
Angelo





Home | Main Index | Thread Index