mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	rtp-stream: do not set false ptime values
This commit is contained in:
		
							parent
							
								
									6d2b43b51c
								
							
						
					
					
						commit
						991e3928d4
					
				
					 2 changed files with 14 additions and 4 deletions
				
			
		| 
						 | 
					@ -899,6 +899,7 @@ static struct session *session_new(struct impl *impl, struct sdp_info *info)
 | 
				
			||||||
	pw_properties_setf(props, "rtp.destination.ip", "%s", dst_addr);
 | 
						pw_properties_setf(props, "rtp.destination.ip", "%s", dst_addr);
 | 
				
			||||||
	pw_properties_setf(props, "rtp.destination.port", "%u", info->dst_port);
 | 
						pw_properties_setf(props, "rtp.destination.port", "%u", info->dst_port);
 | 
				
			||||||
	pw_properties_setf(props, "rtp.payload", "%u", info->payload);
 | 
						pw_properties_setf(props, "rtp.payload", "%u", info->payload);
 | 
				
			||||||
 | 
						pw_properties_setf(props, "rtp.ptime", "%f", info->ptime);
 | 
				
			||||||
	pw_properties_setf(props, "rtp.media", "%s", info->media_type);
 | 
						pw_properties_setf(props, "rtp.media", "%s", info->media_type);
 | 
				
			||||||
	pw_properties_setf(props, "rtp.mime", "%s", info->mime_type);
 | 
						pw_properties_setf(props, "rtp.mime", "%s", info->mime_type);
 | 
				
			||||||
	pw_properties_setf(props, "rtp.rate", "%u", info->rate);
 | 
						pw_properties_setf(props, "rtp.rate", "%u", info->rate);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -389,9 +389,20 @@ struct rtp_stream *rtp_stream_new(struct pw_core *core,
 | 
				
			||||||
	min_samples = min_ptime * impl->rate / 1000;
 | 
						min_samples = min_ptime * impl->rate / 1000;
 | 
				
			||||||
	max_samples = max_ptime * impl->rate / 1000;
 | 
						max_samples = max_ptime * impl->rate / 1000;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						float ptime = 0;
 | 
				
			||||||
 | 
						if ((str = pw_properties_get(props, "rtp.ptime")) != NULL)
 | 
				
			||||||
 | 
							if (!spa_atof(str, &ptime))
 | 
				
			||||||
 | 
								ptime = 0.0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (ptime) {
 | 
				
			||||||
 | 
							impl->psamples = ptime * impl->rate / 1000;
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
		impl->psamples = impl->mtu / impl->stride;
 | 
							impl->psamples = impl->mtu / impl->stride;
 | 
				
			||||||
		impl->psamples = SPA_CLAMP(impl->psamples, min_samples, max_samples);
 | 
							impl->psamples = SPA_CLAMP(impl->psamples, min_samples, max_samples);
 | 
				
			||||||
 | 
							if (direction == PW_DIRECTION_OUTPUT)
 | 
				
			||||||
 | 
								pw_properties_setf(props, "rtp.ptime", "%f",
 | 
				
			||||||
 | 
										impl->psamples * 1000.0 / impl->rate);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	latency_msec = pw_properties_get_uint32(props,
 | 
						latency_msec = pw_properties_get_uint32(props,
 | 
				
			||||||
			"sess.latency.msec", DEFAULT_SESS_LATENCY);
 | 
								"sess.latency.msec", DEFAULT_SESS_LATENCY);
 | 
				
			||||||
	impl->target_buffer = msec_to_samples(impl, latency_msec);
 | 
						impl->target_buffer = msec_to_samples(impl, latency_msec);
 | 
				
			||||||
| 
						 | 
					@ -407,8 +418,6 @@ struct rtp_stream *rtp_stream_new(struct pw_core *core,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_properties_setf(props, "net.mtu", "%u", impl->mtu);
 | 
						pw_properties_setf(props, "net.mtu", "%u", impl->mtu);
 | 
				
			||||||
	pw_properties_setf(props, "rtp.ptime", "%f",
 | 
					 | 
				
			||||||
			impl->psamples * 1000.0 / impl->rate);
 | 
					 | 
				
			||||||
	pw_properties_setf(props, "rtp.media", "%s", impl->format_info->media_type);
 | 
						pw_properties_setf(props, "rtp.media", "%s", impl->format_info->media_type);
 | 
				
			||||||
	pw_properties_setf(props, "rtp.mime", "%s", impl->format_info->mime);
 | 
						pw_properties_setf(props, "rtp.mime", "%s", impl->format_info->mime);
 | 
				
			||||||
	pw_properties_setf(props, "rtp.payload", "%u", impl->payload);
 | 
						pw_properties_setf(props, "rtp.payload", "%u", impl->payload);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue