[vdr] [PATCH] softdevice segfaulting on stream errors

Artur Skawina art_k at o2.pl
Tue Jul 10 16:20:51 CEST 2007


Some time ago the softdevice plugin started crashing when playing video streams
containing errors, both while live viewing and watching recordings.
Today I found a transponder where it reliably occurred within seconds and decided
to investigate. The picture buffers used for video were 8-byte aligned, which
happened to work for "normal" mpeg decoding, but wasn't enough. ffmpeg was
executing SSE instructions when doing error concealment and those were segfaulting.
Fix below.

artur


diff -uwp softdevice.noalign/PicBuffer.c softdevice/PicBuffer.c
--- softdevice.noalign/PicBuffer.c      2007-03-13 02:57:19.000000000 +0100
+++ softdevice/PicBuffer.c      2007-07-10 15:25:38.000000000 +0200
@@ -316,9 +316,8 @@ bool AllocatePicBuffer(sPicBuffer *buf,P

         if ( !isPlanar(pix_fmt) ) {
                 buf->stride[0]=ALIGN(pixel_size*w,16);
-                buf->pixel[0]=(uint8_t*)malloc((buf->stride[0]*h)+16);

-                if (buf->pixel[0]==NULL) {
+                if (posix_memalign(&buf->pixel[0], 16, buf->stride[0]*h+16)) {
                     printf("could not allocate memory for picture buffer!\n") ;
                     exit(-1);
                     return false;
@@ -337,9 +336,7 @@ bool AllocatePicBuffer(sPicBuffer *buf,P
             buf->stride[i]= ALIGN(pixel_size*w>>h_shift,
                             STRIDE_ALIGN<<(h_chroma_shift-h_shift));

-            buf->pixel[i]= (uint8_t*)malloc((buf->stride[i]*h>>v_shift)+16); //FIXME 16
-
-            if(buf->pixel[i]==NULL) {
+            if(posix_memalign(&buf->pixel[i], 16, (buf->stride[i]*h>>v_shift)+16)) { //FIXME 16
                     printf("could not allocate memory for picture buffer!\n") ;
                     exit(-1);
                     return false;





More information about the vdr mailing list