[FFmpeg-cvslog] avcodec/libsvtav1: send the EOS signal without a one frame delay to allow for the library to operate in a low-delay mode

2024-02-27 Thread Cosmin Stejerean
ffmpeg | branch: release/6.1 | Cosmin Stejerean  | Fri Feb 23 
23:21:39 2024 +| [33efa50fa4508567b1d84d0a84728b400e492a6a] | committer: 
James Almer

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 
Signed-off-by: Cosmin Stejerean 
Signed-off-by: James Almer 
(cherry picked from commit 69dd1ce610fcffec453a0663c613c9b13165fd9e)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=33efa50fa4508567b1d84d0a84728b400e492a6a
---

 libavcodec/libsvtav1.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index 862192945b..66486591f2 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -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();
+ 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");
@@ -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);
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

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


[FFmpeg-cvslog] avcodec/libsvtav1: send the EOS signal without a one frame delay to allow for the library to operate in a low-delay mode

2024-02-27 Thread Cosmin Stejerean
ffmpeg | branch: master | Cosmin Stejerean  | Fri Feb 23 
23:21:39 2024 +| [69dd1ce610fcffec453a0663c613c9b13165fd9e] | committer: 
James Almer

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 
Signed-off-by: Cosmin Stejerean 
Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=69dd1ce610fcffec453a0663c613c9b13165fd9e
---

 libavcodec/libsvtav1.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index 3b41f5a39e..1eda63200c 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -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();
+ 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");
@@ -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);
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

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