]> granicus.if.org Git - libvpx/commitdiff
fix superframe index with lagged encoding
authorJohn Koleszar <jkoleszar@google.com>
Tue, 12 Mar 2013 23:33:38 +0000 (16:33 -0700)
committerJohn Koleszar <jkoleszar@google.com>
Tue, 12 Mar 2013 23:33:38 +0000 (16:33 -0700)
If a superframe (ARF) is generated while flushing the lagged frames
at the end of the clip, the buffer pointer wasn't being properly
updated to account for the size of the index, causing the next
frame to overwrite the index on the previous frame.

Change-Id: Ib158cc8e4183d663bdfb9ba002dd4c98916abdc9

vp9/vp9_cx_iface.c

index 724f4185fbc64f07328e5b9417d4da07401eabdb..708cec60280285cffb578c29b094a29ba30bcac9 100644 (file)
@@ -582,7 +582,7 @@ static void pick_quickcompress_mode(vpx_codec_alg_priv_t  *ctx,
 }
 
 
-static void write_superframe_index(vpx_codec_alg_priv_t *ctx) {
+static int write_superframe_index(vpx_codec_alg_priv_t *ctx) {
   uint8_t marker = 0xc0;
   int mag, mask, index_sz;
 
@@ -619,6 +619,7 @@ static void write_superframe_index(vpx_codec_alg_priv_t *ctx) {
     *x++ = marker;
     ctx->pending_cx_data_sz += index_sz;
   }
+  return index_sz;
 }
 
 static vpx_codec_err_t vp8e_encode(vpx_codec_alg_priv_t  *ctx,
@@ -818,7 +819,7 @@ static vpx_codec_err_t vp8e_encode(vpx_codec_alg_priv_t  *ctx,
             ctx->pending_frame_sizes[ctx->pending_frame_count++] = size;
             ctx->pending_frame_magnitude |= size;
             ctx->pending_cx_data_sz += size;
-            write_superframe_index(ctx);
+            size += write_superframe_index(ctx);
             pkt.data.frame.buf = ctx->pending_cx_data;
             pkt.data.frame.sz  = ctx->pending_cx_data_sz;
             ctx->pending_cx_data = NULL;