[vlc-commits] [Git][videolan/vlc][master] 3 commits: vout_subpicture: use a function to ensure there's enough room for scaled pics
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Nov 23 12:24:57 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
e07d09b0 by Steve Lhomme at 2023-11-23T11:57:48+00:00
vout_subpicture: use a function to ensure there's enough room for scaled pics
- - - - -
11ca3b2a by Steve Lhomme at 2023-11-23T11:57:48+00:00
vout_subpictures: ensure there's enough room for scaled pics after update
The subpicture_Update() may add regions so we need to have enough room
to scale each region picture.
- - - - -
89e14f1a by Steve Lhomme at 2023-11-23T11:57:48+00:00
vout_subpictures: ensure we have enough room for scaled SPU's
- - - - -
1 changed file:
- src/video_output/vout_subpictures.c
Changes:
=====================================
src/video_output/vout_subpictures.c
=====================================
@@ -649,6 +649,22 @@ spu_render_entry_IsSelected(spu_render_entry_t *render_entry, size_t channel_id,
return true;
}
+static int spu_entry_EnsureScaledSize(spu_render_entry_t *render_entry)
+{
+ const subpicture_t *subpic = render_entry->subpic;
+ size_t region_count = 0;
+ const subpicture_region_t *r;
+ vlc_spu_regions_foreach_const(r, &subpic->regions)
+ region_count++;
+
+ while (region_count > render_entry->scaled_region_pics.size)
+ {
+ if (unlikely(!vlc_vector_push(&render_entry->scaled_region_pics, NULL)))
+ return VLC_ENOMEM;
+ }
+ return VLC_SUCCESS;
+}
+
/*****************************************************************************
* spu_SelectSubpictures: find the subpictures to display
*****************************************************************************
@@ -763,19 +779,8 @@ spu_SelectSubpictures(spu_t *spu, vlc_tick_t system_now,
if (!is_rejected)
{
- size_t region_count = 0;
- const subpicture_region_t *r;
- vlc_spu_regions_foreach(r, ¤t->regions)
- region_count++;
-
- while (region_count > render_entry->scaled_region_pics.size)
- {
- if (!vlc_vector_push(&render_entry->scaled_region_pics, NULL))
- {
- is_rejected = true;
- break;
- }
- }
+ if (unlikely(spu_entry_EnsureScaledSize(render_entry) != VLC_SUCCESS))
+ is_rejected = true;
}
if (is_rejected)
@@ -1238,6 +1243,7 @@ static vlc_render_subpicture *SpuRenderSubpictures(spu_t *spu,
*/
vlc_spu_regions_foreach(region, &subpic->regions) {
spu_area_t area;
+ assert(region_idx < entry->scaled_region_pics.size);
picture_t **scaled_region_pic = &entry->scaled_region_pics.data[region_idx];
region_idx++;
@@ -2083,6 +2089,13 @@ vlc_render_subpicture *spu_Render(spu_t *spu,
subpicture_Update(subpic,
fmt_src, fmt_dst,
subpic->b_subtitle ? render_subtitle_date : system_now);
+
+ if (unlikely(spu_entry_EnsureScaledSize(entry) != VLC_SUCCESS))
+ {
+ free(subpicture_array);
+ vlc_mutex_unlock(&sys->lock);
+ return NULL;
+ }
}
/* Now order the subpicture array
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fe27d2523786f898ccaf088501057a12094976bf...89e14f1a03d3b9ac4a870a4b633ece47bad8995f
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fe27d2523786f898ccaf088501057a12094976bf...89e14f1a03d3b9ac4a870a4b633ece47bad8995f
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list