mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-04 06:08:26 +02:00
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>
This commit is contained in:
parent
2501d2f386
commit
5780f41af5
@ -148,7 +148,7 @@ ogg_find_codec (uint8_t * buf, int size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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;
|
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->buf = av_malloc(os->bufsize);
|
||||||
os->header = -1;
|
os->header = -1;
|
||||||
|
|
||||||
st = av_new_stream (s, idx);
|
if (new_avstream) {
|
||||||
if (!st)
|
st = av_new_stream(s, idx);
|
||||||
return AVERROR(ENOMEM);
|
if (!st)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
av_set_pts_info(st, 64, 1, 1000000);
|
av_set_pts_info(st, 64, 1, 1000000);
|
||||||
|
}
|
||||||
|
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
@ -250,8 +252,10 @@ ogg_read_page (AVFormatContext * s, int *str)
|
|||||||
}
|
}
|
||||||
ogg->curidx = -1;
|
ogg->curidx = -1;
|
||||||
ogg->nstreams = 0;
|
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)
|
if (idx < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user