encoder: h264: refine size of coded buffer.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Sun, 12 Jan 2014 21:14:11 +0000 (22:14 +0100)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 13 Jan 2014 16:31:55 +0000 (17:31 +0100)
Refine the heuristic to determine the maximum size of a coded buffer
to account for the exact number of slices. set_context_info() is the
last step during codec reconfiguration, no additional change is done
afterwards, so re-using the num_slices field here is fine.

https://bugzilla.gnome.org/show_bug.cgi?id=719953

gst-libs/gst/vaapi/gstvaapiencoder_h264.c

index af548d6..ace259a 100644 (file)
@@ -1589,8 +1589,8 @@ set_context_info (GstVaapiEncoder * base_encoder)
   /* XXX: exclude slice groups, scaling lists, MVC/SVC extensions */
   base_encoder->codedbuf_size += 4 + GST_ROUND_UP_8 (MAX_PPS_HDR_SIZE) / 8;
 
-  /* Account for slice header. At most 200 slices are supported */
-  base_encoder->codedbuf_size += 200 * (4 +
+  /* Account for slice header */
+  base_encoder->codedbuf_size += encoder->num_slices * (4 +
       GST_ROUND_UP_8 (MAX_SLICE_HDR_SIZE) / 8);
 
   return GST_VAAPI_ENCODER_STATUS_SUCCESS;