diff options
author | wm4 <wm4@nowhere> | 2014-06-19 18:46:06 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-06-19 18:49:46 +0200 |
commit | 0a55ee400a1966d149675b272e58d620447ba5a3 (patch) | |
tree | 71626267cb6bd2544ecaba793313cb4f58a90f66 /sub | |
parent | d9b1661895f0a7cc1a0fa9aabb419aec784a47f9 (diff) | |
download | mpv-0a55ee400a1966d149675b272e58d620447ba5a3.tar.bz2 mpv-0a55ee400a1966d149675b272e58d620447ba5a3.tar.xz |
sd_lavc: fix stupidity
Reallocating an array while you still have pointers to it -> bad idea.
Recent regression.
Diffstat (limited to 'sub')
-rw-r--r-- | sub/sd_lavc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c index 0593edccda..f47bd94f19 100644 --- a/sub/sd_lavc.c +++ b/sub/sd_lavc.c @@ -236,10 +236,11 @@ static void decode(struct sd *sd, struct demux_packet *packet) current->endpts = endpts; current->avsub = sub; + MP_TARRAY_GROW(priv, current->inbitmaps, sub.num_rects); + MP_TARRAY_GROW(priv, current->imgs, sub.num_rects); + for (int i = 0; i < sub.num_rects; i++) { struct AVSubtitleRect *r = sub.rects[i]; - MP_TARRAY_GROW(priv, current->inbitmaps, current->count); - MP_TARRAY_GROW(priv, current->imgs, current->count); struct sub_bitmap *b = ¤t->inbitmaps[current->count]; struct osd_bmp_indexed *img = ¤t->imgs[current->count]; if (r->type != SUBTITLE_BITMAP) { @@ -273,6 +274,8 @@ static void get_bitmaps(struct sd *sd, struct mp_osd_res d, double pts, struct sub *current = NULL; for (int n = 0; n < MAX_QUEUE; n++) { struct sub *sub = &priv->subs[n]; + if (!sub->valid) + continue; if (pts == MP_NOPTS_VALUE || ((sub->pts == MP_NOPTS_VALUE || pts >= sub->pts) && (sub->endpts == MP_NOPTS_VALUE || pts < sub->endpts))) |