[FFmpeg-cvslog] avcodec/qsvenc: Remove dead code for user-provided buffers

Andreas Rheinhardt git at videolan.org
Sun Sep 26 00:11:04 EEST 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu Sep  9 00:53:24 2021 +0200| [9348d06fc640289294f288f6a683bf86a32c8db1] | committer: Andreas Rheinhardt

avcodec/qsvenc: Remove dead code for user-provided buffers

Dead since commit 93016f5d1d280f9cb7856883af287fa66affc04c
which ensured that the packets received by encoders are always blank.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavcodec/qsvenc.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 4acc55b058..06f55604b5 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1590,23 +1590,7 @@ int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q,
         av_freep(&bs);
         av_freep(&sync);
 
-        if (pkt->data) {
-            if (pkt->size < new_pkt.size) {
-                av_log(avctx, AV_LOG_ERROR, "Submitted buffer not large enough: %d < %d\n",
-                       pkt->size, new_pkt.size);
-                av_packet_unref(&new_pkt);
-                return AVERROR(EINVAL);
-            }
-
-            memcpy(pkt->data, new_pkt.data, new_pkt.size);
-            pkt->size = new_pkt.size;
-
-            ret = av_packet_copy_props(pkt, &new_pkt);
-            av_packet_unref(&new_pkt);
-            if (ret < 0)
-                return ret;
-        } else
-            *pkt = new_pkt;
+        av_packet_move_ref(pkt, &new_pkt);
 
         *got_packet = 1;
     }



More information about the ffmpeg-cvslog mailing list