* commit '549d0bdca5':
  decode: be more explicit about storing the last packet properties

Also copy pkt->size in extract_packet_props(), as it's needed for
AVFrame.pkt_size

Merged-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2017-04-22 20:06:47 -03:00
commit 1fd7627770
5 changed files with 41 additions and 25 deletions

View file

@ -684,6 +684,12 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
goto free_and_end;
}
avctx->internal->last_pkt_props = av_packet_alloc();
if (!avctx->internal->last_pkt_props) {
ret = AVERROR(ENOMEM);
goto free_and_end;
}
avctx->internal->skip_samples_multiplier = 1;
if (codec->priv_data_size > 0) {
@ -1110,6 +1116,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
av_frame_free(&avctx->internal->to_free);
av_frame_free(&avctx->internal->buffer_frame);
av_packet_free(&avctx->internal->buffer_pkt);
av_packet_free(&avctx->internal->last_pkt_props);
av_freep(&avctx->internal->pool);
}
av_freep(&avctx->internal);
@ -1158,6 +1165,7 @@ av_cold int avcodec_close(AVCodecContext *avctx)
av_frame_free(&avctx->internal->to_free);
av_frame_free(&avctx->internal->buffer_frame);
av_packet_free(&avctx->internal->buffer_pkt);
av_packet_free(&avctx->internal->last_pkt_props);
for (i = 0; i < FF_ARRAY_ELEMS(pool->pools); i++)
av_buffer_pool_uninit(&pool->pools[i]);
av_freep(&avctx->internal->pool);