[FFmpeg-cvslog] Merge commit '8229eff4b7a98ae5d85bb75f3bb072781b4a8ebe'

Derek Buitenhuis git at videolan.org
Tue Apr 26 15:01:57 CEST 2016


ffmpeg | branch: master | Derek Buitenhuis <derek.buitenhuis at gmail.com> | Tue Apr 26 14:01:45 2016 +0100| [8e73574d4f176d166f08959f6c84e6bc3ffef79c] | committer: Derek Buitenhuis

Merge commit '8229eff4b7a98ae5d85bb75f3bb072781b4a8ebe'

* commit '8229eff4b7a98ae5d85bb75f3bb072781b4a8ebe':
  h2645_parse: add a function for uninitializing the packet

Merged-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>

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

 libavcodec/h2645_parse.c |   10 ++++++++++
 libavcodec/h2645_parse.h |    5 +++++
 libavcodec/hevc.c        |    7 +------
 libavcodec/hevc_parser.c |    7 +------
 4 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c
index 373f1d3..58c9118 100644
--- a/libavcodec/h2645_parse.c
+++ b/libavcodec/h2645_parse.c
@@ -295,3 +295,13 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
     return 0;
 }
 
+void ff_h2645_packet_uninit(H2645Packet *pkt)
+{
+    int i;
+    for (i = 0; i < pkt->nals_allocated; i++) {
+        av_freep(&pkt->nals[i].rbsp_buffer);
+        av_freep(&pkt->nals[i].skipped_bytes_pos);
+    }
+    av_freep(&pkt->nals);
+    pkt->nals_allocated = 0;
+}
diff --git a/libavcodec/h2645_parse.h b/libavcodec/h2645_parse.h
index 1724756..05c21b0 100644
--- a/libavcodec/h2645_parse.h
+++ b/libavcodec/h2645_parse.h
@@ -65,4 +65,9 @@ int ff_h2645_extract_rbsp(const uint8_t *src, int length,
 int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
                           AVCodecContext *avctx, int is_nalff, int nal_length_size);
 
+/**
+ * Free all the allocated memory in the packet.
+ */
+void ff_h2645_packet_uninit(H2645Packet *pkt);
+
 #endif /* AVCODEC_H2645_PARSE_H */
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index f012c41..27b1640 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -3111,12 +3111,7 @@ static av_cold int hevc_decode_free(AVCodecContext *avctx)
         s->HEVClc = NULL;
     av_freep(&s->HEVClcList[0]);
 
-    for (i = 0; i < s->pkt.nals_allocated; i++) {
-        av_freep(&s->pkt.nals[i].rbsp_buffer);
-        av_freep(&s->pkt.nals[i].skipped_bytes_pos);
-    }
-    av_freep(&s->pkt.nals);
-    s->pkt.nals_allocated = 0;
+    ff_h2645_packet_uninit(&s->pkt);
 
     return 0;
 }
diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c
index 71887a8..458a2eb 100644
--- a/libavcodec/hevc_parser.c
+++ b/libavcodec/hevc_parser.c
@@ -472,12 +472,7 @@ static void hevc_parser_close(AVCodecParserContext *s)
 
     ctx->ps.sps = NULL;
 
-    for (i = 0; i < ctx->pkt.nals_allocated; i++) {
-        av_freep(&ctx->pkt.nals[i].rbsp_buffer);
-        av_freep(&ctx->pkt.nals[i].skipped_bytes_pos);
-    }
-    av_freep(&ctx->pkt.nals);
-    ctx->pkt.nals_allocated = 0;
+    ff_h2645_packet_uninit(&ctx->pkt);
 
     av_freep(&ctx->pc.buffer);
 }


======================================================================

diff --cc libavcodec/h2645_parse.c
index 373f1d3,0064b7d..58c9118
--- a/libavcodec/h2645_parse.c
+++ b/libavcodec/h2645_parse.c
@@@ -295,3 -227,11 +295,13 @@@ int ff_h2645_packet_split(H2645Packet *
      return 0;
  }
  
+ void ff_h2645_packet_uninit(H2645Packet *pkt)
+ {
+     int i;
 -    for (i = 0; i < pkt->nals_allocated; i++)
++    for (i = 0; i < pkt->nals_allocated; i++) {
+         av_freep(&pkt->nals[i].rbsp_buffer);
++        av_freep(&pkt->nals[i].skipped_bytes_pos);
++    }
+     av_freep(&pkt->nals);
+     pkt->nals_allocated = 0;
+ }
diff --cc libavcodec/hevc.c
index f012c41,72dea5a..27b1640
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@@ -3092,31 -2797,8 +3092,26 @@@ static av_cold int hevc_decode_free(AVC
          av_buffer_unref(&s->ps.sps_list[i]);
      for (i = 0; i < FF_ARRAY_ELEMS(s->ps.pps_list); i++)
          av_buffer_unref(&s->ps.pps_list[i]);
 +    s->ps.sps = NULL;
 +    s->ps.pps = NULL;
 +    s->ps.vps = NULL;
 +
 +    av_freep(&s->sh.entry_point_offset);
 +    av_freep(&s->sh.offset);
 +    av_freep(&s->sh.size);
 +
 +    for (i = 1; i < s->threads_number; i++) {
 +        HEVCLocalContext *lc = s->HEVClcList[i];
 +        if (lc) {
 +            av_freep(&s->HEVClcList[i]);
 +            av_freep(&s->sList[i]);
 +        }
 +    }
 +    if (s->HEVClc == s->HEVClcList[0])
 +        s->HEVClc = NULL;
 +    av_freep(&s->HEVClcList[0]);
  
-     for (i = 0; i < s->pkt.nals_allocated; i++) {
-         av_freep(&s->pkt.nals[i].rbsp_buffer);
-         av_freep(&s->pkt.nals[i].skipped_bytes_pos);
-     }
-     av_freep(&s->pkt.nals);
-     s->pkt.nals_allocated = 0;
+     ff_h2645_packet_uninit(&s->pkt);
  
      return 0;
  }
diff --cc libavcodec/hevc_parser.c
index 71887a8,5c1fbc3..458a2eb
--- a/libavcodec/hevc_parser.c
+++ b/libavcodec/hevc_parser.c
@@@ -470,14 -227,7 +470,9 @@@ static void hevc_parser_close(AVCodecPa
      for (i = 0; i < FF_ARRAY_ELEMS(ctx->ps.pps_list); i++)
          av_buffer_unref(&ctx->ps.pps_list[i]);
  
 +    ctx->ps.sps = NULL;
 +
-     for (i = 0; i < ctx->pkt.nals_allocated; i++) {
-         av_freep(&ctx->pkt.nals[i].rbsp_buffer);
-         av_freep(&ctx->pkt.nals[i].skipped_bytes_pos);
-     }
-     av_freep(&ctx->pkt.nals);
-     ctx->pkt.nals_allocated = 0;
+     ff_h2645_packet_uninit(&ctx->pkt);
  
      av_freep(&ctx->pc.buffer);
  }



More information about the ffmpeg-cvslog mailing list