Revision a27e90d3 plugins/janus_videoroom.c

View differences:

plugins/janus_videoroom.c
464 464
	guint8 playout_delay_extmap_id;	/* Playout delay extmap ID */
465 465
	gboolean audio_active;
466 466
	gboolean video_active;
467
	int audio_active_packets; /* number of packets received with audio_levl extmap sdp header */
468
	int audio_dBov_sum;
467 469
	gboolean firefox;	/* We send Firefox users a different kind of FIR */
468 470
	uint64_t bitrate;
469 471
	gint64 remb_startup;/* Incremental changes on REMB to reach the target at startup */
......
2292 2294
	if(!session || session->destroyed || !session->participant || session->participant_type != janus_videoroom_p_type_publisher)
2293 2295
		return;
2294 2296
	janus_videoroom_participant *participant = (janus_videoroom_participant *)session->participant;
2297
	if(participant->audio_level_extmap_id > 0) {
2298
	    int level = 0;
2299
	    int audio_level = janus_rtp_header_extension_parse_audio_level_and_return(buf, len, participant->audio_level_extmap_id, &level);
2300
	    participant->audio_dBov_sum = participant->audio_dBov_sum + audio_level;
2301
	    participant->audio_active_packets = participant->audio_active_packets + 1;
2302
	        if(participant->audio_active_packets == 60) {
2303
	            if(participant->audio_dBov_sum < 1200) {
2304
	               float avg = (float)participant->audio_dBov_sum / participant->audio_active_packets;
2305
	               if(notify_events && gateway->events_is_enabled()) {
2306
	                  json_t *info = json_object();
2307
                      json_object_set_new(info, "event", json_string("talking"));
2308
                      json_object_set_new(info, "room", json_string(participant->room));
2309
                      json_object_set_new(info, "user", json_integer(participant->user_id));
2310
                      gateway->notify_event(&janus_videoroom_plugin, handle, info);
2311
                      json_decref(info);
2312
                   }
2313
	               JANUS_LOG(LOG_ERR, "Got audio_active_packets of 30 pkts from user: %" G_GUINT64_FORMAT" with average audio_dBov of: %f \n", participant->user_id, avg);
2314
	            }
2315
                participant->audio_active_packets = 0;
2316
                participant->audio_dBov_sum = 0;
2317
	        }
2318
    }
2295 2319
	if((!video && participant->audio_active) || (video && participant->video_active)) {
2296 2320
		/* Update payload type and SSRC */
2297 2321
		janus_mutex_lock(&participant->rtp_forwarders_mutex);

Also available in: Unified diff