Please let me how you are handling the switching now in your firmware.
We can suggest if there is a better way of doing this.
How much time it is taking now for switching between two cameras?
I decode the brightness ser_cur state in CyCx3UvcAppUSBSetupCB and perform these calls:
The setbrightness function simply sets I/O 26 (the multiplexer's select input) to the boolean requested_brightness value. Changing the MUX input disrupts the CX3's input from the sensor and results in the system stalling, as one would expect since the transition isn't synchronized to the input MIPI stream. I found the easiest way to resume streaming is to reinitialize the sensor by calling resetcameraresolution(). This function restarts streaming by calling the original sensor initialization routine based on the last selected sensor resolution. Resetcameraresolution() calls one of: CyCx3_ImageSensor_Set_5M(), CyCx3_ImageSensor_Set_1080p(), ..._720p(), or CyCx3_ImageSensor_Set_Vga() to match the mode of the imager.
The switching time varies, but is typically between two and five frames. There are notable discontinuities in the video.
You are doing correctly.
Since the data streams stop from one sensor and getting started from another sensor, there will be a frame loss as you mentioned. If you adding some delays intentionally in the source, you may reduce/remove them to reduce the number of frames being lost.