]> granicus.if.org Git - libvpx/commitdiff
vpxdec.c : don't double count corrupted frames
authorJim Bankoski <jimbankoski@google.com>
Fri, 28 Oct 2016 12:53:26 +0000 (05:53 -0700)
committerJim Bankoski <jimbankoski@google.com>
Mon, 31 Oct 2016 13:09:58 +0000 (06:09 -0700)
A past patch made it so that every frame that had a decode error
caused a corrupted frame to be counted.  Unfortunately it was possible
to get both a decode error and a corrupt frame for the same frame
and thus double count an error. This code makes that impossible.

Change-Id: Iea973727422a3bf093ffda72fa358a285736048b

vpxdec.c

index 4bd16bbed6a020d61e103f796447a74c4971765d..f1b09e6571eabaaef7db66cb0436eab6a7f444ff 100644 (file)
--- a/vpxdec.c
+++ b/vpxdec.c
@@ -781,7 +781,7 @@ static int main_loop(int argc, const char **argv_) {
           warn("Failed to decode frame %d: %s", frame_in,
                vpx_codec_error(&decoder));
           if (detail) warn("Additional information: %s", detail);
-          frames_corrupted++;
+          corrupted = 1;
           if (!keep_going) goto fail;
         }
 
@@ -800,7 +800,7 @@ static int main_loop(int argc, const char **argv_) {
       // Flush the decoder in frame parallel decode.
       if (vpx_codec_decode(&decoder, NULL, 0, NULL, 0)) {
         warn("Failed to flush decoder: %s", vpx_codec_error(&decoder));
-        frames_corrupted++;
+        corrupted = 1;
         if (!keep_going) goto fail;
       }
     }
@@ -814,7 +814,7 @@ static int main_loop(int argc, const char **argv_) {
     vpx_usec_timer_mark(&timer);
     dx_time += (unsigned int)vpx_usec_timer_elapsed(&timer);
 
-    if (!frame_parallel &&
+    if (!frame_parallel && !corrupted &&
         vpx_codec_control(&decoder, VP8D_GET_FRAME_CORRUPTED, &corrupted)) {
       warn("Failed VP8_GET_FRAME_CORRUPTED: %s", vpx_codec_error(&decoder));
       if (!keep_going) goto fail;