Skip to content
Snippets Groups Projects
Commit 265ec559 authored by James Almer's avatar James Almer
Browse files

avcodec/bsf: use av_packet_make_refcounted to ensure packets are ref counted


Simplifies code.

Signed-off-by: default avatarJames Almer <jamrial@gmail.com>
parent 38fa61b9
No related branches found
No related tags found
No related merge requests found
......@@ -174,6 +174,8 @@ int av_bsf_init(AVBSFContext *ctx)
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
{
int ret;
if (!pkt || (!pkt->data && !pkt->side_data_elems)) {
ctx->internal->eof = 1;
return 0;
......@@ -188,15 +190,10 @@ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
ctx->internal->buffer_pkt->side_data_elems)
return AVERROR(EAGAIN);
if (pkt->buf) {
av_packet_move_ref(ctx->internal->buffer_pkt, pkt);
} else {
int ret = av_packet_ref(ctx->internal->buffer_pkt, pkt);
if (ret < 0)
return ret;
av_packet_unref(pkt);
}
ret = av_packet_make_refcounted(pkt);
if (ret < 0)
return ret;
av_packet_move_ref(ctx->internal->buffer_pkt, pkt);
return 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment