mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	module-rtp: Allow overriding session ID
This allows us to specify a static session ID, so that (Dante) receivers can uniquely identify us as a sender. This prevents duplicate streams in Dante Controller, for example.
This commit is contained in:
		
							parent
							
								
									f5512e8b88
								
							
						
					
					
						commit
						7c8453f260
					
				
					 2 changed files with 14 additions and 4 deletions
				
			
		| 
						 | 
					@ -179,7 +179,7 @@ static const struct spa_dict_item module_info[] = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct sdp_info {
 | 
					struct sdp_info {
 | 
				
			||||||
	uint16_t hash;
 | 
						uint16_t hash;
 | 
				
			||||||
	uint32_t ntp;
 | 
						uint32_t session_id;
 | 
				
			||||||
	uint32_t t_ntp;
 | 
						uint32_t t_ntp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	char *origin;
 | 
						char *origin;
 | 
				
			||||||
| 
						 | 
					@ -692,7 +692,7 @@ static int send_sap(struct impl *impl, struct session *sess, bool bye)
 | 
				
			||||||
			"c=IN %s %s%s\n"
 | 
								"c=IN %s %s%s\n"
 | 
				
			||||||
			"t=%u 0\n"
 | 
								"t=%u 0\n"
 | 
				
			||||||
			"m=%s %u RTP/AVP %i\n",
 | 
								"m=%s %u RTP/AVP %i\n",
 | 
				
			||||||
			user_name, sdp->ntp, src_ip4 ? "IP4" : "IP6", src_addr,
 | 
								user_name, sdp->session_id, src_ip4 ? "IP4" : "IP6", src_addr,
 | 
				
			||||||
			sdp->session_name,
 | 
								sdp->session_name,
 | 
				
			||||||
			dst_ip4 ? "IP4" : "IP6", dst_addr, dst_ttl,
 | 
								dst_ip4 ? "IP4" : "IP6", dst_addr, dst_ttl,
 | 
				
			||||||
			sdp->t_ntp,
 | 
								sdp->t_ntp,
 | 
				
			||||||
| 
						 | 
					@ -854,8 +854,17 @@ static struct session *session_new_announce(struct impl *impl, struct node *node
 | 
				
			||||||
	sess->announce = true;
 | 
						sess->announce = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sdp->hash = pw_rand32();
 | 
						sdp->hash = pw_rand32();
 | 
				
			||||||
	sdp->ntp = (uint32_t) time(NULL) + 2208988800U + impl->n_sessions;
 | 
						if ((str = pw_properties_get(props, "sess.id")) != NULL) {
 | 
				
			||||||
	sdp->t_ntp = pw_properties_get_uint32(props, "rtp.ntp", sdp->ntp);
 | 
							if (!spa_atou32(str, &sdp->session_id, 10)) {
 | 
				
			||||||
 | 
								pw_log_error("Invalid session id: %s (must be a uint32)", str);
 | 
				
			||||||
 | 
								goto error_free;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							sdp->t_ntp = pw_properties_get_uint32(props, "rtp.ntp",
 | 
				
			||||||
 | 
									(uint32_t) time(NULL) + 2208988800U + impl->n_sessions);
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							sdp->session_id = (uint32_t) time(NULL) + 2208988800U + impl->n_sessions;
 | 
				
			||||||
 | 
							sdp->t_ntp = pw_properties_get_uint32(props, "rtp.ntp", sdp->session_id);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	sess->props = props;
 | 
						sess->props = props;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((str = pw_properties_get(props, "sess.name")) == NULL)
 | 
						if ((str = pw_properties_get(props, "sess.name")) == NULL)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -529,6 +529,7 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	copy_props(impl, props, "net.mtu");
 | 
						copy_props(impl, props, "net.mtu");
 | 
				
			||||||
	copy_props(impl, props, "sess.media");
 | 
						copy_props(impl, props, "sess.media");
 | 
				
			||||||
	copy_props(impl, props, "sess.name");
 | 
						copy_props(impl, props, "sess.name");
 | 
				
			||||||
 | 
						copy_props(impl, props, "sess.id");
 | 
				
			||||||
	copy_props(impl, props, "sess.min-ptime");
 | 
						copy_props(impl, props, "sess.min-ptime");
 | 
				
			||||||
	copy_props(impl, props, "sess.max-ptime");
 | 
						copy_props(impl, props, "sess.max-ptime");
 | 
				
			||||||
	copy_props(impl, props, "sess.latency.msec");
 | 
						copy_props(impl, props, "sess.latency.msec");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue