mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	improve: debug
This commit is contained in:
		
							parent
							
								
									0eb2705766
								
							
						
					
					
						commit
						b1bfc900d6
					
				
					 3 changed files with 14 additions and 2 deletions
				
			
		| 
						 | 
					@ -83,7 +83,7 @@ struct spa_io_range {
 | 
				
			||||||
struct spa_io_clock {
 | 
					struct spa_io_clock {
 | 
				
			||||||
	uint32_t id;			/**< unique clock id, set by application */
 | 
						uint32_t id;			/**< unique clock id, set by application */
 | 
				
			||||||
	uint32_t flags;			/**< clock flags */
 | 
						uint32_t flags;			/**< clock flags */
 | 
				
			||||||
	uint64_t nsec;			/**< time in nanoseconds */
 | 
						uint64_t nsec;			/**< time in nanoseconds against monotonic clock */
 | 
				
			||||||
	uint64_t count;			/**< a media specific counter. Can be used to detect
 | 
						uint64_t count;			/**< a media specific counter. Can be used to detect
 | 
				
			||||||
					  *  gaps in the media. It usually represents the amount
 | 
										  *  gaps in the media. It usually represents the amount
 | 
				
			||||||
					  *  of processed media units (packets, frames,
 | 
										  *  of processed media units (packets, frames,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -139,7 +139,7 @@ static void impl_native_update_rate(struct resample *r, double rate)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static uint32_t impl_native_in_len(struct resample *r, uint32_t out_len)
 | 
					static uint32_t impl_native_in_len(struct resample *r, uint32_t out_len)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct native_data *data = r->data;					\
 | 
						struct native_data *data = r->data;
 | 
				
			||||||
	uint32_t in_len;
 | 
						uint32_t in_len;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	in_len = (data->phase + out_len * data->frac) / data->out_rate;
 | 
						in_len = (data->phase + out_len * data->frac) / data->out_rate;
 | 
				
			||||||
| 
						 | 
					@ -232,6 +232,8 @@ static void impl_native_process(struct resample *r,
 | 
				
			||||||
			for (c = 0; c < r->channels; c++)
 | 
								for (c = 0; c < r->channels; c++)
 | 
				
			||||||
				memmove(history[c], &history[c][in], remain * sizeof(float));
 | 
									memmove(history[c], &history[c][in], remain * sizeof(float));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							spa_log_trace_fp(r->log, "native %p: in:%d remain:%d", r, in, remain);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	data->hist = remain;
 | 
						data->hist = remain;
 | 
				
			||||||
	return;
 | 
						return;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,8 +29,11 @@
 | 
				
			||||||
#include <errno.h>
 | 
					#include <errno.h>
 | 
				
			||||||
#include <time.h>
 | 
					#include <time.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <spa/support/log-impl.h>
 | 
				
			||||||
#include <spa/debug/mem.h>
 | 
					#include <spa/debug/mem.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SPA_LOG_IMPL(logger);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "resample.h"
 | 
					#include "resample.h"
 | 
				
			||||||
#include "resample-native.h"
 | 
					#include "resample-native.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -65,6 +68,7 @@ static void test_native(void)
 | 
				
			||||||
	struct resample r;
 | 
						struct resample r;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_zero(r);
 | 
						spa_zero(r);
 | 
				
			||||||
 | 
						r.log = &logger.log;
 | 
				
			||||||
	r.channels = 1;
 | 
						r.channels = 1;
 | 
				
			||||||
	r.i_rate = 44100;
 | 
						r.i_rate = 44100;
 | 
				
			||||||
	r.o_rate = 44100;
 | 
						r.o_rate = 44100;
 | 
				
			||||||
| 
						 | 
					@ -73,6 +77,7 @@ static void test_native(void)
 | 
				
			||||||
	feed_1(&r);
 | 
						feed_1(&r);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_zero(r);
 | 
						spa_zero(r);
 | 
				
			||||||
 | 
						r.log = &logger.log;
 | 
				
			||||||
	r.channels = 1;
 | 
						r.channels = 1;
 | 
				
			||||||
	r.i_rate = 44100;
 | 
						r.i_rate = 44100;
 | 
				
			||||||
	r.o_rate = 48000;
 | 
						r.o_rate = 48000;
 | 
				
			||||||
| 
						 | 
					@ -114,6 +119,7 @@ static void test_in_len(void)
 | 
				
			||||||
	struct resample r;
 | 
						struct resample r;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_zero(r);
 | 
						spa_zero(r);
 | 
				
			||||||
 | 
						r.log = &logger.log;
 | 
				
			||||||
	r.channels = 1;
 | 
						r.channels = 1;
 | 
				
			||||||
	r.i_rate = 32000;
 | 
						r.i_rate = 32000;
 | 
				
			||||||
	r.o_rate = 48000;
 | 
						r.o_rate = 48000;
 | 
				
			||||||
| 
						 | 
					@ -122,6 +128,7 @@ static void test_in_len(void)
 | 
				
			||||||
	pull_blocks(&r, 1024);
 | 
						pull_blocks(&r, 1024);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_zero(r);
 | 
						spa_zero(r);
 | 
				
			||||||
 | 
						r.log = &logger.log;
 | 
				
			||||||
	r.channels = 1;
 | 
						r.channels = 1;
 | 
				
			||||||
	r.i_rate = 44100;
 | 
						r.i_rate = 44100;
 | 
				
			||||||
	r.o_rate = 48000;
 | 
						r.o_rate = 48000;
 | 
				
			||||||
| 
						 | 
					@ -130,6 +137,7 @@ static void test_in_len(void)
 | 
				
			||||||
	pull_blocks(&r, 1024);
 | 
						pull_blocks(&r, 1024);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_zero(r);
 | 
						spa_zero(r);
 | 
				
			||||||
 | 
						r.log = &logger.log;
 | 
				
			||||||
	r.channels = 1;
 | 
						r.channels = 1;
 | 
				
			||||||
	r.i_rate = 48000;
 | 
						r.i_rate = 48000;
 | 
				
			||||||
	r.o_rate = 44100;
 | 
						r.o_rate = 44100;
 | 
				
			||||||
| 
						 | 
					@ -140,6 +148,8 @@ static void test_in_len(void)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int main(int argc, char *argv[])
 | 
					int main(int argc, char *argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						logger.log.level = SPA_LOG_LEVEL_TRACE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	test_native();
 | 
						test_native();
 | 
				
			||||||
	test_in_len();
 | 
						test_in_len();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue