]> granicus.if.org Git - libvpx/commitdiff
Don't collect stats if they won't be used
authorJorge E. Moreira <jemoreira@google.com>
Fri, 8 May 2020 22:14:48 +0000 (15:14 -0700)
committerJorge E. Moreira <jemoreira@google.com>
Fri, 8 May 2020 22:30:26 +0000 (15:30 -0700)
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

vp8/encoder/onyx_if.c

index 3f5b9816d5d8ab089bfba2376de2e14143c651f2..dccc6ebb1ab924bfdc35755033e413d1c7a92f13 100644 (file)
@@ -4533,9 +4533,11 @@ static void encode_frame_to_data_rate(VP8_COMP *cpi, size_t *size,
   /* 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;