shithub: libvpx

Download patch

ref: 812eb89b26e6fe458133e90e74b0a11b853df56d
parent: e53dc9f2ea81c8f84c90f8acc6ba70f03b37647b
author: angiebird <angiebird@google.com>
date: Mon Jun 8 12:46:15 EDT 2020

Fix assertion error in simple_encode.cc

Change-Id: I271d11cc35d34d5450a8b56fabcedaf2bb7c6565

--- a/vp9/simple_encode.cc
+++ b/vp9/simple_encode.cc
@@ -848,10 +848,10 @@
 
 static GOP_COMMAND GetGopCommand(const std::vector<int> &gop_map,
                                  int start_show_index) {
-  assert(static_cast<size_t>(start_show_index) < gop_map.size());
-  assert((gop_map[start_show_index] & kGopMapFlagStart) != 0);
   GOP_COMMAND gop_command;
   if (gop_map.size() > 0) {
+    assert(static_cast<size_t>(start_show_index) < gop_map.size());
+    assert((gop_map[start_show_index] & kGopMapFlagStart) != 0);
     int end_show_index = start_show_index + 1;
     // gop_map[end_show_index] & kGopMapFlagStart == 0 means this is
     // the start of a gop.
@@ -1099,7 +1099,8 @@
 }
 
 std::vector<int> SimpleEncode::ComputeKeyFrameMap() const {
-  assert(impl_ptr_->first_pass_stats.size() == num_frames_);
+  // The last entry of first_pass_stats is the overall stats.
+  assert(impl_ptr_->first_pass_stats.size() == num_frames_ + 1);
   vpx_rational_t frame_rate =
       make_vpx_rational(frame_rate_num_, frame_rate_den_);
   const VP9EncoderConfig oxcf =