mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	context: log some more errors when config file fails
This commit is contained in:
		
							parent
							
								
									e83f039833
								
							
						
					
					
						commit
						8027c9225e
					
				
					 2 changed files with 16 additions and 5 deletions
				
			
		| 
						 | 
					@ -299,8 +299,10 @@ static int parse_spa_libs(struct pw_context *context, char *str)
 | 
				
			||||||
	int count = 0;
 | 
						int count = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_json_init(&it[0], str, strlen(str));
 | 
						spa_json_init(&it[0], str, strlen(str));
 | 
				
			||||||
	if (spa_json_enter_object(&it[0], &it[1]) < 0)
 | 
						if (spa_json_enter_object(&it[0], &it[1]) < 0) {
 | 
				
			||||||
 | 
							pw_log_error("config file error: context.spa-libs is not an object");
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while (spa_json_get_string(&it[1], key, sizeof(key)-1) > 0) {
 | 
						while (spa_json_get_string(&it[1], key, sizeof(key)-1) > 0) {
 | 
				
			||||||
		const char *val;
 | 
							const char *val;
 | 
				
			||||||
| 
						 | 
					@ -351,8 +353,10 @@ static int parse_modules(struct pw_context *context, char *str)
 | 
				
			||||||
	int res = 0, count = 0;
 | 
						int res = 0, count = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_json_init(&it[0], str, strlen(str));
 | 
						spa_json_init(&it[0], str, strlen(str));
 | 
				
			||||||
	if (spa_json_enter_array(&it[0], &it[1]) < 0)
 | 
						if (spa_json_enter_array(&it[0], &it[1]) < 0) {
 | 
				
			||||||
 | 
							pw_log_error("config file error: context.modules is not an array");
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while (spa_json_enter_object(&it[1], &it[2]) > 0) {
 | 
						while (spa_json_enter_object(&it[1], &it[2]) > 0) {
 | 
				
			||||||
		char *name = NULL, *args = NULL, *flags = NULL;
 | 
							char *name = NULL, *args = NULL, *flags = NULL;
 | 
				
			||||||
| 
						 | 
					@ -433,8 +437,10 @@ static int parse_objects(struct pw_context *context, char *str)
 | 
				
			||||||
	int res = 0, count = 0;
 | 
						int res = 0, count = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_json_init(&it[0], str, strlen(str));
 | 
						spa_json_init(&it[0], str, strlen(str));
 | 
				
			||||||
	if (spa_json_enter_array(&it[0], &it[1]) < 0)
 | 
						if (spa_json_enter_array(&it[0], &it[1]) < 0) {
 | 
				
			||||||
 | 
							pw_log_error("config file error: context.objects is not an array");
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while (spa_json_enter_object(&it[1], &it[2]) > 0) {
 | 
						while (spa_json_enter_object(&it[1], &it[2]) > 0) {
 | 
				
			||||||
		char *factory = NULL, *args = NULL, *flags = NULL;
 | 
							char *factory = NULL, *args = NULL, *flags = NULL;
 | 
				
			||||||
| 
						 | 
					@ -518,8 +524,10 @@ static int parse_exec(struct pw_context *context, char *str)
 | 
				
			||||||
	int res = 0, count = 0;
 | 
						int res = 0, count = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_json_init(&it[0], str, strlen(str));
 | 
						spa_json_init(&it[0], str, strlen(str));
 | 
				
			||||||
	if (spa_json_enter_array(&it[0], &it[1]) < 0)
 | 
						if (spa_json_enter_array(&it[0], &it[1]) < 0) {
 | 
				
			||||||
 | 
							pw_log_error("config file error: context.exec is not an array");
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while (spa_json_enter_object(&it[1], &it[2]) > 0) {
 | 
						while (spa_json_enter_object(&it[1], &it[2]) > 0) {
 | 
				
			||||||
		char *path = NULL, *args = NULL;
 | 
							char *path = NULL, *args = NULL;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -366,7 +366,10 @@ struct pw_context *pw_context_new(struct pw_loop *main_loop,
 | 
				
			||||||
	pw_log_info(NAME" %p: parsed %d context.spa-libs items", this, res);
 | 
						pw_log_info(NAME" %p: parsed %d context.spa-libs items", this, res);
 | 
				
			||||||
	if ((res = pw_context_parse_conf_section(this, conf, "context.modules")) < 0)
 | 
						if ((res = pw_context_parse_conf_section(this, conf, "context.modules")) < 0)
 | 
				
			||||||
		goto error_free_loop;
 | 
							goto error_free_loop;
 | 
				
			||||||
	pw_log_info(NAME" %p: parsed %d context.modules items", this, res);
 | 
						if (res > 0)
 | 
				
			||||||
 | 
							pw_log_info(NAME" %p: parsed %d context.modules items", this, res);
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							pw_log_warn(NAME "%p: no modules loaded from context.modules", this);
 | 
				
			||||||
	if ((res = pw_context_parse_conf_section(this, conf, "context.objects")) < 0)
 | 
						if ((res = pw_context_parse_conf_section(this, conf, "context.objects")) < 0)
 | 
				
			||||||
		goto error_free_loop;
 | 
							goto error_free_loop;
 | 
				
			||||||
	pw_log_info(NAME" %p: parsed %d context.objects items", this, res);
 | 
						pw_log_info(NAME" %p: parsed %d context.objects items", this, res);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue