diff options
author | Josh Allmann <joshua.allmann@gmail.com> | 2010-07-01 20:15:49 +0000 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2010-07-01 20:15:49 +0000 |
commit | de1807bbc4ea29e9492484e1104d4da33cd6ba28 (patch) | |
tree | 8c6361d7b3f62430961979e2e6409973f51949a8 /libavformat/aviobuf.c | |
parent | 4449df6baf245465715844ce96886600128b3a83 (diff) | |
download | ffmpeg-de1807bbc4ea29e9492484e1104d4da33cd6ba28.tar.gz |
Pad the buffer in url_close_dyn_buf, for buffers opened with url_open_dyn_buf
Patch by Josh Allmann, joshua dot allmann at gmail
Originally committed as revision 23942 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r-- | libavformat/aviobuf.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 8684903464..df4ea60227 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -894,6 +894,14 @@ int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer) { DynBuffer *d = s->opaque; int size; + static const char padbuf[FF_INPUT_BUFFER_PADDING_SIZE] = {0}; + int padding = 0; + + /* don't attempt to pad fixed-size packet buffers */ + if (!s->max_packet_size) { + put_buffer(s, padbuf, sizeof(padbuf)); + padding = FF_INPUT_BUFFER_PADDING_SIZE; + } put_flush_packet(s); @@ -901,6 +909,6 @@ int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer) size = d->size; av_free(d); av_free(s); - return size; + return size - padding; } #endif /* CONFIG_MUXERS || CONFIG_NETWORK */ |