Repo: https://github.com/meetecho/janus-gateway
code: video sfu code at: plugins/janus_videoroom.c
How sub/pub works:
in its plugin implementation: plugins/janus_videoroom.c , there is:
struct janus_videoroom_publisher {
GSList subscribers; / Subscriptions to this publisher (who’s watching this publisher) */
GSList subscriptions; / Subscriptions this publisher has created (who this publisher is watching) */
}
for every incoming rtp from a publisher:
janus_videoroom_incoming_rtp( ) {
// strictly maybe it should be called the observe pattern ?as this g_slit_foreach is sort of synchronize function call? )
g_slist_foreach(participant->subscribers, janus_videoroom_relay_rtp_packet, &packet);
//It seems it request FIR ( key frame) every tot seconds:
janus_videoroom_reqfir(participant, “Regular keyframe request”);
}
for every incoming data from a publisher:
janus_videoroom_incoming_data
{
g_slist_foreach(participant->subscribers, janus_videoroom_relay_data_packet, &packet);
}