History

fate-api-h264-slice: use the heap for nal buffer

nal buffer is 512 kilobytes

Peter Ross committed 7 years ago

Commit 3fc7b691 parent 7cda7d21 file · +9 −2Browse files

Unified · Split

tests/api/api-h264-slice-test.c+9−2
@@ -117,9 +117,9 @@ int main(int argc, char **argv) · 116 unmodified lines
117117 unsigned int threads;
118118 AVPacket *pkt;
119119 FILE *file = NULL;
120− char nal[MAX_SLICES * UINT16_MAX + AV_INPUT_BUFFER_PADDING_SIZE];
120+ char * nal = NULL;
121121 int nals = 0, ret = 0;
122− char *p = nal;
122+ char *p;
123123
124124 if (argc < 4) {
125125 fprintf(stderr, "Usage: %s <threads> <input file> <output file>\n", argv[0]);
@@ -139,6 +139,11 @@ int main(int argc, char **argv) · 13 unmodified lines
139139 return -1;
140140 }
141141
142+ nal = av_malloc(MAX_SLICES * UINT16_MAX + AV_INPUT_BUFFER_PADDING_SIZE);
143+ if (!nal)
144+ goto err;
145+ p = nal;
146+
142147 if (!(codec = avcodec_find_decoder(AV_CODEC_ID_H264))) {
143148 fprintf(stderr, "Codec not found\n");
144149 ret = -1;
@@ -223,6 +228,8 @@ int main(int argc, char **argv) · 78 unmodified lines
223228 ret = decode(c, frame, NULL);
224229
225230 err:
231+ if (nal)
232+ av_free(nal);
226233 if (file)
227234 fclose(file);
228235 av_frame_free(&frame);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t