[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/extragear/kde3/multimedia/kaffeine/src/input/dvb
From:       Christophe Thommeret <hftom () free ! fr>
Date:       2008-12-27 15:14:22
Message-ID: 1230390862.648505.1750.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 902079 by thommeret:

remove liveringbuffer mutex

 M  +4 -2      dvbconfig.cpp  
 M  +2 -7      dvbout.cpp  
 M  +2 -2      dvbout.h  


--- branches/extragear/kde3/multimedia/kaffeine/src/input/dvb/dvbconfig.cpp #902078:902079
@@ -486,7 +486,9 @@
 		devList.at(i)->usalsLatitude = usalsLatitude;
 		devList.at(i)->usalsLongitude = usalsLongitude;
 	}
-	ringBufSize = config->readNumEntry( "RingBufSize", 1 );
+	ringBufSize = config->readNumEntry( "RingBufSize", 2 );
+	if ( ringBufSize<2 )
+		ringBufSize = 2;
 }
 
 
@@ -942,7 +944,7 @@
 	
 	lab = new QLabel( i18n("LiveShow ringbuffer size (MB) :"), gb );
 	grid->addWidget( lab, 1, 0 );
-	ringBufSize = new QSpinBox( 0, 99, 1, gb );
+	ringBufSize = new QSpinBox( 2, 99, 1, gb );
 	ringBufSize->setValue( dvbConfig->ringBufSize );
 	grid->addWidget( ringBufSize, 1, 1 );
 
--- branches/extragear/kde3/multimedia/kaffeine/src/input/dvb/dvbout.cpp #902078:902079
@@ -299,6 +299,7 @@
 	if ( !pids.contains(8192) )
 		patpmt = wpatpmt = true;
 	wbufSize = ringBufSize*1024*1024/(TS_SIZE*NTS);
+	wbufLimit = wbufSize-10;
 	wBuf = new unsigned char[TS_SIZE*NTS*wbufSize];
 	if ( !wBuf ) fprintf( stderr, "\nNO WBUF !!!\n\n" );
 	wRead = wWrite = wDist = 0;
@@ -469,18 +470,15 @@
 						beginLive = !beginLive;
 						start();
 					}
-					ringMutex.lock();
-					if ( wDist<wbufSize ) {
+					if ( wDist<wbufLimit ) {
 						memcpy( wBuf+(wWrite*TS_SIZE*NTS), thBuf, TS_SIZE*NTS );
 						wpatpmt = patpmt;
 						++wDist;
 						++wWrite;
 						if ( wWrite==wbufSize )
 							wWrite = 0;
-						ringMutex.unlock();
 					}
 					else {
-						ringMutex.unlock();
 						fprintf(stderr,"Live ringbuffer full!! (%d)\n",wDist);
 					}
 				}
@@ -536,7 +534,6 @@
 {
 	if ( haveLive && fdPipe ) {
 		while ( haveLive && fdPipe ) {
-			ringMutex.lock();
 			if ( wDist>0 ) {
 				if ( wpatpmt ) {
 					write( fdPipe, tspat, TS_SIZE );
@@ -548,10 +545,8 @@
 				++wRead;
 				if ( wRead==wbufSize )
 					wRead = 0;
-				ringMutex.unlock();
 			}
 			else {
-				ringMutex.unlock();
 				usleep( 100 );
 			}
 		}
--- branches/extragear/kde3/multimedia/kaffeine/src/input/dvb/dvbout.h #902078:902079
@@ -95,14 +95,14 @@
 	bool beginLive;
 	bool haveRec, haveLive, instantRec, haveBroadcast;
 	QTimer stopRecTimer, timerPatPmt;
-	QMutex mutex, ringMutex;
+	QMutex mutex;
 	KaffeineDvbPlugin *plug;
 	void *plugHandle;
 
 	int fileNumber;
 	QString fileName;
 	long long int fileMaxSize;
-	int wbufSize;
+	int wbufSize, wbufLimit;
 
 signals:
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic