vdr-2.0.6 crashes at recording start with divide error

Message ID 543AA14F.2090207@tvdr.de
State New
Headers

Commit Message

Klaus Schmidinger Oct. 12, 2014, 3:42 p.m. UTC
  On 12.10.2014 16:30, Chris Mayo wrote:
> I occasionally see vdr crashing when a recording starts like this:
>
> kernel: traps: recording[352] trap divide error ip:4cfeff sp:7fc8e9523e00 error:0 in vdr[400000+156000]
> runvdr[300]: Floating point exception
>
> $ gdb /usr/bin/vdr
> (gdb) disass /m 0x4cfeff
>
> 1514	in remux.c
>     0x00000000004cfee6 <+870>:	mov    0x290(%rbx),%rsi
>     0x00000000004cfeed <+877>:	xor    %edx,%edx
>     0x00000000004cfeef <+879>:	mov    0x284(%rbx),%ecx
>     0x00000000004cfef5 <+885>:	mov    0xc(%rbx),%eax
>     0x00000000004cfefc <+892>:	add    0xc(%rsi),%ecx
>     0x00000000004cfeff <+895>:	div    %ecx
>     0x00000000004cff08 <+904>:	mov    %eax,%ecx
>
> Point to this in remux.c?
> 1514: uint32_t Delta = ptsValues[0] / (framesPerPayloadUnit +  parser->IFrameTemporalReferenceOffset());

This should fix it:


Klaus
  

Comments

Chris Mayo Oct. 12, 2014, 7:11 p.m. UTC | #1
On 12/10/14 16:42, Klaus Schmidinger wrote:
> On 12.10.2014 16:30, Chris Mayo wrote:
>> I occasionally see vdr crashing when a recording starts like this:
>>
>> kernel: traps: recording[352] trap divide error ip:4cfeff sp:7fc8e9523e00 error:0 in vdr[400000+156000]
>> runvdr[300]: Floating point exception
>>
>> $ gdb /usr/bin/vdr
>> (gdb) disass /m 0x4cfeff
>>
>> 1514    in remux.c
>>     0x00000000004cfee6 <+870>:    mov    0x290(%rbx),%rsi
>>     0x00000000004cfeed <+877>:    xor    %edx,%edx
>>     0x00000000004cfeef <+879>:    mov    0x284(%rbx),%ecx
>>     0x00000000004cfef5 <+885>:    mov    0xc(%rbx),%eax
>>     0x00000000004cfefc <+892>:    add    0xc(%rsi),%ecx
>>     0x00000000004cfeff <+895>:    div    %ecx
>>     0x00000000004cff08 <+904>:    mov    %eax,%ecx
>>
>> Point to this in remux.c?
>> 1514: uint32_t Delta = ptsValues[0] / (framesPerPayloadUnit +  parser->IFrameTemporalReferenceOffset());
> 
> This should fix it:
> 
> --- remux.c     2014/03/08 15:10:24     2.75.1.5
> +++ remux.c     2014/04/13 13:59:21     2.75.1.6
> @@ -1511,7 +1511,12 @@
>                         for (int i = 0; i < numPtsValues; i++)
>                             ptsValues[i] = ptsValues[i + 1] - ptsValues[i];
>                         qsort(ptsValues, numPtsValues, sizeof(uint32_t), CmpUint32);
> -                       uint32_t Delta = ptsValues[0] / (framesPerPayloadUnit +  parser->IFrameTemporalReferenceOffset());
> +                       int Div = framesPerPayloadUnit;
> +                       if (framesPerPayloadUnit > 1)
> +                          Div += parser->IFrameTemporalReferenceOffset();
> +                       if (Div <= 0)
> +                          Div = 1;
> +                       uint32_t Delta = ptsValues[0] / Div;
>                         // determine frame info:
>                         if (isVideo) {
>                            if (abs(Delta - 3600) <= 1)
> 
> Klaus
> 

Many thanks. Patch applied. Will take at least a few weeks to be confident of a difference.

I guess I should have googled the line of code,
http://www.vdr-portal.de/board17-developer/board97-vdr-core/p1194836-frameratenerkennung-ab-version-2-0-6/

Chris
  

Patch

--- remux.c     2014/03/08 15:10:24     2.75.1.5
+++ remux.c     2014/04/13 13:59:21     2.75.1.6
@@ -1511,7 +1511,12 @@ 
                         for (int i = 0; i < numPtsValues; i++)
                             ptsValues[i] = ptsValues[i + 1] - ptsValues[i];
                         qsort(ptsValues, numPtsValues, sizeof(uint32_t), CmpUint32);
-                       uint32_t Delta = ptsValues[0] / (framesPerPayloadUnit +  parser->IFrameTemporalReferenceOffset());
+                       int Div = framesPerPayloadUnit;
+                       if (framesPerPayloadUnit > 1)
+                          Div += parser->IFrameTemporalReferenceOffset();
+                       if (Div <= 0)
+                          Div = 1;
+                       uint32_t Delta = ptsValues[0] / Div;
                         // determine frame info:
                         if (isVideo) {
                            if (abs(Delta - 3600) <= 1)