Skip to content

Commit

Permalink
fixed bug from c3ed309
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanlf committed Feb 4, 2022
1 parent c3ed309 commit 8135259
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
14 changes: 9 additions & 5 deletions src/filter_core/filter.c
Expand Up @@ -1256,9 +1256,13 @@ static void filter_parse_dyn_args(GF_Filter *filter, const char *args, GF_Filter
) {
filter->force_demux = GF_TRUE;
}
if ((arg_type==GF_FILTER_ARG_EXPLICIT_SINK) || (arg_type==GF_FILTER_ARG_EXPLICIT)) {
if (filter->session->flags & GF_FS_FLAG_SINGLE_LINK)
filter->clonable = GF_TRUE;
//implicit linking mode: if not a script or if script init (initialized called) and no extra pid set, enable clonable
if ( (filter->session->flags & GF_FS_FLAG_SINGLE_LINK)
&& !filter->max_extra_pids
&& (for_script || !(filter->freg->flags&GF_FS_REG_SCRIPT))
&& ((arg_type==GF_FILTER_ARG_EXPLICIT_SINK) || (arg_type==GF_FILTER_ARG_EXPLICIT))
) {
filter->clonable = GF_FILTER_CLONE_PROBE;
}

//parse each arg
Expand Down Expand Up @@ -1640,9 +1644,9 @@ static void filter_parse_dyn_args(GF_Filter *filter, const char *args, GF_Filter
else if (!strcmp("clone", szArg)) {
if ((arg_type==GF_FILTER_ARG_EXPLICIT_SINK) || (arg_type==GF_FILTER_ARG_EXPLICIT)) {
if (value && (!strcmp(value, "0") || !strcmp(value, "false") || !strcmp(value, "no"))) {
filter->clonable = GF_FALSE;
filter->clonable = GF_FILTER_NO_CLONE;
} else {
filter->clonable = GF_TRUE;
filter->clonable = GF_FILTER_CLONE;
}
}
found = GF_TRUE;
Expand Down
14 changes: 11 additions & 3 deletions src/filter_core/filter_pid.c
Expand Up @@ -4212,8 +4212,11 @@ static void gf_filter_pid_init_task(GF_FSTask *task)
&& (filter_dst->num_input_pids || filter_dst->in_pid_connection_pending || filter_dst->in_link_resolution)
&& (!filter->swap_pidinst_dst || (filter->swap_pidinst_dst->filter != filter_dst))
) {
if ((filter_dst->clonable==GF_FILTER_CLONE_PROBE) && !(filter->session->flags & GF_FS_FLAG_SINGLE_LINK))
filter_dst->clonable = GF_FILTER_NO_CLONE;

//not explicitly clonable, don't connect to it
if (!filter_dst->clonable) {
if (filter_dst->clonable==GF_FILTER_NO_CLONE) {
GF_LOG(GF_LOG_DEBUG, GF_LOG_FILTER, ("Filter %s not clonable\n", filter_dst->name));
continue;
}
Expand Down Expand Up @@ -4442,7 +4445,7 @@ static void gf_filter_pid_init_task(GF_FSTask *task)

//if clonable filter and no match, check if we would match the caps without caps override of dest
//note we don't do this on sources for the time being, since this might trigger undesired resolution of file->file
if (!cap_matched && filter_dst->clonable && pid->filter->num_input_pids) {
if (!cap_matched && (filter_dst->clonable==GF_FILTER_CLONE) && pid->filter->num_input_pids) {
cap_matched = gf_filter_pid_caps_match(pid, filter_dst->freg, NULL, NULL, NULL, pid->filter->dst_filter, -1);
}

Expand Down Expand Up @@ -4562,11 +4565,16 @@ static void gf_filter_pid_init_task(GF_FSTask *task)
continue;
}
}
//target was in clone probe but we have loaded a mux, disable clone
if ((filter_dst->clonable==GF_FILTER_CLONE_PROBE) && new_f->max_extra_pids)
filter_dst->clonable = GF_FILTER_NO_CLONE;

gf_list_del_item(filter->destination_filters, filter_dst);
if (gf_list_find(new_f->destination_filters, filter_dst)>=0) {
if (!filter_dst->clonable)
if (filter_dst->clonable==GF_FILTER_NO_CLONE)
filter_dst->in_link_resolution = GF_TRUE;
}

filter_dst = new_f;
gf_list_add(loaded_filters, new_f);
}
Expand Down
12 changes: 11 additions & 1 deletion src/filter_core/filter_session.h
Expand Up @@ -518,6 +518,16 @@ typedef enum
GF_FILTER_ARG_EXPLICIT_SINK,
} GF_FilterArgType;

typedef enum
{
//filter cannot be cloned
GF_FILTER_NO_CLONE=0,
//filter can be cloned
GF_FILTER_CLONE,
//filter may be cloned in implicit link session mode only
GF_FILTER_CLONE_PROBE,
} GF_FilterCloneType;

struct __gf_filter
{
const GF_FilterRegister *freg;
Expand Down Expand Up @@ -690,7 +700,7 @@ struct __gf_filter
//2 means temporary sticky, used when reconfiguring filter chain
u32 sticky;
//explicitly loaded filters are usually not cloned, except if this flag is set
Bool clonable;
GF_FilterCloneType clonable;
//set to true during pid link resolution for filters accepting a single pid
Bool in_link_resolution;
//one of the output PID needs reconfiguration
Expand Down

0 comments on commit 8135259

Please sign in to comment.