Skip to content

Crash with -t switcher:excl_init + possible fix (switcher.c) #498

@armelvil

Description

@armelvil

I first noticed this issue after rebasing my fork from upstream March 13th -> May 28th.

Switching between inputs, when excl_init is enabled on the switcher, reliably results in the process running the encoder crashing.

After poking at the code for a few hours, I got to this:

After the init loop advances 'tmp' through all devices via vidcap_params_get_next(), tmp points to the NULL-driver stopper node, not the head of the params list. Passing it to vidcap_params_copy_all() stored only a single stopper node instead of the full device chain.

When a subsequent device switch occurred (via capture.data N), vidcap_params_get_nth() returned NULL for all devices, which was passed to initialize_video_capture() and caused a SEGV in vidcap_params_get_next(NULL).

Use the original 'params' pointer (head of list) instead of the exhausted loop variable.

After compilation with this patch and testing, the patched version seems to show expected behavior (switching works, no crash)

Note: I have to use excl_init on the encoder end, as multiple v4l2 inputs without that setting seem to result in some level of concatenation/overwrite between both devices when output to a decoder client. I haven't had time to work out why that is happening yet.

Code change is here:

master...armelvil:UltraGrid:fix/switcher-excl-init-crash

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions