Skip to content

Commit

Permalink
avcodec/libsvtav1: send the EOS signal without a one frame delay to a…
Browse files Browse the repository at this point in the history
…llow for the library to operate in a low-delay mode

Co-authored-by: Amir Naghdinezhad <amir.naghdinezhad@intel.com>
Signed-off-by: Cosmin Stejerean <cosmin@cosmin.at>
Signed-off-by: James Almer <jamrial@gmail.com>
  • Loading branch information
2 people authored and jamrial committed Feb 27, 2024
1 parent 0c204ce commit 69dd1ce
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libavcodec/libsvtav1.c
Expand Up @@ -539,6 +539,14 @@ static int eb_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
if (svt_ret == EB_NoErrorEmptyQueue)
return AVERROR(EAGAIN);

#if SVT_AV1_CHECK_VERSION(2, 0, 0)
if (headerPtr->flags & EB_BUFFERFLAG_EOS) {
svt_enc->eos_flag = EOS_RECEIVED;
svt_av1_enc_release_out_buffer(&headerPtr);
return AVERROR_EOF;
}
#endif

ref = get_output_ref(avctx, svt_enc, headerPtr->n_filled_len);
if (!ref) {
av_log(avctx, AV_LOG_ERROR, "Failed to allocate output packet.\n");
Expand Down Expand Up @@ -573,8 +581,10 @@ static int eb_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
if (headerPtr->pic_type == EB_AV1_NON_REF_PICTURE)
pkt->flags |= AV_PKT_FLAG_DISPOSABLE;

#if !(SVT_AV1_CHECK_VERSION(2, 0, 0))
if (headerPtr->flags & EB_BUFFERFLAG_EOS)
svt_enc->eos_flag = EOS_RECEIVED;
#endif

ff_side_data_set_encoder_stats(pkt, headerPtr->qp * FF_QP2LAMBDA, NULL, 0, pict_type);

Expand Down

0 comments on commit 69dd1ce

Please sign in to comment.