diff options
author | Clément Bœsch <ubitux@gmail.com> | 2011-05-11 20:43:27 +0200 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2011-05-12 13:34:20 +0200 |
commit | 5780f41af5d9dcb4d32f06c026ecd146b143baf9 (patch) | |
tree | b145a771aa285159113f447103ee53a532cc8715 | |
parent | 2501d2f386be4ab252f547055610e746c826ca91 (diff) | |
download | ffmpeg-5780f41af5d9dcb4d32f06c026ecd146b143baf9.tar.gz |
oggdec: fix memleak with continuous streams.
This avoids the creation of a new AVStream instead of replacing it when
a stream reset occurs (track change with some webradios for example).
Signed-off-by: Diego Biurrun <diego@biurrun.de>
-rw-r--r-- | libavformat/oggdec.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index f9aeee7eb4..4731948afd 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -148,7 +148,7 @@ ogg_find_codec (uint8_t * buf, int size) } static int -ogg_new_stream (AVFormatContext * s, uint32_t serial) +ogg_new_stream (AVFormatContext *s, uint32_t serial, int new_avstream) { struct ogg *ogg = s->priv_data; @@ -165,11 +165,13 @@ ogg_new_stream (AVFormatContext * s, uint32_t serial) os->buf = av_malloc(os->bufsize); os->header = -1; - st = av_new_stream (s, idx); - if (!st) - return AVERROR(ENOMEM); + if (new_avstream) { + st = av_new_stream(s, idx); + if (!st) + return AVERROR(ENOMEM); - av_set_pts_info(st, 64, 1, 1000000); + av_set_pts_info(st, 64, 1, 1000000); + } return idx; } @@ -250,8 +252,10 @@ ogg_read_page (AVFormatContext * s, int *str) } ogg->curidx = -1; ogg->nstreams = 0; + idx = ogg_new_stream(s, serial, 0); + } else { + idx = ogg_new_stream(s, serial, 1); } - idx = ogg_new_stream (s, serial); if (idx < 0) return -1; } |