shithub: libvpx

Download patch

ref: e8b818b581b9ab7e9c8f7b1becd753dd4efbdf43
parent: 2d0f3b23a908bb54dbeddf6d1dcc666600470e2e
author: Jorge E. Moreira <[email protected]>
date: Fri May 8 11:14:48 EDT 2020

Don't collect stats if they won't be used

When the encoder is run continuously for a few minutes at 60 fps, the
total_target_vs_actual field overflows. Since this field is a signed
integer that's considered undefined behavior in C++, which causes an
abort when used in an android binary (those run with ubsan enabled)

Bug: b/154172422
Test: run cuttelfish with webrtc enabled for an hour
Change-Id: I8f7d9d0884311a6338bdcdec76348b8cc3ce8c69

--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -4533,9 +4533,11 @@
   /* Actual bits spent */
   cpi->total_actual_bits += cpi->projected_frame_size;
 
+#if 0 && CONFIG_INTERNAL_STATS
   /* Debug stats */
   cpi->total_target_vs_actual +=
       (cpi->this_frame_target - cpi->projected_frame_size);
+#endif
 
   cpi->buffer_level = cpi->bits_off_target;