On 6/1/2023 9:28 PM, Andreas Rheinhardt wrote:
1. Before 97f4263, the current_obu was reset (and the packet effectively
discarded) upon errors from ff_cbs_read_packet(); yet this is no longer
true and it seems that the contents of current_obu will be processed in
the next call to av1_receive_frame(). This change seems to have been
unintentional.

I guess I assumed that ff_cbs_read_packet() failing would clear the CodedBitstreamFragment before returning, but if that's not the case then ff_cbs_fragment_reset() should be called.

Would something like

diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index 5cc5d87c64..d1a0f6eaa2 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -1461,6 +1461,7 @@ static int av1_receive_frame(AVCodecContext *avctx, 
AVFrame *frame)
             ret = ff_cbs_read_packet(s->cbc, &s->current_obu, s->pkt);
             if (ret < 0) {
                 av_packet_unref(s->pkt);
+                ff_cbs_fragment_reset(&s->current_obu);
                 av_log(avctx, AV_LOG_ERROR, "Failed to read packet.\n");
                 return ret;
             }

Be enough?
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to