mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-30 03:12:08 +00:00
qt-faststart: dont allocate a bigger buffer than needed
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
f4d9148fe2
commit
610efb6773
@ -37,6 +37,8 @@
|
|||||||
#define ftello(x) _ftelli64(x)
|
#define ftello(x) _ftelli64(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
|
||||||
|
|
||||||
#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
|
#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
|
||||||
|
|
||||||
#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \
|
#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \
|
||||||
@ -293,9 +295,10 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* copy the remainder of the infile, from offset 0 -> last_offset - 1 */
|
/* copy the remainder of the infile, from offset 0 -> last_offset - 1 */
|
||||||
copy_buffer = malloc(COPY_BUFFER_SIZE);
|
bytes_to_copy = FFMIN(COPY_BUFFER_SIZE, last_offset);
|
||||||
|
copy_buffer = malloc(bytes_to_copy);
|
||||||
if (!copy_buffer) {
|
if (!copy_buffer) {
|
||||||
printf("could not allocate %"PRIu64" bytes for copy_buffer\n", COPY_BUFFER_SIZE);
|
printf("could not allocate %"PRIu64" bytes for copy_buffer\n", bytes_to_copy);
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
printf(" copying rest of file...\n");
|
printf(" copying rest of file...\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user