Skip to content

Commit

Permalink
fixed filter session bugs
Browse files Browse the repository at this point in the history
- graph probing returning chains rejected by regular graph resolver
- possible extra cloning of filters when relinking an already connected PID
  • Loading branch information
jeanlf committed Apr 22, 2024
1 parent 54fa30c commit d6a7b54
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions include/gpac/filters.h
Expand Up @@ -3311,8 +3311,8 @@ GF_Err gf_filter_probe_link(GF_Filter *filter, u32 opid_idx, const char *fname,
/*! Gets list of possible destinations for this filter
\param filter target filter
\param opid_idx output pid index of target filter. If negative, will check destinations for any of the output pids
\param result_list resulting list as comma-separated list, or NULL if error. MUST be freed by caller
\return error if any
\param result_list resulting list as comma-separated list, or NULL if error. MUST be freed by caller. An empty chain means direct connection is possible
\return error if any, GF_FILTER_NOT_FOUND if no available chain
*/
GF_Err gf_filter_get_possible_destinations(GF_Filter *filter, s32 opid_idx, char **result_list);

Expand Down
11 changes: 10 additions & 1 deletion src/filter_core/filter_pid.c
Expand Up @@ -3847,6 +3847,7 @@ u32 gf_filter_pid_resolve_link_length(GF_FilterPid *pid, GF_Filter *dst)
return chain_len;
}

static Bool gf_filter_pid_needs_explicit_resolution(GF_FilterPid *pid, GF_Filter *dst);

GF_List *gf_filter_pid_compute_link(GF_FilterPid *pid, GF_Filter *dst)
{
Expand All @@ -3857,6 +3858,8 @@ GF_List *gf_filter_pid_compute_link(GF_FilterPid *pid, GF_Filter *dst)

if (!fsess->max_resolve_chain_len) return NULL;
if (!dst) return NULL;
if (gf_filter_pid_needs_explicit_resolution(pid, dst))
return NULL;

filter_chain = gf_list_new();

Expand Down Expand Up @@ -4672,7 +4675,13 @@ static void gf_filter_pid_init_task(GF_FSTask *task)
s32 ours = gf_list_find(pid->filter->destination_filters, filter_dst);
if (ours<0) {
ours = num_pass ? gf_list_del_item(pid->filter->destination_links, filter_dst) : -1;
if (!filter_dst->source_ids && (ours<0)) {
if ((ours<0) && (
//no source ID on filter, exclude
!filter_dst->source_ids
//dst is already linked and cannot accept more inputs, don't try to connect (this would trigger a clone)
//this is typically needed with defer linking when we reconnect outputs of a filter already connected
|| (filter_dst->num_input_pids && !filter_dst->max_extra_pids)
)) {
GF_LOG(GF_LOG_DEBUG, GF_LOG_FILTER, ("PID %s has destination filters, filter %s not one of them\n", pid->name, filter_dst->name));
continue;
}
Expand Down

0 comments on commit d6a7b54

Please sign in to comment.