Commit be07270b authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'bb4edddd'

* commit 'bb4edddd':
  rmenc: limit packet size

Conflicts:
	libavformat/rmenc.c

See: 08728f40Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 6af5bf60 bb4edddd
......@@ -44,6 +44,10 @@ typedef struct RMMuxContext {
/* in ms */
#define BUFFER_DURATION 0
/* the header needs at most 7 + 4 + 12 B */
#define MAX_HEADER_SIZE (7 + 4 + 12)
/* UINT16_MAX is the maximal chunk size */
#define MAX_PACKET_SIZE (UINT16_MAX - MAX_HEADER_SIZE)
static void put_str(AVIOContext *s, const char *tag)
......@@ -396,9 +400,8 @@ static int rm_write_video(AVFormatContext *s, const uint8_t *buf, int size, int
/* Well, I spent some time finding the meaning of these bits. I am
not sure I understood everything, but it works !! */
#if 1
/* 0xFFFF is the maximal chunk size; header needs at most 7 + 4 + 12 B */
if (size > 0xFFFF - 7 - 4 - 12) {
av_log(s, AV_LOG_ERROR, "large packet size %d not supported\n", size);
if (size > MAX_PACKET_SIZE) {
av_log(s, AV_LOG_ERROR, "Muxing packets larger than 64 kB (%d) is not supported\n", size);
return AVERROR_PATCHWELCOME;
}
write_packet_header(s, stream, size + 7 + (size >= 0x4000)*4, key_frame);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment