Re: A problem with H.264 video (DVB-T)

Christophe Thommeret <[email protected]>
Newsgroups gmane.comp.video.xine.user
Message-ID <[email protected]>
Le Sunday 02 November 2008 14:29:20 Pavel Troller, vous avez écrit :
> > > Le Saturday 01 November 2008 05:22:55 Pavel Troller, vous avez écrit :
> > > > Hi!
> > > >   I have the following problem with playing H.264 (MPEG4) video from
> > > > DVB-T stream:
> > > >   When the channel is tuned, the video is played perfectly, without
> > > > any problems. However, about 30 - 60 seconds later, the video starts
> > > > to skip. At first, it stops momentarily and then skips the missing
> > > > frames for about every 2 - 3 seconds, so it is very annoying (it
> > > > still plays smoothly between the skips, every skip takes about 200
> > > > ms). The skip intervals decrease by the time, and of course also the
> > > > difference between picture contents before and after the skip. After
> > > > about a minute, it skips very often with very short skips, so it
> > > > looks as a low framerate (about 10 fps). This is the final state, it
> > > > continues to play this way until the channel is re-tuned, which
> > > > resumes smooth playing for the next 30 - 60 seconds and then it
> > > > repeats the whole process.
> > > >   The sound is played continuously, no skips, and it keeps
> > > > approximately in sync with the video.
> > > >   This is not a CPU performance problem - CPU load doesn't hit 1.00
> > > > and it is a dualcore machine, so there is a big reserve in the CPU
> > > > power. Using kaffeine as a frontend. Formerly used xine-lib-1.1.15
> > > > and ffmpeg svn from the beginning of September, now tried with
> > > > current hg snapshot of xine-lib and svn snapshot of ffmpeg. Still the
> > > > same. I've been also playing extensively with various xine engine
> > > > settings (quality of postprocessing, deinterlacer type, codecs
> > > > priority etc.), and it didn't influence anything, the problem appears
> > > > always in the same manner.
> > > >   There isn't any debug/error output from xine-lib/ffmpeg.
> > > >   Any help, what to fix ?
> > > >     With regards, Pavel Troller
> > >
> > > Could you provide a sample?
> >
> > I'm afraid not. I've recorded about 5 minutes of the HD stream, which
> > played poorly from the air, but I've found that the recording plays
> > smoothly all the time, with no problems at all! So I'm not able to
> > reproduce the problem from a file, just direct playing from the DVB-T
> > device is causing troubles, captured file is good and can be played
> > without problems.
>
> Hi!
>   I've found that I can play HD streams forever with no skipping - it's
> just enough to activate the time shift feature for a second or two, and it
> plays the stream, buffered by the time shift file, perfectly. It's the
> definitive evidence that this problem is not caused by lack of CPU power -
> in this mode, the system is loaded more than when just playing from the DVB
> device, because it has to write the time shift file and play it back
> simultaneously. The only thing I have to remember, is to erase the time
> shift file manually (I didn't find an option in kaffeine to erase it
> automatically).
>   I've tried to change number of video buffers and frames in the xine
> engine settings, and it doesn't influence anything, the problem appears in
> approximately the same time for 500 buffers as well as for 4000.
>   WIth regards, Pavel Troller

Hm, interesting.
So it could be a ringbuffer issue.

Could you please try the following:

- Apply the joined patch to current kaffeine svn and make install
- Start kaffeine from a term, play live HD and look at the output for "WDIST = 
XXX" msg.
- If you see this message (could repeat a lot), edit dvbout.cpp and change the 
value of WDISTSIZE in: #define WDISTSIZE 100
Increase the value until you stop seeing the msg.

Lemme know if it fixes your problem.

P.S.
the ringbuffer size is: 188*64*WDISTSIZE bytes

-- 
Christophe Thommeret

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

_______________________________________________
xine-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xine-user
kaffeine-live_ringbuffer.diff (text/x-diff, 1.3 KB)
Index: src/input/dvb/dvbout.cpp
===================================================================
--- src/input/dvb/dvbout.cpp	(révision 879194)
+++ src/input/dvb/dvbout.cpp	(copie de travail)
@@ -27,6 +27,8 @@
 
 #define NTS 64
 
+#define WBUFSIZE 100
+
 DVBout::DVBout( ChannelDesc chan, int anum, int tnum, KaffeineDvbPlugin *p )
 {
 	bool bok;
@@ -299,7 +301,7 @@
 	writePmt();
 	if ( !pids.contains(8192) )
 		patpmt = wpatpmt = true;
-	wBuf = new unsigned char[TS_SIZE*NTS*100];
+	wBuf = new unsigned char[TS_SIZE*NTS*WBUFSIZE];
 	if ( !wBuf ) fprintf( stderr, "\nNO WBUF !!!\n\n" );
 	wRead = wWrite = wDist = 0;
 	start();
@@ -469,15 +471,16 @@
 						beginLive = !beginLive;
 						start();
 					}
-					if ( wDist<95 ) {
+					if ( wDist<WBUFSIZE ) {
 						memcpy( wBuf+(wWrite*TS_SIZE*NTS), thBuf, TS_SIZE*NTS );
 						wpatpmt = patpmt;
 						++wDist;
 						++wWrite;
-						if ( wWrite>99 )
+						if ( wWrite==WBUFSIZE )
 							wWrite = 0;
-						//fprintf(stderr,"WDIST = %d\n",wDist);
 					}
+					else
+						fprintf(stderr,"WDIST = %d\n",wDist);
 				}
 				else if ( timeShifting ) {
 					if ( patpmt ) {
@@ -540,7 +543,7 @@
 				write( fdPipe, wBuf+(wRead*TS_SIZE*NTS), TS_SIZE*NTS );
 				--wDist;
 				++wRead;
-				if ( wRead>99 )
+				if ( wRead==WBUFSIZE )
 					wRead = 0;
 			}
 			else
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.