Rémi Bernon (@rbernon) commented about dlls/mf/topology_loader.c:
if (FAILED(hr = topology_branch_connect(context->output_topology, method_mask, branch, NULL))) goto done;
+ if (optional_node)
It seems to me that the control flow should better reflect the logic, here it looks like we are only considering one optional node (although it gets updated below in a loop). As far as I can tell from native behavior logic above, it seems to me that there's some sort of recursion happening after optional node is inserted. Roughly something like that (but it could be modeled differently perhaps): ``` connect_node( U: node, M: method, C: nodes ): - foreach U output stream US, leading to non-optional downstream node D with input stream DS and method DM: - return failure if connect_branch( U, US, D, DS, M | DM ) fails - foreach optional node O with input stream OS and method OM between U/US and D/DS: - break if connect_branch( U, US, O, OS, OM ) and connect_node( O, OM, C ) succeed - connect_branch( U, US, D, DS, M | DM ) # restore connection on failure - insert D in C if not already there - remove U from C ``` -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10645#note_137737