[FFmpeg-cvslog] avcodec/ccaption_dec: remove usage of extra buffer

Paul B Mahol git at videolan.org
Tue Jun 16 18:13:34 EEST 2020


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Jun 16 17:08:04 2020 +0200| [9887bcc6c63c1f525a3e7e7b004189e79e4f1eba] | committer: Paul B Mahol

avcodec/ccaption_dec: remove usage of extra buffer

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

 libavcodec/ccaption_dec.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index 9a67c0fd5a..f73b33a003 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -242,9 +242,6 @@ typedef struct CCaptionSubContext {
     int screen_touched;
     int64_t last_real_time;
     char prev_cmd[2];
-    /* buffer to store pkt data */
-    uint8_t *pktbuf;
-    int pktbuf_size;
     int readorder;
 } CCaptionSubContext;
 
@@ -279,8 +276,6 @@ static av_cold int close_decoder(AVCodecContext *avctx)
 {
     CCaptionSubContext *ctx = avctx->priv_data;
     av_bprint_finalize(&ctx->buffer, NULL);
-    av_freep(&ctx->pktbuf);
-    ctx->pktbuf_size = 0;
     return 0;
 }
 
@@ -795,13 +790,7 @@ static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avp
     int ret = 0;
     int i;
 
-    av_fast_padded_malloc(&ctx->pktbuf, &ctx->pktbuf_size, len);
-    if (!ctx->pktbuf) {
-        av_log(ctx, AV_LOG_WARNING, "Insufficient Memory of %d truncated to %d\n", len, ctx->pktbuf_size);
-        return AVERROR(ENOMEM);
-    }
-    memcpy(ctx->pktbuf, avpkt->data, len);
-    bptr = ctx->pktbuf;
+    bptr = avpkt->data;
 
     for (i = 0; i < len; i += 3) {
         uint8_t cc_type = *(bptr + i) & 3;



More information about the ffmpeg-cvslog mailing list