[vdr] VDR 1.7 FreeBSD segfault when cutting recordings

Gerhard Brauer gb+ML-2011 at derbrauer.homelinux.net
Mon Mar 18 08:41:00 CET 2013


On Sun, Mar 17, 2013 at 09:52:46PM +0100, Juergen Lock wrote:
> >
> Ok I looked at cutter.c again and now I think I found the cause:
> Linux must default to bigger thread stacks than FreeBSD, FreeBSD's
> default seems to be 2 MB on amd64 and MAXFRAMESIZE is almost 1 MB...
> Try the patch below, you can put it in files/patch-z-cutter.c
> in the port dir. (the thread.c part is FreeBSD port specific, it
> caused a different crash with --edit.)

Hello!
Thanks for the patch and your time, i think we're on the way ;-)

The cutting process now works without segfaulting or unbehavior exit
of the vdr process itself - but during cutting i got A LOT of "frame
larger than buffer" x greater then 8 (8 is fix in all messages).
-----------
Mar 18 08:30:12 s01 vdr: [50364416] ERROR: frame larger than buffer (17392 > 8)
Mar 18 08:30:12 s01 vdr: [50364416] ERROR: frame larger than buffer (17514 > 8)
Mar 18 08:30:12 s01 vdr: [50364416] video cutting thread ended (pid=33513, tid=50364416)
Mar 18 08:30:13 s01 vdr: [50361344] info: Schnitt beendet
-----------
The cutting ends now always normally.

The cutted recording itself seems to be corrupted. When trying to
play it i got "incomplete PES packet":
-----------
Mar 18 08:23:05 s01 vdr: [54684672] receiver on device 1 thread ended (pid=33513, tid=54684672)
Mar 18 08:23:05 s01 vdr: [50363392] ERROR: incomplete PES packet!
Mar 18 08:23:11 s01 last message repeated 87971 times
-------------
until i stop playing the cutted video.

Same errors when doing it without a frontend/OSD from Terminal with
--edit and -i1. 

> 
>  HTH, :)
> 	Juergen

Regards and TIA
        Gerhard

> 
> --- cutter.c.orig
> +++ cutter.c
> @@ -83,7 +83,18 @@ void cCuttingThread::Action(void)
>       int LastIFrame = 0;
>       toMarks.Add(0);
>       toMarks.Save();
> +#ifdef __FreeBSD__
> +     // XXX save thread stack space
> +     uchar *buffer = MALLOC(uchar, MAXFRAMESIZE);
> +     uchar *buffer2 = MALLOC(uchar, MAXFRAMESIZE);
> +     if (buffer == NULL || buffer2 == NULL) {
> +        free(buffer);
> +        error = "malloc";
> +        return;
> +        }
> +#else
>       uchar buffer[MAXFRAMESIZE], buffer2[MAXFRAMESIZE];
> +#endif
>       int Length2;
>       bool CheckForSeamlessStream = false;
>       bool LastMark = false;
> @@ -216,6 +227,10 @@ void cCuttingThread::Action(void)
>                }
>             }
>       Recordings.TouchUpdate();
> +#ifdef __FreeBSD__
> +     free(buffer);
> +     free(buffer2);
> +#endif
>       }
>    else
>       esyslog("no editing marks found!");
> --- thread.c.orig
> +++ thread.c
> @@ -242,7 +242,7 @@ void cThread::SetPriority(int Priority)
>  void cThread::SetIOPriority(int Priority)
>  {
>  #ifdef __FreeBSD__
> -  esyslog("ERROR: syscall(SYS_ioprio_set ...) unsupported on FreeBSD");
> +  // esyslog("ERROR: syscall(SYS_ioprio_set ...) unsupported on FreeBSD");
>  #else
>    if (syscall(SYS_ioprio_set, 1, 0, (Priority & 0xff) | (2 << 13)) < 0) // best effort class
>       LOG_ERROR;



More information about the vdr mailing list