On 23.03.2009 08:35, Klaus Schmidinger wrote:
> On 23.03.2009 01:09, Niedermeier Günter wrote:
>>> There must be an other problem that's causing this, but since this doesn't
>>> happen here on my system, I'm afraid you'll need to do the debugging ;-)
>> Which changes have been made between 1.7.2 and 1.7.3 in
>> file writing mechanism?
>>
>> Not codechanges, because I dont understand them, but in words please.
>> E.g. blocksize changed from xxx to yyy changed algo. changed cache or
>> something else which can influence the performance.
>>
>> I found out, that in 172 the most time up to 20 stream data blocks are
>> transmitted via NFS between one "NFS WRITE CALL / WRITE REPLAY" and
>> "NFS COMMIT CALL / COMMIT REPLAY" combination and the next one.
>>
>> In 173/174 the number of stream data blocks decreases to an amount of
>> 5 blocks maximal. Therefor the number of "NFS WRITE CALL / WRITE REPLAY"
>> and "NFS COMMIT CALL / COMMIT REPLAY" combinations increases up to
>> 4 to 5 times higher than in 172.
>>
>> This produces an enormous overhead, and this overhead could be
>> reasonable for the two MegaByte/s networkoverload above the normal
>> load with 1 MB/s per stream.
>>
>> Perhaps Klaus, you have an idea.
> 
> I believe I do. With PES recordings, data was written to the file
> in larger chunks, while with TS recordings it is written in blocks
> of 188 byte (TS_SIZE). I'll chnage cFrameDetector::Analyze() to
> handle more data at once.
> Will try to provide a patch for testing tonight.

Here's a quick shot - totally untested (no time, sorry).
Please try it and let me know if it helps.

Klaus
--- remux-0.c	2009-03-23 16:54:18.000000000 +0100
+++ remux-1.c	2009-03-23 16:54:50.000000000 +0100
@@ -672,8 +672,9 @@
 
 int cFrameDetector::Analyze(const uchar *Data, int Length)
 {
+  int Processed = 0;
   newFrame = independentFrame = false;
-  if (Length >= TS_SIZE) {
+  while (Length >= TS_SIZE) {
      if (TsHasPayload(Data) && !TsIsScrambled(Data) && TsPid(Data) == pid) {
         if (TsPayloadStart(Data)) {
            if (!frameDuration) {
@@ -718,11 +719,12 @@
                  case 0x02: // MPEG 2 video
                       if (scanner == 0x00000100) { // Picture Start Code
                          if (frameDuration) {
+                            if (Processed)
+                               return Processed;
                             newFrame = true;
                             independentFrame = ((Data[i + 2] >> 3) & 0x07) == 1; // I-Frame
                             if (framesPerPayloadUnit == 1) {
                                scanning = false;
-                               return TS_SIZE;
                                }
                             }
                          else {
@@ -735,11 +737,12 @@
                  case 0x1B: // MPEG 4 video
                       if (scanner == 0x00000109) { // Access Unit Delimiter
                          if (frameDuration) {
+                            if (Processed)
+                               return Processed;
                             newFrame = true;
                             independentFrame = Data[i + 1] == 0x10;
                             if (framesPerPayloadUnit == 1) {
                                scanning = false;
-                               return TS_SIZE;
                                }
                             }
                          else {
@@ -752,6 +755,8 @@
                  case 0x04: // MPEG audio
                  case 0x06: // AC3 audio
                       if (frameDuration) {
+                         if (Processed)
+                            return Processed;
                          newFrame = true;
                          independentFrame = true;
                          scanning = false;
@@ -765,7 +770,8 @@
                }
            }
         }
-     return TS_SIZE;
+     Length -= TS_SIZE;
+     Processed += TS_SIZE;
      }
-  return 0;
+  return Processed;
 }
_______________________________________________
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

Reply via email to