kim42083 / webm

Automatically exported from code.google.com/p/webm
0 stars 0 forks source link

SIGFBE in encoder after upgrade to 0.9.7 #359

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,
after upgrading libvpx to 0.9.7 there's a SIGFPE happening always when using 
libvpx through the GStreamer element.

Program received signal SIGFPE, Arithmetic exception.
[Switching to Thread 0x7ffff5c91700 (LWP 9560)]
0x00007ffff5f128bf in update_buffer_level (cpi=0x7ffff542a020)
    at /tmp/buildd/libvpx-0.9.7/vp8/encoder/onyx_if.c:3250
3250    /tmp/buildd/libvpx-0.9.7/vp8/encoder/onyx_if.c: No such file or directory.
    in /tmp/buildd/libvpx-0.9.7/vp8/encoder/onyx_if.c
(gdb) bt
#0  0x00007ffff5f128bf in update_buffer_level (cpi=0x7ffff542a020)
    at /tmp/buildd/libvpx-0.9.7/vp8/encoder/onyx_if.c:3250
#1  encode_frame_to_data_rate (cpi=0x7ffff542a020, size=0x7ffff5c90ac0, 
    dest=0x7ffff5458010 "\320D", frame_flags=0x7ffff5c90ad0)
    at /tmp/buildd/libvpx-0.9.7/vp8/encoder/onyx_if.c:4367
#2  0x00007ffff5f14cb1 in vp8_get_compressed_data (ptr=0x7ffff542a020, 
    frame_flags=0x7ffff5c90ad0, size=0x7ffff5c90ac0, 
    dest=0x7ffff5458010 "\320D", time_stamp=<optimized out>, 
    time_end=<optimized out>, flush=0)
    at /tmp/buildd/libvpx-0.9.7/vp8/encoder/onyx_if.c:4927
#3  0x00007ffff5ef0f9b in vp8e_encode (ctx=0x871400, img=0x874270, 
    pts=<optimized out>, duration=<optimized out>, flags=<optimized out>, 
    deadline=<optimized out>)
    at /tmp/buildd/libvpx-0.9.7/vp8/vp8_cx_iface.c:767
#4  0x00007ffff5ed830f in vpx_codec_encode (ctx=0x86a360, img=<optimized out>, 
    pts=<optimized out>, duration=<optimized out>, flags=<optimized out>, 
    deadline=<optimized out>)
    at /tmp/buildd/libvpx-0.9.7/vpx/src/vpx_encoder.c:140
#5  0x00007ffff67e8981 in gst_vp8_enc_handle_frame (
    base_video_encoder=0x86a020, frame=0x86ff70) at gstvp8enc.c:817
#6  0x00007ffff65b63f2 in gst_base_video_encoder_chain (pad=<optimized out>, 
    buf=0x874b00) at gstbasevideoencoder.c:423
#7  0x00007ffff7d4ae8c in gst_pad_push (pad=0x868000, buffer=0x874b00)

#8  0x00007ffff6c8dc78 in gst_base_src_loop (pad=0x868000) at gstbasesrc.c:2516
#9  0x00007ffff7d71420 in gst_task_func (task=0x8760b0) at gsttask.c:318
#10 0x0000003c5106f3e4 in g_thread_pool_thread_proxy (data=<optimized out>)
    at /tmp/buildd/glib2.0-2.28.6/./glib/gthreadpool.c:319
#11 0x0000003c5106ccf6 in g_thread_create_proxy (data=0x82aae0)
    at /tmp/buildd/glib2.0-2.28.6/./glib/gthread.c:1897
#12 0x0000003c50006b40 in start_thread (arg=<optimized out>)
    at pthread_create.c:304
#13 0x0000003c4f8d536d in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#14 0x0000000000000000 in ?? ()

Original issue reported on code.google.com by sl...@coaxion.net on 12 Aug 2011 at 7:43

GoogleCodeExporter commented 9 years ago

Original comment by iss...@webmproject.org on 12 Aug 2011 at 7:50

GoogleCodeExporter commented 9 years ago
Hello,

As shown in backtrace, this issue is due to a division by zero in function 
'update_buffer_level' in file 'vp8/encoder/onyx_if.c' line 3250 :
  "    cpi->buffered_av_per_frame_bandwidth = tmp
                                           / cpi->oxcf.maximum_buffer_size;"
'update_buffer_level' function is new compared to version 0.9.6.

This value comes from 'bitrate' parameter on 'vp8enc' GStreamer element.
By passing a non-zero value to 'bitrate', this issue doesn't appear anymore.

Default initialization of the 'maximum_buffer_size' parameter is done into file 
'vp8/vp8_cx_iface.c' :
Line 1129 : default value of 'cfg->rc_buf_sz' is 6000
Line 320  : default value of 'oxcf->maximum_buffer_size' is set to 
'cfg->rc_buf_sz'
Line 309  : default value of 'oxcf->target_bandwidth' is set to 
'cfg->rc_target_bitrate'

Use of 'maximum_buffer_size' parameter is done into file 
'vp8/encoder/onyx_if.c' :
Line 1623 (if cpi->oxcf.end_usage == USAGE_LOCAL_FILE_PLAYBACK): 
'cpi->oxcf.maximum_buffer_size' grows to 240000
Line 1644 : cpi->oxcf.maximum_buffer_size = 
rescale(cpi->oxcf.maximum_buffer_size, cpi->oxcf.target_bandwidth, 1000);
With rescale (a, b, c) = (a * b) / c, at that moment, 
'cpi->oxcf.maximum_buffer_size' is equal to zero.

As a result, in file 'vp8/encoder/onyx_if.c' line 3250, 
"cpi->oxcf.maximum_buffer_size" is equals to zero that results a division by 
zero.

Original comment by sestegra on 13 Aug 2011 at 5:09

GoogleCodeExporter commented 9 years ago
Which bitrate should be set instead of 0 if only the min/max quantizer settings 
should be taken into account and no bitrate should be targeted?

Original comment by sl...@coaxion.net on 15 Aug 2011 at 6:23

GoogleCodeExporter commented 9 years ago
Offending code was removed in v0.9.7-p1 release.

Original comment by slavarn...@google.com on 16 Aug 2011 at 1:20