Skip to content

Commit 69dd1ce

Browse files
cosminanaghdin
authored andcommitted
avcodec/libsvtav1: send the EOS signal without a one frame delay to allow 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>
1 parent 0c204ce commit 69dd1ce

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

libavcodec/libsvtav1.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,14 @@ static int eb_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
539539
if (svt_ret == EB_NoErrorEmptyQueue)
540540
return AVERROR(EAGAIN);
541541

542+
#if SVT_AV1_CHECK_VERSION(2, 0, 0)
543+
if (headerPtr->flags & EB_BUFFERFLAG_EOS) {
544+
svt_enc->eos_flag = EOS_RECEIVED;
545+
svt_av1_enc_release_out_buffer(&headerPtr);
546+
return AVERROR_EOF;
547+
}
548+
#endif
549+
542550
ref = get_output_ref(avctx, svt_enc, headerPtr->n_filled_len);
543551
if (!ref) {
544552
av_log(avctx, AV_LOG_ERROR, "Failed to allocate output packet.\n");
@@ -573,8 +581,10 @@ static int eb_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
573581
if (headerPtr->pic_type == EB_AV1_NON_REF_PICTURE)
574582
pkt->flags |= AV_PKT_FLAG_DISPOSABLE;
575583

584+
#if !(SVT_AV1_CHECK_VERSION(2, 0, 0))
576585
if (headerPtr->flags & EB_BUFFERFLAG_EOS)
577586
svt_enc->eos_flag = EOS_RECEIVED;
587+
#endif
578588

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

0 commit comments

Comments
 (0)