mpeg2: don't create sub-buffer for slice data.

Avoid creating a GstBuffer for slice data. Rather, directly use the codec
frame input buffer data. This is possible because the codec frame is valid
until end_frame() where we submit the VA buffers for decoding. Anyway, the
slice data buffer is copied into the VA buffer when it is created.
This commit is contained in:
Gwenole Beauchesne 2013-01-02 17:23:53 +01:00
parent 4556b1fd47
commit eda01ab027

View file

@ -1039,22 +1039,14 @@ decode_slice(GstVaapiDecoderMpeg2 *decoder, GstVaapiDecoderUnitMpeg2 *unit)
GstVaapiPicture * const picture = priv->current_picture;
GstVaapiSlice *slice;
VASliceParameterBufferMPEG2 *slice_param;
GstMpegVideoPacket * const packet = &unit->packet;
GstMpegVideoSliceHdr * const slice_hdr = &unit->data.slice_hdr;
GST_DEBUG("slice %d (%u bytes)", slice_hdr->slice_vertical_position,
packet->size);
unit->base.buffer = gst_buffer_create_sub(
GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer,
unit->base.offset, unit->base.size);
if (!unit->base.buffer) {
GST_ERROR("failed to allocate slice data");
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
}
unit->base.size);
slice = GST_VAAPI_SLICE_NEW(MPEG2, decoder,
GST_BUFFER_DATA(unit->base.buffer), packet->size);
(GST_BUFFER_DATA(GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer) +
unit->base.offset), unit->base.size);
if (!slice) {
GST_ERROR("failed to allocate slice");
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;