Revision d7299f20

View differences:

plugins/janus_recordplay.c
376 376
	guint64 video_remb_last;
377 377
	guint64 video_bitrate;
378 378
	guint64 video_rtp_seq_number;
379
	gint video_fir_seq;
379 380
	guint64 destroyed;	/* Time at which this session was marked as destroyed */
380 381
} janus_recordplay_session;
381 382
static GHashTable *sessions;
......
632 633
	session->video_remb_last = janus_get_monotonic_time();
633 634
	session->video_bitrate = 1024 * 1024; // 1 megabit
634 635
	session->video_rtp_seq_number = 0;
636
	session->video_fir_seq = 0;
635 637
	handle->plugin_handle = session;
636 638
	janus_mutex_lock(&sessions_mutex);
637 639
	g_hash_table_insert(sessions, handle, session);
......
859 861
}
860 862

  
861 863
void janus_recordplay_send_rtcp_feedback(janus_plugin_session *handle, int video, char *buf, int len) {
862
	janus_recordplay_session *session = (janus_recordplay_session *)handle->plugin_handle;
863

  
864 864
	if (video != 1) { return; } // we just do this for video, for now
865
	janus_recordplay_session *session = (janus_recordplay_session *)handle->plugin_handle;
866
	char rtcpbuf[200];
865 867

  
866 868
	rtp_header *rtp = (rtp_header *)buf;
867 869
	guint64 rtp_lost_count = (ntohs(rtp->seq_number) - session->video_rtp_seq_number) - 1;
868 870
	session->video_rtp_seq_number = ntohs(rtp->seq_number);
869 871

  
870 872
	if (rtp_lost_count > 0) {
871
		JANUS_LOG(LOG_ERR, "We lost %llu video packets\n", rtp_lost_count);
872
		char rtcpbuf[20];
873
		JANUS_LOG(LOG_ERR, "We lost %"SCNu64" video packets\n", rtp_lost_count);
874
		// send fir, pli, and a wtf
875
		memset(rtcpbuf, 0, 20);
876
		janus_rtcp_fir((char *)&rtcpbuf, 20, &session->video_fir_seq);
877
		gateway->relay_rtcp(handle, video, rtcpbuf, 20);
873 878
		memset(rtcpbuf, 0, 12);
874 879
		janus_rtcp_pli((char *)&rtcpbuf, 12);
875 880
		gateway->relay_rtcp(handle, video, rtcpbuf, 12);
876 881
	}
877 882

  
878
	// TODO: send PLI if we lost packets (comparing sequence numbers)
879
	// memset(rtcpbuf, 0, 12);
880
	// janus_rtcp_pli((char *)&rtcpbuf, 12);
881
	// gateway->relay_rtcp(handle, video, rtcpbuf, 12);
882

  
883 883
	// send REMB every second
884 884
	gint64 now = janus_get_monotonic_time();
885 885
	guint64 elapsed = now - session->video_remb_last;
......
895 895
		session->video_remb_startup--;
896 896
	}
897 897

  
898
	char rtcpbuf[200];
899 898
	memset(rtcpbuf, 0, 200);
900 899
	/* FIXME First put a RR (fake)... */
901 900
	int rrlen = 32;

Also available in: Unified diff