Video Device - Active vs Passive

BL
Brian Lee
Mon, Jan 22, 2018 5:22 PM

Hi All,

I am trying to implement a video device that gets data externally. The
external data comes via a library with a callback at 25 fps.

Copying the colorbar example, I see that there is the option of Active or
Passive mode for the video device. As I understand it: Passive mode has
pjsip provide the clock for the device, whereas Active mode has the device
create its own clock, and it calls stream->vid_cb.capture_cb when it has
data available. This is switched on/off via the "has_callback" option.

This seemed to be pretty straight forward until I noticed that the encoder
seems to be getting frames seemingly from nowhere, e.g. when I explicitly
do not call the callback function from the video device.

It seems that there is some logic in vid_port.c around this - e.g. in the
function enc_clock_cb there is the following statement:

/* We are here because user wants us to be active but the stream is
 * passive. So get a frame from the stream and push it to user.
 */

This seems to suggest that the active role is overridden for some reason. I
am having a hard time following the logic through, or at least the
reasoning behind it.

Can anyone explain why I still get frames sent to the encoder when I am not
pushing them from the video device callback? Is this a bug, intended
functionality or a misunderstanding on my part?

Thanks,

Brian.

Hi All, I am trying to implement a video device that gets data externally. The external data comes via a library with a callback at 25 fps. Copying the colorbar example, I see that there is the option of Active or Passive mode for the video device. As I understand it: Passive mode has pjsip provide the clock for the device, whereas Active mode has the device create its own clock, and it calls stream->vid_cb.capture_cb when it has data available. This is switched on/off via the "has_callback" option. This seemed to be pretty straight forward until I noticed that the encoder seems to be getting frames seemingly from nowhere, e.g. when I explicitly do not call the callback function from the video device. It seems that there is some logic in vid_port.c around this - e.g. in the function enc_clock_cb there is the following statement: /* We are here because user wants us to be active but the stream is * passive. So get a frame from the stream and push it to user. */ This seems to suggest that the active role is overridden for some reason. I am having a hard time following the logic through, or at least the reasoning behind it. Can anyone explain why I still get frames sent to the encoder when I am not pushing them from the video device callback? Is this a bug, intended functionality or a misunderstanding on my part? Thanks, Brian.