mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pulse-server: improve message debug, add offset
This commit is contained in:
		
							parent
							
								
									d7d4f094a8
								
							
						
					
					
						commit
						b6efcd90a7
					
				
					 1 changed files with 19 additions and 17 deletions
				
			
		| 
						 | 
				
			
			@ -590,11 +590,13 @@ static int message_put(struct message *m, ...)
 | 
			
		|||
static int message_dump(struct message *m)
 | 
			
		||||
{
 | 
			
		||||
	int res;
 | 
			
		||||
	uint32_t i, offset = m->offset;
 | 
			
		||||
	uint32_t i, offset = m->offset, o;
 | 
			
		||||
 | 
			
		||||
	pw_log_debug("message: len:%d alloc:%u", m->length, m->allocated);
 | 
			
		||||
	while (true) {
 | 
			
		||||
		uint8_t tag;
 | 
			
		||||
 | 
			
		||||
		o = m->offset;
 | 
			
		||||
		if (read_u8(m, &tag) < 0)
 | 
			
		||||
			break;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -604,18 +606,18 @@ static int message_dump(struct message *m)
 | 
			
		|||
			char *val;
 | 
			
		||||
			if ((res = read_string(m, &val)) < 0)
 | 
			
		||||
				return res;
 | 
			
		||||
			pw_log_debug("string: '%s'", val);
 | 
			
		||||
			pw_log_debug("%u: string: '%s'", o, val);
 | 
			
		||||
			break;
 | 
			
		||||
			}
 | 
			
		||||
		case TAG_STRING_NULL:
 | 
			
		||||
			pw_log_debug("string: NULL");
 | 
			
		||||
			pw_log_debug("%u: string: NULL", o);
 | 
			
		||||
			break;
 | 
			
		||||
		case TAG_U8:
 | 
			
		||||
		{
 | 
			
		||||
			uint8_t val;
 | 
			
		||||
			if ((res = read_u8(m, &val)) < 0)
 | 
			
		||||
				return res;
 | 
			
		||||
			pw_log_debug("u8: %u", val);
 | 
			
		||||
			pw_log_debug("%u: u8: %u", o, val);
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		case TAG_U32:
 | 
			
		||||
| 
						 | 
				
			
			@ -623,7 +625,7 @@ static int message_dump(struct message *m)
 | 
			
		|||
			uint32_t val;
 | 
			
		||||
			if ((res = read_u32(m, &val)) < 0)
 | 
			
		||||
				return res;
 | 
			
		||||
			pw_log_debug("u32: %u", val);
 | 
			
		||||
			pw_log_debug("%u: u32: %u", o, val);
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		case TAG_S64:
 | 
			
		||||
| 
						 | 
				
			
			@ -631,7 +633,7 @@ static int message_dump(struct message *m)
 | 
			
		|||
			uint64_t val;
 | 
			
		||||
			if ((res = read_u64(m, &val)) < 0)
 | 
			
		||||
				return res;
 | 
			
		||||
			pw_log_debug("s64: %"PRIi64"", (int64_t)val);
 | 
			
		||||
			pw_log_debug("%u: s64: %"PRIi64"", o, (int64_t)val);
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		case TAG_U64:
 | 
			
		||||
| 
						 | 
				
			
			@ -639,7 +641,7 @@ static int message_dump(struct message *m)
 | 
			
		|||
			uint64_t val;
 | 
			
		||||
			if ((res = read_u64(m, &val)) < 0)
 | 
			
		||||
				return res;
 | 
			
		||||
			pw_log_debug("u64: %"PRIu64"", val);
 | 
			
		||||
			pw_log_debug("%u: u64: %"PRIu64"", o, val);
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		case TAG_USEC:
 | 
			
		||||
| 
						 | 
				
			
			@ -647,7 +649,7 @@ static int message_dump(struct message *m)
 | 
			
		|||
			uint64_t val;
 | 
			
		||||
			if ((res = read_u64(m, &val)) < 0)
 | 
			
		||||
				return res;
 | 
			
		||||
			pw_log_debug("u64: %"PRIu64"", val);
 | 
			
		||||
			pw_log_debug("%u: u64: %"PRIu64"", o, val);
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		case TAG_SAMPLE_SPEC:
 | 
			
		||||
| 
						 | 
				
			
			@ -655,7 +657,7 @@ static int message_dump(struct message *m)
 | 
			
		|||
			struct sample_spec ss;
 | 
			
		||||
			if ((res = read_sample_spec(m, &ss)) < 0)
 | 
			
		||||
				return res;
 | 
			
		||||
			pw_log_debug("ss: format:%s rate:%d channels:%u",
 | 
			
		||||
			pw_log_debug("%u: ss: format:%s rate:%d channels:%u", o,
 | 
			
		||||
					format_pa2name(ss.format), ss.rate,
 | 
			
		||||
					ss.channels);
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			@ -670,17 +672,17 @@ static int message_dump(struct message *m)
 | 
			
		|||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		case TAG_BOOLEAN_TRUE:
 | 
			
		||||
			pw_log_debug("bool: true");
 | 
			
		||||
			pw_log_debug("%u: bool: true", o);
 | 
			
		||||
			break;
 | 
			
		||||
		case TAG_BOOLEAN_FALSE:
 | 
			
		||||
			pw_log_debug("bool: false");
 | 
			
		||||
			pw_log_debug("%u: bool: false", o);
 | 
			
		||||
			break;
 | 
			
		||||
		case TAG_TIMEVAL:
 | 
			
		||||
		{
 | 
			
		||||
			struct timeval tv;
 | 
			
		||||
			if ((res = read_timeval(m, &tv)) < 0)
 | 
			
		||||
				return res;
 | 
			
		||||
			pw_log_debug("timeval: %lu:%lu", tv.tv_sec, tv.tv_usec);
 | 
			
		||||
			pw_log_debug("%u: timeval: %lu:%lu", o, tv.tv_sec, tv.tv_usec);
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		case TAG_CHANNEL_MAP:
 | 
			
		||||
| 
						 | 
				
			
			@ -688,7 +690,7 @@ static int message_dump(struct message *m)
 | 
			
		|||
			struct channel_map map;
 | 
			
		||||
			if ((res = read_channel_map(m, &map)) < 0)
 | 
			
		||||
				return res;
 | 
			
		||||
			pw_log_debug("channelmap: channels:%u", map.channels);
 | 
			
		||||
			pw_log_debug("%u: channelmap: channels:%u", o, map.channels);
 | 
			
		||||
			for (i = 0; i < map.channels; i++)
 | 
			
		||||
				pw_log_debug("    %d: %s", i, channel_pa2name(map.map[i]));
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			@ -698,7 +700,7 @@ static int message_dump(struct message *m)
 | 
			
		|||
			struct volume vol;
 | 
			
		||||
			if ((res = read_cvolume(m, &vol)) < 0)
 | 
			
		||||
				return res;
 | 
			
		||||
			pw_log_debug("cvolume: channels:%u", vol.channels);
 | 
			
		||||
			pw_log_debug("%u: cvolume: channels:%u", o, vol.channels);
 | 
			
		||||
			for (i = 0; i < vol.channels; i++)
 | 
			
		||||
				pw_log_debug("    %d: %f", i, vol.values[i]);
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			@ -709,7 +711,7 @@ static int message_dump(struct message *m)
 | 
			
		|||
			const struct spa_dict_item *it;
 | 
			
		||||
			if ((res = read_props(m, props)) < 0)
 | 
			
		||||
				return res;
 | 
			
		||||
			pw_log_debug("props: n_items:%u", props->dict.n_items);
 | 
			
		||||
			pw_log_debug("%u: props: n_items:%u", o, props->dict.n_items);
 | 
			
		||||
			spa_dict_for_each(it, &props->dict)
 | 
			
		||||
				pw_log_debug("     '%s': '%s'", it->key, it->value);
 | 
			
		||||
			pw_properties_free(props);
 | 
			
		||||
| 
						 | 
				
			
			@ -720,7 +722,7 @@ static int message_dump(struct message *m)
 | 
			
		|||
			float vol;
 | 
			
		||||
			if ((res = read_volume(m, &vol)) < 0)
 | 
			
		||||
				return res;
 | 
			
		||||
			pw_log_debug("volume: %f", vol);
 | 
			
		||||
			pw_log_debug("%u: volume: %f", o, vol);
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		case TAG_FORMAT_INFO:
 | 
			
		||||
| 
						 | 
				
			
			@ -729,7 +731,7 @@ static int message_dump(struct message *m)
 | 
			
		|||
			const struct spa_dict_item *it;
 | 
			
		||||
			if ((res = read_format_info(m, &info)) < 0)
 | 
			
		||||
				return res;
 | 
			
		||||
			pw_log_debug("format-info: n_items:%u", info.props->dict.n_items);
 | 
			
		||||
			pw_log_debug("%u: format-info: n_items:%u", o, info.props->dict.n_items);
 | 
			
		||||
			spa_dict_for_each(it, &info.props->dict)
 | 
			
		||||
				pw_log_debug("     '%s': '%s'", it->key, it->value);
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue