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

Showing the changes to tests/api (1 of 1 file). Show all

Unified · Split

tests/api/api-h264-slice-test.c+9−2
@@ -117,9 +117,9 @@ int main(int argc, char **argv) · 116 unmodified lines
117 unsigned int threads;117 unsigned int threads;
118 AVPacket *pkt;118 AVPacket *pkt;
119 FILE *file = NULL;119 FILE *file = NULL;
120 char nal[MAX_SLICES * UINT16_MAX + AV_INPUT_BUFFER_PADDING_SIZE];120 char * nal = NULL;
121 int nals = 0, ret = 0;121 int nals = 0, ret = 0;
122 char *p = nal;122 char *p;
123 123
124 if (argc < 4) {124 if (argc < 4) {
125 fprintf(stderr, "Usage: %s <threads> <input file> <output file>\n", argv[0]);125 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
139 return -1;139 return -1;
140 }140 }
141 141
142 nal = av_malloc(MAX_SLICES * UINT16_MAX + AV_INPUT_BUFFER_PADDING_SIZE);
143 if (!nal)
144 goto err;
145 p = nal;
146
142 if (!(codec = avcodec_find_decoder(AV_CODEC_ID_H264))) {147 if (!(codec = avcodec_find_decoder(AV_CODEC_ID_H264))) {
143 fprintf(stderr, "Codec not found\n");148 fprintf(stderr, "Codec not found\n");
144 ret = -1;149 ret = -1;
@@ -223,6 +228,8 @@ int main(int argc, char **argv) · 78 unmodified lines
223 ret = decode(c, frame, NULL);228 ret = decode(c, frame, NULL);
224 229
225err:230err:
231 if (nal)
232 av_free(nal);
226 if (file)233 if (file)
227 fclose(file);234 fclose(file);
228 av_frame_free(&frame);235 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