Revision 83e899f3 plugins/janus_videocall.c

View differences:

plugins/janus_videocall.c
705 705
		/* Slow uplink or downlink, maybe we set the bitrate cap too high? */
706 706
		if(video) {
707 707
			/* Halve the bitrate, but don't go too low... */
708
			if(uplink) {
709
				/* Uplink issue, halve this user's bitrate cap */
708
			if(!uplink) {
709
				/* Downlink issue, user has trouble sending, halve this user's bitrate cap */
710 710
				session->bitrate = session->bitrate > 0 ? session->bitrate : 512*1024;
711 711
				session->bitrate = session->bitrate/2;
712 712
				if(session->bitrate < 64*1024)
713 713
					session->bitrate = 64*1024;
714 714
			} else {
715
				/* Downlink issue, halve this user's peer's bitrate cap */
715
				/* Uplink issue, user has trouble receiving, halve this user's peer's bitrate cap */
716 716
				if(session->peer == NULL || session->peer->handle == NULL)
717 717
					return;	/* Nothing to do */
718 718
				session->peer->bitrate = session->peer->bitrate > 0 ? session->peer->bitrate : 512*1024;
......
721 721
					session->peer->bitrate = 64*1024;
722 722
			}
723 723
			JANUS_LOG(LOG_WARN, "Getting a lot of NACKs (slow %s) for %s, forcing a lower REMB: %"SCNu64"\n",
724
				uplink ? "uplink" : "downlink", video ? "video" : "audio", uplink ? session->bitrate : session->peer->bitrate);
724
				uplink ? "uplink" : "downlink", video ? "video" : "audio", uplink ? session->peer->bitrate : session->bitrate);
725 725
			/* ... and send a new REMB back */
726 726
			char rtcpbuf[200];
727 727
			memset(rtcpbuf, 0, 200);
......
736 736
			int sdeslen = janus_rtcp_sdes((char *)(&rtcpbuf)+rrlen, 200-rrlen, "janusvideo", 10);
737 737
			if(sdeslen > 0) {
738 738
				/* ... and then finally a REMB */
739
				janus_rtcp_remb((char *)(&rtcpbuf)+rrlen+sdeslen, 24, uplink ? session->bitrate : session->peer->bitrate);
740
				gateway->relay_rtcp(uplink ? handle : session->peer->handle, 1, rtcpbuf, rrlen+sdeslen+24);
739
				janus_rtcp_remb((char *)(&rtcpbuf)+rrlen+sdeslen, 24, uplink ? session->peer->bitrate : session->bitrate);
740
				gateway->relay_rtcp(uplink ? session->peer->handle : handle, 1, rtcpbuf, rrlen+sdeslen+24);
741 741
			}
742 742

  
743 743
		}

Also available in: Unified diff