decoder: fix unpaired GstBuffer map/unmaps.

This possibly fixes a few memory leaks along the way.
This commit is contained in:
Gwenole Beauchesne 2013-03-20 11:26:38 +01:00
parent 1b500dee54
commit 788d337505
6 changed files with 7 additions and 0 deletions

View file

@ -972,5 +972,6 @@ gst_vaapi_decoder_decode_codec_data(GstVaapiDecoder *decoder)
status = klass->decode_codec_data(decoder, buf, buf_size);
else
status = GST_VAAPI_DECODER_STATUS_SUCCESS;
gst_buffer_unmap(codec_data, &map_info);
return status;
}

View file

@ -2716,6 +2716,7 @@ decode_slice(GstVaapiDecoderH264 *decoder, GstVaapiDecoderUnit *unit)
slice = GST_VAAPI_SLICE_NEW(H264, decoder,
(map_info.data + unit->offset + pi->nalu.offset), pi->nalu.size);
gst_buffer_unmap(buffer, &map_info);
if (!slice) {
GST_ERROR("failed to allocate slice");
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;

View file

@ -692,6 +692,7 @@ gst_vaapi_decoder_jpeg_decode(GstVaapiDecoder *base_decoder,
}
status = decode_buffer(decoder, map_info.data + unit->offset, unit->size);
gst_buffer_unmap(buffer, &map_info);
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
return status;
return GST_VAAPI_DECODER_STATUS_SUCCESS;

View file

@ -1211,6 +1211,7 @@ decode_slice(GstVaapiDecoderMpeg2 *decoder, GstVaapiDecoderUnit *unit)
slice = GST_VAAPI_SLICE_NEW(MPEG2, decoder,
(map_info.data + unit->offset), unit->size);
gst_buffer_unmap(buffer, &map_info);
if (!slice) {
GST_ERROR("failed to allocate slice");
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
@ -1499,6 +1500,7 @@ gst_vaapi_decoder_mpeg2_decode(GstVaapiDecoder *base_decoder,
packet.offset = 4;
status = parse_unit(decoder, unit, &packet);
gst_buffer_unmap(buffer, &map_info);
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
return status;
return decode_unit(decoder, unit, &packet);

View file

@ -1097,6 +1097,7 @@ gst_vaapi_decoder_mpeg4_decode(GstVaapiDecoder *base_decoder,
}
status = decode_buffer(decoder, map_info.data + unit->offset, unit->size);
gst_buffer_unmap(buffer, &map_info);
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
return status;
return GST_VAAPI_DECODER_STATUS_SUCCESS;

View file

@ -1267,6 +1267,7 @@ gst_vaapi_decoder_vc1_decode(GstVaapiDecoder *base_decoder,
}
status = decode_buffer(decoder, map_info.data + unit->offset, unit->size);
gst_buffer_unmap(buffer, &map_info);
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
return status;
return GST_VAAPI_DECODER_STATUS_SUCCESS;