mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	module-rtp/stream: Add ability to set marker on first packet
This commit is contained in:
		
							parent
							
								
									98db54f55d
								
							
						
					
					
						commit
						9eba60a635
					
				
					 2 changed files with 10 additions and 1 deletions
				
			
		| 
						 | 
					@ -226,6 +226,10 @@ static void rtp_audio_flush_packets(struct impl *impl)
 | 
				
			||||||
	iov[0].iov_len = sizeof(header);
 | 
						iov[0].iov_len = sizeof(header);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while (avail >= tosend) {
 | 
						while (avail >= tosend) {
 | 
				
			||||||
 | 
							if (impl->marker_on_first && impl->first)
 | 
				
			||||||
 | 
								header.m = 1;
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								header.m = 0;
 | 
				
			||||||
		header.sequence_number = htons(impl->seq);
 | 
							header.sequence_number = htons(impl->seq);
 | 
				
			||||||
		header.timestamp = htonl(impl->ts_offset + timestamp);
 | 
							header.timestamp = htonl(impl->ts_offset + timestamp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -234,11 +238,12 @@ static void rtp_audio_flush_packets(struct impl *impl)
 | 
				
			||||||
			(timestamp * stride) & BUFFER_MASK,
 | 
								(timestamp * stride) & BUFFER_MASK,
 | 
				
			||||||
			&iov[1], tosend * stride);
 | 
								&iov[1], tosend * stride);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		pw_log_trace("sending %d timestamp:%d", tosend, timestamp);
 | 
							pw_log_trace("sending %d avail:%d ts_offset:%d timestamp:%d", tosend, avail, impl->ts_offset, timestamp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		rtp_stream_emit_send_packet(impl, iov, 3);
 | 
							rtp_stream_emit_send_packet(impl, iov, 3);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		impl->seq++;
 | 
							impl->seq++;
 | 
				
			||||||
 | 
							impl->first = false;
 | 
				
			||||||
		timestamp += tosend;
 | 
							timestamp += tosend;
 | 
				
			||||||
		avail -= tosend;
 | 
							avail -= tosend;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -58,6 +58,7 @@ struct impl {
 | 
				
			||||||
	unsigned have_ssrc:1;
 | 
						unsigned have_ssrc:1;
 | 
				
			||||||
	unsigned ignore_ssrc:1;
 | 
						unsigned ignore_ssrc:1;
 | 
				
			||||||
	unsigned have_seq:1;
 | 
						unsigned have_seq:1;
 | 
				
			||||||
 | 
						unsigned marker_on_first:1;
 | 
				
			||||||
	uint32_t ts_offset;
 | 
						uint32_t ts_offset;
 | 
				
			||||||
	uint32_t psamples;
 | 
						uint32_t psamples;
 | 
				
			||||||
	uint32_t mtu;
 | 
						uint32_t mtu;
 | 
				
			||||||
| 
						 | 
					@ -132,6 +133,8 @@ static int stream_start(struct impl *impl)
 | 
				
			||||||
	if (impl->started)
 | 
						if (impl->started)
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						impl->first = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rtp_stream_emit_state_changed(impl, true, NULL);
 | 
						rtp_stream_emit_state_changed(impl, true, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl->started = true;
 | 
						impl->started = true;
 | 
				
			||||||
| 
						 | 
					@ -364,6 +367,7 @@ struct rtp_stream *rtp_stream_new(struct pw_core *core,
 | 
				
			||||||
	if (pw_properties_get(props, PW_KEY_NODE_NETWORK) == NULL)
 | 
						if (pw_properties_get(props, PW_KEY_NODE_NETWORK) == NULL)
 | 
				
			||||||
		pw_properties_set(props, PW_KEY_NODE_NETWORK, "true");
 | 
							pw_properties_set(props, PW_KEY_NODE_NETWORK, "true");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						impl->marker_on_first = pw_properties_get_bool(props, "sess.marker-on-first", false);
 | 
				
			||||||
	impl->ignore_ssrc = pw_properties_get_bool(props, "sess.ignore-ssrc", false);
 | 
						impl->ignore_ssrc = pw_properties_get_bool(props, "sess.ignore-ssrc", false);
 | 
				
			||||||
	impl->direct_timestamp = pw_properties_get_bool(props, "sess.ts-direct", false);
 | 
						impl->direct_timestamp = pw_properties_get_bool(props, "sess.ts-direct", false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue