[MEncoder-users] tvi_v4l2.c

Vladimir V. Petrukhin vovka at dec1.sinp.msu.ru
Mon Sep 22 07:13:11 CEST 2008


Unnecessary death of mencoder is caused by two procedures in stream/tvi_v4l2.c, athough
the normal (or about normal) continue of work is possible. When I change two listed below
code fragments to become commented or handled more carefully, I can take needed resulting
output file.

It is strange also, that mencoder downs with error "Floating point exception", but all three
guilty divisions are of integer nature.

Now the first fail place:
 from /var/log/messages:
  mencoder[13416] trap divide error ip:5e8a75 sp:7fff012839c0 error:0 in mencoder[400000+749000]

disassembled location:
  5e8a70:       8d 04 40                lea    eax,[rax+rax*2]
  5e8a73:       31 d2                   xor    edx,edx
  5e8a75:       41 f7 b4 24 c0 01 00    div    DWORD PTR [r12+0x1c0]

corresponding chunk of stream/tvi_v4l2.c/static in start(priv_t *priv)
    /* setup video parameters */
    if (!priv->tv_param->noaudio) {
        if (priv->video_buffer_size_max < (3*priv->standard.frameperiod.denominator) /
                                               priv->standard.frameperiod.numerator
            *priv->audio_secs_per_block) {
            mp_msg(MSGT_TV, MSGL_ERR, "Video buffer shorter than 3 times audio frame duration.\n"
                   "You will probably experience heavy framedrops.\n");
        }
    }


Then I comment a part of chunk above, and mencoder dies again, but now produces resulting
output file.

from /var/log/messages:
 mencoder[12779] trap divide error ip:5e736a sp:7fff55204b30 error:0 in mencoder[400000+749000]

disassembled location:
  5e7361:       8d 44 c5 00             lea    eax,[rbp+rax*8+0x0]
  5e7365:       c1 e0 05                shl    eax,0x5
  5e7368:       31 d2                   xor    edx,edx
  5e736a:       41 f7 f5                div    r13d
  5e736d:       89 c0                   mov    eax,eax
  5e736f:       49 8d 0c 06             lea    rcx,[r14+rax]
  5e7373:       44 89 ea                mov    edx,r13d
  5e7376:       48 0f af ca             imul   rcx,rdx
  5e737a:       89 ea                   mov    edx,ebp
  5e737c:       48 89 c8                mov    rax,rcx
  5e737f:       48 89 d3                mov    rbx,rdx
  5e7382:       48 99                   cqo
  5e7384:       48 f7 fb                idiv   rbx
  5e7387:       48 89 c6                mov    rsi,rax

corresponding chunk of stream/tvi_v4l2.c/static int uninit(priv_t *priv)
       /* get performance */
        frames = 1 + (priv->curr_frame - priv->first_frame +
                      priv->standard.frameperiod.numerator * 500000 /
                      priv->standard.frameperiod.denominator) *
            priv->standard.frameperiod.denominator /
            priv->standard.frameperiod.numerator / 1000000;




More information about the MEncoder-users mailing list