diff mbox series

[FFmpeg-devel,27/39] avcodec/omx: Remove remnants of old preallocated buffers

Message ID HE1PR0301MB2154DAB3B1F44D97EB5DDBA28F299@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Commit eeedc8817a8d7c1264fc952ffdbba501be3c679e
Headers show
Series [FFmpeg-devel,01/39] avcodec/audiotoolboxenc: Remove AV_CODEC_CAP_DR1 | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt May 21, 2021, 9:17 a.m. UTC
There are no preallocated buffer packets any more; this feature only
worked with the old encode API and only until said API was turned into
a wrapper for the new API in 93016f5d1d280f9cb7856883af287fa66affc04c.
So remove its remnants.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/omx.c | 15 ---------------
 1 file changed, 15 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/omx.c b/libavcodec/omx.c
index 3a113723d3..1e48579d4b 100644
--- a/libavcodec/omx.c
+++ b/libavcodec/omx.c
@@ -863,9 +863,6 @@  static int omx_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
             avctx->extradata_size += buffer->nFilledLen;
             memset(avctx->extradata + avctx->extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
         } else {
-            if (!(buffer->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) || !pkt->data) {
-                // If the output packet isn't preallocated, just concatenate everything in our
-                // own buffer
                 int newsize = s->output_buf_size + buffer->nFilledLen + AV_INPUT_BUFFER_PADDING_SIZE;
                 if ((ret = av_reallocp(&s->output_buf, newsize)) < 0) {
                     s->output_buf_size = 0;
@@ -885,18 +882,6 @@  static int omx_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
 #if CONFIG_OMX_RPI
                 had_partial = 1;
 #endif
-            } else {
-                // End of frame, and the caller provided a preallocated frame
-                if ((ret = ff_alloc_packet2(avctx, pkt, s->output_buf_size + buffer->nFilledLen, 0)) < 0) {
-                    av_log(avctx, AV_LOG_ERROR, "Error getting output packet of size %d.\n",
-                           (int)(s->output_buf_size + buffer->nFilledLen));
-                    goto end;
-                }
-                memcpy(pkt->data, s->output_buf, s->output_buf_size);
-                memcpy(pkt->data + s->output_buf_size, buffer->pBuffer + buffer->nOffset, buffer->nFilledLen);
-                av_freep(&s->output_buf);
-                s->output_buf_size = 0;
-            }
             if (buffer->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) {
                 pkt->pts = av_rescale_q(from_omx_ticks(buffer->nTimeStamp), AV_TIME_BASE_Q, avctx->time_base);
                 // We don't currently enable B-frames for the encoders, so set