mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pw-cat: calculate number of samples properly with io_rate_match
Fixes wrong buffer sizes when adapter is configured in passthrough mode.
This commit is contained in:
		
							parent
							
								
									a701a500af
								
							
						
					
					
						commit
						34b1ecc244
					
				
					 1 changed files with 6 additions and 0 deletions
				
			
		| 
						 | 
					@ -153,6 +153,7 @@ struct data {
 | 
				
			||||||
	int sync;
 | 
						int sync;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct spa_io_position *position;
 | 
						struct spa_io_position *position;
 | 
				
			||||||
 | 
						struct spa_io_rate_match *rate_match;
 | 
				
			||||||
	bool drained;
 | 
						bool drained;
 | 
				
			||||||
	uint64_t clock_time;
 | 
						uint64_t clock_time;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -849,6 +850,9 @@ on_io_changed(void *userdata, uint32_t id, void *data, uint32_t size)
 | 
				
			||||||
	case SPA_IO_Position:
 | 
						case SPA_IO_Position:
 | 
				
			||||||
		d->position = data;
 | 
							d->position = data;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
						case SPA_IO_RateMatch:
 | 
				
			||||||
 | 
							d->rate_match = data;
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -887,6 +891,8 @@ static void on_process(void *userdata)
 | 
				
			||||||
	if (data->mode == mode_playback) {
 | 
						if (data->mode == mode_playback) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		n_frames = d->maxsize / data->stride;
 | 
							n_frames = d->maxsize / data->stride;
 | 
				
			||||||
 | 
							if (data->rate_match && data->rate_match->size > 0)
 | 
				
			||||||
 | 
								n_frames = SPA_MIN((uint32_t)n_frames, data->rate_match->size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		n_fill_frames = data->fill(data, p, n_frames);
 | 
							n_fill_frames = data->fill(data, p, n_frames);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue