Revision 5de69b28 plugins/janus_videoroom.c

View differences:

plugins/janus_videoroom.c
3502 3502
					goto error;
3503 3503
				}
3504 3504
				gboolean audio_level_extmap = FALSE, video_orient_extmap = FALSE, playout_delay_extmap = FALSE;
3505
				janus_sdp_mdirection audio_level_mdir = JANUS_SDP_SENDRECV,
3506
					video_orient_mdir = JANUS_SDP_SENDRECV,
3507
					playout_delay_mdir = JANUS_SDP_SENDRECV;
3505 3508
				GList *temp = offer->m_lines;
3506 3509
				while(temp) {
3507 3510
					/* Which media are available? */
......
3522 3525
								if(videoroom->audiolevel_ext && m->type == JANUS_SDP_AUDIO && strstr(a->value, JANUS_RTP_EXTMAP_AUDIO_LEVEL)) {
3523 3526
									participant->audio_level_extmap_id = atoi(a->value);
3524 3527
									audio_level_extmap = TRUE;
3528
									audio_level_mdir = a->direction;
3525 3529
								} else if(videoroom->videoorient_ext && m->type == JANUS_SDP_VIDEO && strstr(a->value, JANUS_RTP_EXTMAP_VIDEO_ORIENTATION)) {
3526 3530
									participant->video_orient_extmap_id = atoi(a->value);
3527 3531
									video_orient_extmap = TRUE;
3532
									video_orient_mdir = a->direction;
3528 3533
								} else if(videoroom->playoutdelay_ext && m->type == JANUS_SDP_VIDEO && strstr(a->value, JANUS_RTP_EXTMAP_PLAYOUT_DELAY)) {
3529 3534
									participant->playout_delay_extmap_id = atoi(a->value);
3530 3535
									playout_delay_extmap = TRUE;
3536
									playout_delay_mdir = a->direction;
3531 3537
								}
3532 3538
							}
3533 3539
							ma = ma->next;
......
3578 3584
				}
3579 3585
				/* Add the extmap attributes, if needed */
3580 3586
				if(audio_level_extmap) {
3587
					/* First of all, let's check if the extmap attribute had a direction */
3588
					const char *direction = NULL;
3589
					switch(audio_level_mdir) {
3590
						case JANUS_SDP_SENDONLY:
3591
							direction = "/recvonly";
3592
							break;
3593
						case JANUS_SDP_RECVONLY:
3594
						case JANUS_SDP_INACTIVE:
3595
							direction = "/inactive";
3596
							break;
3597
						default:
3598
							direction = "";
3599
							break;
3600
					}
3581 3601
					janus_sdp_attribute *a = janus_sdp_attribute_create("extmap",
3582
						"%d %s\r\n", participant->audio_level_extmap_id, JANUS_RTP_EXTMAP_AUDIO_LEVEL);
3602
						"%d%s %s\r\n", participant->audio_level_extmap_id, direction, JANUS_RTP_EXTMAP_AUDIO_LEVEL);
3583 3603
					janus_sdp_attribute_add_to_mline(janus_sdp_mline_find(answer, JANUS_SDP_AUDIO), a);
3584 3604
				}
3585 3605
				if(video_orient_extmap) {
3606
					/* First of all, let's check if the extmap attribute had a direction */
3607
					const char *direction = NULL;
3608
					switch(video_orient_mdir) {
3609
						case JANUS_SDP_SENDONLY:
3610
							direction = "/recvonly";
3611
							break;
3612
						case JANUS_SDP_RECVONLY:
3613
						case JANUS_SDP_INACTIVE:
3614
							direction = "/inactive";
3615
							break;
3616
						default:
3617
							direction = "";
3618
							break;
3619
					}
3586 3620
					janus_sdp_attribute *a = janus_sdp_attribute_create("extmap",
3587
						"%d %s\r\n", participant->video_orient_extmap_id, JANUS_RTP_EXTMAP_VIDEO_ORIENTATION);
3621
						"%d%s %s\r\n", participant->video_orient_extmap_id, direction, JANUS_RTP_EXTMAP_VIDEO_ORIENTATION);
3588 3622
					janus_sdp_attribute_add_to_mline(janus_sdp_mline_find(answer, JANUS_SDP_VIDEO), a);
3589 3623
				}
3590 3624
				if(playout_delay_extmap) {
3625
					/* First of all, let's check if the extmap attribute had a direction */
3626
					const char *direction = NULL;
3627
					switch(playout_delay_mdir) {
3628
						case JANUS_SDP_SENDONLY:
3629
							direction = "/recvonly";
3630
							break;
3631
						case JANUS_SDP_RECVONLY:
3632
						case JANUS_SDP_INACTIVE:
3633
							direction = "/inactive";
3634
							break;
3635
						default:
3636
							direction = "";
3637
							break;
3638
					}
3591 3639
					janus_sdp_attribute *a = janus_sdp_attribute_create("extmap",
3592
						"%d %s\r\n", participant->playout_delay_extmap_id, JANUS_RTP_EXTMAP_PLAYOUT_DELAY);
3640
						"%d%s %s\r\n", participant->playout_delay_extmap_id, direction, JANUS_RTP_EXTMAP_PLAYOUT_DELAY);
3593 3641
					janus_sdp_attribute_add_to_mline(janus_sdp_mline_find(answer, JANUS_SDP_VIDEO), a);
3594 3642
				}
3595 3643
				/* Generate an SDP string we can send back to the publisher */

Also available in: Unified diff