[vdr] Problem with xineliboutput

Jose Alberto Reguero jareguero at telefonica.net
Thu Sep 7 13:19:11 CEST 2006


El Martes, 5 de Septiembre de 2006 18:15, Jose Alberto Reguero escribió:
> El Martes, 5 de Septiembre de 2006 13:46, Jose Alberto Reguero escribió:
> > I have a problem with xineliboutput (latest cvs).
> > When the client vdr-sxfe crash, X freeze and I must to harware reset.
> > It can be reproduce by presing control-c when playing vdr-sxfe.
> > I dont now if it is a prolem of vdr-sxfe or of the X drivers(Xorg 7.1 +
> > nvidia)
>
> It is xineliboutput. I go back to version 1.0.0pre1 and no problems.
>

The change that cause the problem is this one made 24 Aug 2006:

 void cXinelibServer::Read_Control(int cli)
 {
-  int n = read(fd_control[cli], 
-	       &m_CtrlBuf[ cli ][ m_CtrlBufPos[cli] ], 
-	       90 - m_CtrlBufPos[cli]);
-  if(n<=0) {
-    LOGMSG("Client connection %d closed", cli);
-    CloseConnection(cli);
-    return;
-  } 
+  while(read(fd_control[cli], &m_CtrlBuf[ cli ][ m_CtrlBufPos[cli] ], 1) == 
1) {
 
-  char *pt;
-  m_CtrlBufPos[cli] += n;
-  m_CtrlBuf[cli][m_CtrlBufPos[cli]] = 0;
-  while(NULL != (pt=strstr(m_CtrlBuf[cli], "\r\n"))) {
-    *pt = 0;
-    Handle_Control(cli, m_CtrlBuf[cli]);
-    strcpy(m_CtrlBuf[cli], pt + 2);
-  }
-  m_CtrlBufPos[cli] = strlen(m_CtrlBuf[cli]);
+    ++m_CtrlBufPos[cli];
 
-  if(m_CtrlBufPos[cli]>=80) {
-    LOGMSG("Received too long control message from client %d", cli);
-    CloseConnection(cli);
+    if( m_CtrlBufPos[cli] > 79) {
+      LOGMSG("Received too long control message from client %d (%d bytes)", 
+	     cli, m_CtrlBufPos[cli]);
+      LOGMSG("%81s",m_CtrlBuf[cli]);
+      CloseConnection(cli);
+      return;
+    }
+
+    if( m_CtrlBufPos[cli] > 2 &&
+	m_CtrlBuf[ cli ][ m_CtrlBufPos[cli] - 2 ] == '\r' &&
+	m_CtrlBuf[ cli ][ m_CtrlBufPos[cli] - 1 ] == '\n') {
+
+      m_CtrlBufPos[cli] -= 2;
+      m_CtrlBuf[ cli ][ m_CtrlBufPos[cli] ] = 0;
+
+      Handle_Control(cli, m_CtrlBuf[cli]);
+
+      m_CtrlBufPos[cli] = 0;
+    }
   }
 }
 
Reverting this patch, last cvs code work well for me.

Jose Alberto



More information about the vdr mailing list