[vlc-commits] [Git][videolan/vlc][master] 7 commits: test: input_decoder: allocate a valid picture
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Oct 12 17:27:56 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
c92d63ce by Thomas Guillem at 2023-10-12T16:47:48+00:00
test: input_decoder: allocate a valid picture
New scenarios with a text_renderer may go through the rendering/blend
step in video_output.c and trigger an assert if the picture don't have
valid data.
This fixes the following non systematic assert:
test_src_input_decoder: ../../src/misc/picture.c:385: plane_CopyPixels: Assertion `p_in' failed.
Thread 63 "vlc-vout" received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff58ba6c0 (LWP 1264089)]
0x00007ffff7ceed3c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
0 0x00007ffff7ceed3c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
1 0x00007ffff7c9ff32 in raise () from /lib/x86_64-linux-gnu/libc.so.6
2 0x00007ffff7c8a472 in abort () from /lib/x86_64-linux-gnu/libc.so.6
3 0x00007ffff7c8a395 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
4 0x00007ffff7c98e32 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
5 0x00007ffff7f43d33 in plane_CopyPixels (p_dst=0x7fffec0011c0, p_src=0x7fffe0001a20) at ../../src/misc/picture.c:385
6 0x00007ffff7f43dd2 in picture_CopyPixels (p_dst=p_dst at entry=0x7fffec001130, p_src=p_src at entry=0x7fffe0001990)
at ../../src/misc/picture.c:415
7 0x00007ffff7f43e41 in picture_Copy (p_dst=p_dst at entry=0x7fffec001130, p_src=p_src at entry=0x7fffe0001990)
at ../../src/misc/picture.c:425
8 0x00007ffff7f1eea4 in PrerenderPicture (out_subpic=<synthetic pointer>, out_pic=<synthetic pointer>,
render_now=<synthetic pointer>, filtered=0x7fffe0001990, sys=0x7fffe801c640)
at ../../src/video_output/video_output.c:1231
9 RenderPicture (sys=sys at entry=0x7fffe801c640, render_now=render_now at entry=false)
at ../../src/video_output/video_output.c:1312
10 0x00007ffff7f2014d in DisplayPicture (vout=0x7fffe801c640) at ../../src/video_output/video_output.c:1521
11 Thread (object=0x7fffe801c640) at ../../src/video_output/video_output.c:1845
12 0x00007ffff7ced044 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
13 0x00007ffff7d6d61c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
- - - - -
8f59dc2e by Thomas Guillem at 2023-10-12T16:47:48+00:00
test: input_decoder: replace sout with item_option
In order to add other options from future scenarios.
- - - - -
5797de14 by Thomas Guillem at 2023-10-12T16:47:48+00:00
test: input_decoder: check that 64 CEA708 tracks can be added
And also test vlc_player_SetClosedCaptionsDecoder().
- - - - -
1ca8253c by Thomas Guillem at 2023-10-12T16:47:48+00:00
es_out: use a stable id for CCs tracks
The index of the cc track is now the bitmap index, and not the array
order.
video/0/cc/spu/auto/0 is now video/0/cc/spu/auto/1 (if the first bitmap
is valid, otherwise, the last digit can be between 1 and 64).
The last digit of cc track str_id now match the log:
main input debug: Adding CC track 1 for es[0]
main input debug: ES track added: 'video/0/cc/spu/1' (fourcc: 'c708')
main input debug: Adding CC track 2 for es[0]
main input debug: ES track added: 'video/0/cc/spu/2' (fourcc: 'c708')
main input debug: Adding CC track 3 for es[0]
main input debug: ES track added: 'video/0/cc/spu/3' (fourcc: 'c708')
main input debug: Adding CC track 4 for es[0]
main input debug: ES track added: 'video/0/cc/spu/4' (fourcc: 'c708')
- - - - -
3428b558 by Thomas Guillem at 2023-10-12T16:47:48+00:00
es_out: refactor CC id calculation
- - - - -
1a54ba2d by Thomas Guillem at 2023-10-12T16:47:48+00:00
test: input_decoder: split cc_decoder_decode
- - - - -
0e543f38 by Thomas Guillem at 2023-10-12T16:47:48+00:00
test: input_decoder: check that CEA708 10 and 64 tracks can be rendered
And also check that:
- CC selection works for channel > 1
- Adding CC tracks at non-continuous indexes (10 and 64)
- 2 SPU tracks can be rendered at the same time.
- - - - -
4 changed files:
- src/input/es_out.c
- test/src/input/decoder/input_decoder.c
- test/src/input/decoder/input_decoder.h
- test/src/input/decoder/input_decoder_scenarios.c
Changes:
=====================================
src/input/es_out.c
=====================================
@@ -2827,14 +2827,15 @@ static void EsOutCreateCCChannels( es_out_t *out, vlc_fourcc_t codec, uint64_t i
if( (i_bitmap & 1) == 0 || (i_existingbitmap & 1) )
continue;
- msg_Dbg( p_input, "Adding CC track %d for es[%d]", 1+i, parent->fmt.i_id );
-
es_format_Init( &fmt, SPU_ES, codec );
+ fmt.i_id = i + 1;
fmt.subs.cc.i_channel = i;
fmt.i_group = parent->fmt.i_group;
- if( asprintf( &fmt.psz_description, psz_descfmt, 1 + i ) == -1 )
+ if( asprintf( &fmt.psz_description, psz_descfmt, fmt.i_id ) == -1 )
fmt.psz_description = NULL;
+ msg_Dbg( p_input, "Adding CC track %d for es[%d]", fmt.i_id, parent->fmt.i_id );
+
es_out_id_t **pp_es = &parent->cc.pp_es[i];
*pp_es = EsOutAddLocked( out, parent->p_pgrm->source, &fmt, parent );
es_format_Clean( &fmt );
=====================================
test/src/input/decoder/input_decoder.c
=====================================
@@ -77,10 +77,7 @@ static int DecoderDecode(decoder_t *dec, block_t *block)
if (block == NULL)
return VLC_SUCCESS;
- const picture_resource_t resource = {
- .p_sys = NULL,
- };
- picture_t *pic = picture_NewFromResource(&dec->fmt_out.video, &resource);
+ picture_t *pic = picture_NewFromFormat(&dec->fmt_out.video);
assert(pic);
pic->date = block->i_pts;
pic->b_progressive = true;
@@ -363,13 +360,8 @@ static void play_scenario(intf_thread_t *intf, struct input_decoder_scenario *sc
var_Create(intf, "codec", VLC_VAR_STRING);
var_SetString(intf, "codec", MODULE_STRING);
- if (scenario->sout != NULL)
- {
- char *sout;
- assert(asprintf(&sout, ":sout=%s", scenario->sout) != -1);
- input_item_AddOption(media, sout, VLC_INPUT_OPTION_TRUSTED);
- free(sout);
- }
+ if (scenario->item_option != NULL)
+ input_item_AddOption(media, scenario->item_option, VLC_INPUT_OPTION_TRUSTED);
vlc_player_t *player = vlc_player_New(&intf->obj,
VLC_PLAYER_LOCK_NORMAL, NULL, NULL);
=====================================
test/src/input/decoder/input_decoder.h
=====================================
@@ -32,7 +32,7 @@ typedef struct decoder_cc_desc_t decoder_cc_desc_t;
struct input_decoder_scenario {
const char *name;
const char *source;
- const char *sout;
+ const char *item_option;
const vlc_fourcc_t *subpicture_chromas;
void (*decoder_setup)(decoder_t *);
void (*decoder_destroy)(decoder_t *);
=====================================
test/src/input/decoder/input_decoder_scenarios.c
=====================================
@@ -32,6 +32,7 @@
#include <vlc_interface.h>
#include <vlc_frame.h>
#include <vlc_codec.h>
+#include <vlc_filter.h>
#include <vlc_vout_display.h>
#include "input_decoder.h"
@@ -394,6 +395,17 @@ static vlc_frame_t *packetizer_getcc_cea608_max(decoder_t *dec, decoder_cc_desc_
return create_cc_frame(VLC_TICK_0);
}
+static vlc_frame_t *packetizer_getcc_cea708_max(decoder_t *dec, decoder_cc_desc_t *cc_desc)
+{
+ (void)dec;
+
+ cc_desc->i_608_channels = 0;
+ cc_desc->i_708_channels = UINT64_MAX;
+ cc_desc->i_reorder_depth = 4;
+
+ return create_cc_frame(VLC_TICK_0);
+}
+
static void on_track_list_changed_check_cea608(
enum vlc_player_list_action action,
const struct vlc_player_track *track)
@@ -401,7 +413,7 @@ static void on_track_list_changed_check_cea608(
if (action != VLC_PLAYER_LIST_ADDED)
return;
- if (strcmp(vlc_es_id_GetStrId(track->es_id), "video/0/cc/spu/auto/0") != 0)
+ if (strcmp(vlc_es_id_GetStrId(track->es_id), "video/0/cc/spu/1") != 0)
return;
assert(track->fmt.i_codec == VLC_CODEC_CEA608);
@@ -416,9 +428,9 @@ static void on_track_list_changed_check_count(
if (action != VLC_PLAYER_LIST_ADDED)
return;
- char buffer[] = "video/0/cc/spu/auto/xx";
+ char buffer[] = "video/0/cc/spu/xx";
assert(scenario_data.cc_track_idx < 100);
- sprintf(buffer, "video/0/cc/spu/auto/%zu", scenario_data.cc_track_idx);
+ sprintf(buffer, "video/0/cc/spu/%zu", scenario_data.cc_track_idx);
if (strcmp(vlc_es_id_GetStrId(track->es_id), buffer) != 0)
return;
@@ -438,9 +450,16 @@ static void on_track_list_changed_check_cea608_count(
on_track_list_changed_check_count(action, track, VLC_CODEC_CEA608, 4);
}
+static void on_track_list_changed_check_cea708_count(
+ enum vlc_player_list_action action,
+ const struct vlc_player_track *track)
+{
+ on_track_list_changed_check_count(action, track, VLC_CODEC_CEA708, 64);
+}
+
static void player_setup_select_cc(vlc_player_t *player)
{
- vlc_player_SelectTracksByStringIds(player, SPU_ES, "video/0/cc/spu/auto/0");
+ vlc_player_SelectTracksByStringIds(player, SPU_ES, "video/0/cc/spu/1");
}
static void cc_decoder_setup_01(decoder_t *dec)
@@ -452,8 +471,8 @@ static void cc_decoder_setup_01(decoder_t *dec)
dec->fmt_out.i_codec = VLC_CODEC_TEXT;
}
-static const char cc_block_decoded[] = "cc01_dec";
-static int cc_decoder_decode(decoder_t *dec, vlc_frame_t *in)
+static int cc_decoder_decode_common(decoder_t *dec, vlc_frame_t *in,
+ const char *text)
{
assert(memcmp(in->p_buffer, cc_block_input, sizeof(cc_block_input)) == 0);
@@ -468,7 +487,7 @@ static int cc_decoder_decode(decoder_t *dec, vlc_frame_t *in)
subpic->p_region = subpicture_region_New(&fmt);
assert(subpic->p_region != NULL);
- subpic->p_region->p_text = text_segment_New(cc_block_decoded);
+ subpic->p_region->p_text = text_segment_New(text);
assert(subpic->p_region->p_text != NULL);
decoder_QueueSub(dec, subpic);
@@ -476,6 +495,12 @@ static int cc_decoder_decode(decoder_t *dec, vlc_frame_t *in)
return VLC_SUCCESS;
}
+static const char cc_block_decoded[] = "cc01_dec";
+static int cc_decoder_decode(decoder_t *dec, vlc_frame_t *in)
+{
+ return cc_decoder_decode_common(dec, in, cc_block_decoded);
+}
+
static void display_prepare_noop(vout_display_t *vd, picture_t *pic)
{
(void)vd; (void) pic;
@@ -488,6 +513,72 @@ static void cc_text_renderer_render(filter_t *filter, subpicture_region_t *regio
vlc_sem_post(&scenario_data.wait_stop);
}
+static vlc_frame_t *packetizer_getcc_cea708_1064(decoder_t *dec, decoder_cc_desc_t *cc_desc)
+{
+ (void)dec;
+
+ cc_desc->i_608_channels = 0;
+ cc_desc->i_708_channels = (1ULL << 9) | (1ULL << 63);
+ cc_desc->i_reorder_depth = 4;
+
+ return create_cc_frame(VLC_TICK_0);
+}
+
+static void cc_decoder_setup_708_1064(decoder_t *dec)
+{
+ assert(dec->fmt_in->i_codec == VLC_CODEC_CEA708);
+ assert(dec->fmt_in->subs.cc.i_channel == 9
+ || dec->fmt_in->subs.cc.i_channel == 63);
+ assert(dec->fmt_in->subs.cc.i_reorder_depth == 4);
+
+ dec->fmt_out.i_codec = VLC_CODEC_TEXT;
+}
+
+static int cc_decoder_decode_channel(decoder_t *dec, vlc_frame_t *in)
+{
+ char buf[] = "ccxx_dec";
+ assert(dec->fmt_in->subs.cc.i_channel < 64);
+ sprintf(buf, "cc%02u_dec", dec->fmt_in->subs.cc.i_channel + 1);
+ return cc_decoder_decode_common(dec, in, buf);
+}
+
+static void cc_text_renderer_render_708_1064(filter_t *filter,
+ subpicture_region_t *region_in)
+{
+ (void) filter;
+ /* Make sure each tracks are rendered once */
+ static unsigned chans[] = { 10, 64 };
+ static bool rendered[] = { false, false };
+
+ char buf[] = "ccxx_dec";
+ for (size_t i = 0; i < ARRAY_SIZE(chans); ++i)
+ {
+ unsigned chan = chans[i];
+ sprintf(buf, "cc%u_dec", chan);
+
+ if (strcmp(region_in->p_text->psz_text, buf) == 0)
+ {
+ if (rendered[i])
+ return;
+ rendered[i] = true;
+ }
+ }
+
+ for (size_t i = 0; i < ARRAY_SIZE(chans); ++i)
+ {
+ if (!rendered[i])
+ return;
+ }
+
+ vlc_sem_post(&scenario_data.wait_stop);
+}
+
+static void player_setup_select_ccdec_708_1064(vlc_player_t *player)
+{
+ vlc_player_SelectTracksByStringIds(player, SPU_ES,
+ "video/0/cc/spu/10,video/0/cc/spu/64");
+}
+
static const vlc_fourcc_t subpicture_chromas[] = {
VLC_CODEC_RGBA, 0
};
@@ -520,7 +611,7 @@ struct input_decoder_scenario input_decoder_scenarios[] =
- the stream_out filter signal the end of the test */
.name = "stream output is also flushed",
.source = source_800_600,
- .sout = "#" MODULE_STRING,
+ .item_option = ":sout=#" MODULE_STRING,
.sout_filter_send = sout_filter_send,
.sout_filter_flush = sout_filter_flush,
.interface_setup = interface_setup_check_flush,
@@ -548,7 +639,7 @@ struct input_decoder_scenario input_decoder_scenarios[] =
{
.name = "CC frames are sent to the sout",
.source = source_800_600,
- .sout = "#" MODULE_STRING,
+ .item_option = ":sout=#" MODULE_STRING,
.packetizer_getcc = packetizer_getcc,
.sout_filter_send = sout_filter_wait_cc,
.sout_filter_flush = sout_filter_flush,
@@ -604,6 +695,28 @@ struct input_decoder_scenario input_decoder_scenarios[] =
.decoder_decode = decoder_decode_drop,
.on_track_list_changed = on_track_list_changed_check_cea608_count,
},
+{
+ .name = "we can create 64 cea708 tracks",
+ .source = source_800_600 ";video_packetized=false",
+ .item_option = ":captions=708",
+ .packetizer_getcc = packetizer_getcc_cea708_max,
+ .decoder_setup = decoder_i420_800_600,
+ .decoder_decode = decoder_decode_drop,
+ .on_track_list_changed = on_track_list_changed_check_cea708_count,
+},
+{
+ .name = "cea708 10 and 63 tracks can be rendered simultaneously",
+ .source = source_800_600 ";video_packetized=false",
+ .item_option = ":captions=708",
+ .packetizer_getcc = packetizer_getcc_cea708_1064,
+ .decoder_setup = decoder_i420_800_600_update,
+ .decoder_decode = decoder_decode,
+ .cc_decoder_setup = cc_decoder_setup_708_1064,
+ .cc_decoder_decode = cc_decoder_decode_channel,
+ .display_prepare = display_prepare_noop,
+ .text_renderer_render = cc_text_renderer_render_708_1064,
+ .player_setup_before_start = player_setup_select_ccdec_708_1064,
+},
};
size_t input_decoder_scenarios_count = ARRAY_SIZE(input_decoder_scenarios);
@@ -615,7 +728,7 @@ void input_decoder_scenario_init(void)
scenario_data.has_reload = false;
scenario_data.stream_out_sent = false;
scenario_data.decoder_image_sent = 0;
- scenario_data.cc_track_idx = 0;
+ scenario_data.cc_track_idx = 1;
vlc_sem_init(&scenario_data.wait_stop, 0);
vlc_sem_init(&scenario_data.wait_ready_to_flush, 0);
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/70d1d26280a212cfcb86a831ed8b2dcb02f4ca99...0e543f38e8d4d3673704af6702f5b823bb2739d8
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/70d1d26280a212cfcb86a831ed8b2dcb02f4ca99...0e543f38e8d4d3673704af6702f5b823bb2739d8
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