summaryrefslogtreecommitdiff
path: root/libavcodec/h2645_parse.h
diff options
context:
space:
mode:
authorKieran Kunhya <kierank@obe.tv>2017-11-04 17:41:06 +0000
committerYour Name <you@example.com>2017-11-04 18:06:45 +0000
commit03b82b3ab9883cef017e513c7d0b3b986b3b3e7b (patch)
tree56c68bb93e11ea3eed0869998566ad7f872861df /libavcodec/h2645_parse.h
parent3357b68bc02d855a92656d7a474b22adb32ca1a7 (diff)
h2645_parse: Allocate a single buffer per packet
Drastically reduces memory usage on pathological streams. Fixes ticket #6789
Diffstat (limited to 'libavcodec/h2645_parse.h')
-rw-r--r--libavcodec/h2645_parse.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/h2645_parse.h b/libavcodec/h2645_parse.h
index 5f3e17a0f2..2e29ad26cb 100644
--- a/libavcodec/h2645_parse.h
+++ b/libavcodec/h2645_parse.h
@@ -30,7 +30,6 @@
typedef struct H2645NAL {
uint8_t *rbsp_buffer;
- int rbsp_buffer_size;
int size;
const uint8_t *data;
@@ -65,9 +64,16 @@ typedef struct H2645NAL {
int ref_idc;
} H2645NAL;
+typedef struct H2645RBSP {
+ uint8_t *rbsp_buffer;
+ int rbsp_buffer_alloc_size;
+ int rbsp_buffer_size;
+} H2645RBSP;
+
/* an input packet split into unescaped NAL units */
typedef struct H2645Packet {
H2645NAL *nals;
+ H2645RBSP rbsp;
int nb_nals;
int nals_allocated;
} H2645Packet;
@@ -75,7 +81,7 @@ typedef struct H2645Packet {
/**
* Extract the raw (unescaped) bitstream.
*/
-int ff_h2645_extract_rbsp(const uint8_t *src, int length,
+int ff_h2645_extract_rbsp(const uint8_t *src, int length, H2645RBSP *rbsp,
H2645NAL *nal, int small_padding);
/**