From patchwork Tue Jul 10 14:20:51 2007 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Skawina X-Patchwork-Id: 12489 Received: from mx10.go2.pl ([193.17.41.74] helo=poczta.o2.pl) by www.linuxtv.org with esmtp (Exim 4.63) (envelope-from ) id 1I8Gak-0005aC-K6 for vdr@linuxtv.org; Tue, 10 Jul 2007 16:21:26 +0200 Received: from poczta.o2.pl (mx10.go2.pl [127.0.0.1]) by poczta.o2.pl (Postfix) with ESMTP id A62E858092 for ; Tue, 10 Jul 2007 16:20:55 +0200 (CEST) Received: from dkk114.neoplus.adsl.tpnet.pl (dkk114.neoplus.adsl.tpnet.pl [83.24.14.114]) by poczta.o2.pl (Postfix) with ESMTP for ; Tue, 10 Jul 2007 16:20:55 +0200 (CEST) Received: (qmail 8505 invoked from network); 10 Jul 2007 14:20:52 -0000 Received: from unknown (HELO ?172.19.43.221?) (172.19.43.221) by 172.19.43.250 with SMTP; 10 Jul 2007 14:20:52 -0000 Message-ID: <469395C3.4010507@o2.pl> Date: Tue, 10 Jul 2007 16:20:51 +0200 From: Artur Skawina User-Agent: Thunderbird 3.0a1 (X11/20070320) MIME-Version: 1.0 To: VDR Mailing List X-Enigmail-Version: 0.95b Cc: softdevice-devel@lists.berlios.de Subject: [vdr] [PATCH] softdevice segfaulting on stream errors X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.9 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jul 2007 14:21:26 -0000 Status: O X-Status: X-Keywords: X-UID: 13511 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;