Mailing List archive

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

[vdr] Re: My solution to " VDR frozen every 2 seconds"



Hi,

On Saturday 27 April 2002 16:13, Maxime GUILBOT wrote:
> Maxime GUILBOT

[...]

> I put file_readahead to 0 and breada_readahead to 0 and dvd playing is
> perfect, no image frozen, fast dvd menu on my pentium 133mhz, I only have
> 30% of the cpu used with ac3 over dvb-s 2.1.
> I someone have the same problem, he could try it :
> echo file_readahead:0 > /proc/ide/hdc/settings
> echo breada_readahead:0 > /proc/ide/hdc/settings
> echo dsc_overlap:1 > /proc/ide/hdc/settings

Attached is a patch to include the setting of those parameters in vdr. The 
patch does not set  dsc_overlap.
Could everybody with those dvd freezes please try it and report wether this 
helps or not?

Have fun

    Andreas

===== dvd.c 1.18 vs edited =====
--- 1.18/dvd.c	Mon Apr 22 12:27:25 2002
+++ edited/dvd.c	Sun Apr 28 14:46:07 2002
@@ -37,6 +37,7 @@
 #include "i18n.h"
 
 #include <linux/cdrom.h>
+#include <linux/fs.h>
 
 #include "ogle-dvd.h"
 #include "dvdevents.h"
@@ -61,6 +62,8 @@
 
 const char *cDVD::deviceName = "/dev/dvd";
 cDVD *cDVD::dvdInstance = NULL;
+unsigned long cDVD::readahead;
+unsigned long cDVD::freadahead;
 
 cDVD *cDVD::getDVD(void)
 {
@@ -76,10 +79,13 @@
   dvdfile = NULL;
   dvdroot = NULL;
   dvdInstance = this;
+  storeParam();
 }
 
 cDVD::~cDVD()
 {
+  if (deviceName)
+      restoreParam();
   vm_destroy();
   CloseFile();
   CloseRoot();
@@ -98,7 +104,10 @@
 
 void cDVD::SetDeviceName(const char *DeviceName)
 {
+  if (deviceName)
+      restoreParam();
   deviceName = strdup(DeviceName);
+  storeParam();
 }
 
 const char *cDVD::DeviceName(void)
@@ -122,10 +131,73 @@
      dvdInstance->CloseFile();
      dvdInstance->CloseRoot();
   }
+  if (deviceName)
+      restoreParam();
   vm_destroy();
   Command(CDROMEJECT);
 }
 
+
+void cDVD::storeParam(void)
+{
+#if defined(BLKRAGET) && defined(BLKFRAGET)
+  isyslog(LOG_INFO, "cDVD::storeParam on '%s':", deviceName);
+  int fd;
+  if ((fd = open(deviceName, O_RDONLY | O_NONBLOCK)) > 0) {
+      if (ioctl(fd, BLKRAGET, &readahead))
+	  esyslog(LOG_ERR, "  BLKRAGET failed");
+      else
+	  isyslog(LOG_INFO, "  BLKRAGET: %ld", readahead);
+      if (ioctl(fd, BLKFRAGET, &freadahead))
+	  esyslog(LOG_ERR, "  BLKFRAGET failed");
+      else
+	  isyslog(LOG_INFO, "  BLKFRAGET: %ld", freadahead);
+      close(fd);
+  } else
+      esyslog(LOG_ERR, "  error: %s", strerror(errno));
+#endif
+}
+
+void cDVD::setDVDParam(void)
+{
+#if defined(BLKRAGET) && defined(BLKFRAGET)
+  isyslog(LOG_INFO, "cDVD::setDVDParam on '%s':", deviceName);
+  int fd;
+  if ((fd = open(deviceName, O_RDONLY | O_NONBLOCK)) > 0) {
+      if (ioctl(fd, BLKRASET, 0))
+	  esyslog(LOG_ERR, "  BLKRASET failed");
+      else
+	  isyslog(LOG_INFO, "  BLKRASET: %ld", readahead);
+      if (ioctl(fd, BLKFRASET, 0))
+	  esyslog(LOG_ERR, "  BLKFRASET failed");
+      else
+	  isyslog(LOG_INFO, "  BLKFRASET: %ld", freadahead);
+      close(fd);
+  } else
+      esyslog(LOG_ERR, "  error: %s", strerror(errno));
+#endif
+}
+
+void cDVD::restoreParam(void)
+{
+#if defined(BLKRAGET) && defined(BLKFRAGET)
+  isyslog(LOG_INFO, "cDVD::restoreParam on '%s':", deviceName);
+  int fd;
+  if ((fd = open(deviceName, O_RDONLY | O_NONBLOCK)) > 0) {
+      if (ioctl(fd, BLKRASET, readahead))
+	  esyslog(LOG_ERR, "  BLKRASET failed");
+      else
+	  isyslog(LOG_INFO, "  BLKRASET: %ld", readahead);
+      if (ioctl(fd, BLKFRASET, freadahead))
+	  esyslog(LOG_ERR, "  BLKFRASET failed");
+      else
+	  isyslog(LOG_INFO, "  BLKFRASET: %ld", freadahead);
+      close(fd);
+  } else
+      esyslog(LOG_ERR, "  error: %s", strerror(errno));
+#endif
+}
+
 int cDVD::OpenRoot(void)
 {
   if((dvdroot = DVDOpen(deviceName)) == NULL) {
@@ -374,6 +446,7 @@
   :cPlayBuffer(DvbApi, VideoDev, AudioDev, DVDBUFSIZE)
 {
   dvd = DvD;
+  dvd->setDVDParam();
   cyclestate = cOPENDVD;
   skipCnt = 0;
   VideoPts = 0;
@@ -392,6 +465,7 @@
 cDVDplayBuffer::~cDVDplayBuffer()
 {
   Stop();
+  dvd->restoreParam();
   Close();
   dvbApi->SetModeNormal(false);
   delete[] data;
@@ -637,6 +711,7 @@
 {
   if (IframeAssembler.Used()) {
      DEBUG("push i-frame: %d\n", IframeAssembler.Used());
+     fprintf(stderr, "push i-frame: %d\n", IframeAssembler.Used());
      for (int i = 0; i <= 400000 / IframeAssembler.Used(); i++)
        putFrame(IframeAssembler.Get());
   }
@@ -742,9 +817,12 @@
                   */
 
                  if (playDir == pdForward) {
-		    if (stillFrame && i_dsi.vobu_sri.next_video == 0xbfffffff)
+		     if (stillFrame && i_dsi.vobu_sri.next_video == 0xbfffffff) {
+			 fprintf(stderr, "SendIFrame 1\n");
 		       SendIframe();
+		     }
                     if (cur_pack >= cell->last_sector) {
+			 fprintf(stderr, "SendIFrame 2\n");
 		       SendIframe();
 		       if (cell->still_time != 0) {
 			  int still_time = cell->still_time == 0xff ?
===== dvd.h 1.7 vs edited =====
--- 1.7/dvd.h	Mon Apr  1 14:37:08 2002
+++ edited/dvd.h	Sat Apr 27 22:20:43 2002
@@ -36,6 +36,9 @@
   dvd_read_domain_t dvd_file_dom;
   int dvd_file_num;
 
+  static unsigned long readahead;
+  static unsigned long freadahead;
+  
   static int Command(int Cmd);
 public:
   cDVD(void);
@@ -59,6 +62,10 @@
 
   static cDVD *getDVD(void);
   int getAudioTrack(int stream);
+
+  static void storeParam();
+  static void setDVDParam();
+  static void restoreParam();
   };
 
 class cIframeAssembler {




Home | Main Index | Thread Index