|
@@ -834,8 +834,14 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
|
|
|
sub->pts = av_rescale_q(avpkt->pts,
|
|
sub->pts = av_rescale_q(avpkt->pts,
|
|
|
avctx->pkt_timebase, AV_TIME_BASE_Q);
|
|
avctx->pkt_timebase, AV_TIME_BASE_Q);
|
|
|
ret = avctx->codec->decode(avctx, sub, got_sub_ptr, pkt);
|
|
ret = avctx->codec->decode(avctx, sub, got_sub_ptr, pkt);
|
|
|
- av_assert1((ret >= 0) >= !!*got_sub_ptr &&
|
|
|
|
|
- !!*got_sub_ptr >= !!sub->num_rects);
|
|
|
|
|
|
|
+ if (pkt == avci->buffer_pkt) // did we recode?
|
|
|
|
|
+ av_packet_unref(avci->buffer_pkt);
|
|
|
|
|
+ if (ret < 0) {
|
|
|
|
|
+ *got_sub_ptr = 0;
|
|
|
|
|
+ avsubtitle_free(sub);
|
|
|
|
|
+ return ret;
|
|
|
|
|
+ }
|
|
|
|
|
+ av_assert1(!sub->num_rects || *got_sub_ptr);
|
|
|
|
|
|
|
|
if (sub->num_rects && !sub->end_display_time && avpkt->duration &&
|
|
if (sub->num_rects && !sub->end_display_time && avpkt->duration &&
|
|
|
avctx->pkt_timebase.num) {
|
|
avctx->pkt_timebase.num) {
|
|
@@ -863,9 +869,6 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
|
|
|
|
|
|
|
|
if (*got_sub_ptr)
|
|
if (*got_sub_ptr)
|
|
|
avctx->frame_number++;
|
|
avctx->frame_number++;
|
|
|
-
|
|
|
|
|
- if (pkt == avci->buffer_pkt) // did we recode?
|
|
|
|
|
- av_packet_unref(avci->buffer_pkt);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
return ret;
|