mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	improve v2 compat mode
Always send the server types when we got the first client types and don't rely on the message sequence number. Add some more types in the typemap.
This commit is contained in:
		
							parent
							
								
									b2dfa83052
								
							
						
					
					
						commit
						7a395bccaf
					
				
					 3 changed files with 11 additions and 6 deletions
				
			
		| 
						 | 
					@ -77,14 +77,14 @@ update_types_server(struct pw_resource *resource)
 | 
				
			||||||
static void core_marshal_info(void *object, const struct pw_core_info *info)
 | 
					static void core_marshal_info(void *object, const struct pw_core_info *info)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_resource *resource = object;
 | 
						struct pw_resource *resource = object;
 | 
				
			||||||
 | 
						struct pw_impl_client *client = pw_resource_get_client(resource);
 | 
				
			||||||
 | 
						struct protocol_compat_v2 *compat_v2 = client->compat_v2;
 | 
				
			||||||
	struct spa_pod_builder *b;
 | 
						struct spa_pod_builder *b;
 | 
				
			||||||
	uint32_t i, n_items;
 | 
						uint32_t i, n_items;
 | 
				
			||||||
	uint64_t change_mask = 0;
 | 
						uint64_t change_mask = 0;
 | 
				
			||||||
	struct spa_pod_frame f;
 | 
						struct spa_pod_frame f;
 | 
				
			||||||
	struct pw_protocol_native_message *msg;
 | 
						struct pw_protocol_native_message *msg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	b = pw_protocol_native_begin_resource(resource, PW_CORE_V0_EVENT_INFO, &msg);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define PW_CORE_V0_CHANGE_MASK_USER_NAME  (1 << 0)
 | 
					#define PW_CORE_V0_CHANGE_MASK_USER_NAME  (1 << 0)
 | 
				
			||||||
#define PW_CORE_V0_CHANGE_MASK_HOST_NAME  (1 << 1)
 | 
					#define PW_CORE_V0_CHANGE_MASK_HOST_NAME  (1 << 1)
 | 
				
			||||||
#define PW_CORE_V0_CHANGE_MASK_VERSION    (1 << 2)
 | 
					#define PW_CORE_V0_CHANGE_MASK_VERSION    (1 << 2)
 | 
				
			||||||
| 
						 | 
					@ -92,15 +92,16 @@ static void core_marshal_info(void *object, const struct pw_core_info *info)
 | 
				
			||||||
#define PW_CORE_V0_CHANGE_MASK_COOKIE     (1 << 4)
 | 
					#define PW_CORE_V0_CHANGE_MASK_COOKIE     (1 << 4)
 | 
				
			||||||
#define PW_CORE_V0_CHANGE_MASK_PROPS      (1 << 5)
 | 
					#define PW_CORE_V0_CHANGE_MASK_PROPS      (1 << 5)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (msg->seq == 0) {
 | 
						if (compat_v2->send_types) {
 | 
				
			||||||
		update_types_server(resource);
 | 
							update_types_server(resource);
 | 
				
			||||||
		b = pw_protocol_native_begin_resource(resource, PW_CORE_V0_EVENT_INFO, &msg);
 | 
					 | 
				
			||||||
		change_mask |= PW_CORE_V0_CHANGE_MASK_USER_NAME |
 | 
							change_mask |= PW_CORE_V0_CHANGE_MASK_USER_NAME |
 | 
				
			||||||
			PW_CORE_V0_CHANGE_MASK_HOST_NAME |
 | 
								PW_CORE_V0_CHANGE_MASK_HOST_NAME |
 | 
				
			||||||
			PW_CORE_V0_CHANGE_MASK_VERSION |
 | 
								PW_CORE_V0_CHANGE_MASK_VERSION |
 | 
				
			||||||
			PW_CORE_V0_CHANGE_MASK_NAME |
 | 
								PW_CORE_V0_CHANGE_MASK_NAME |
 | 
				
			||||||
			PW_CORE_V0_CHANGE_MASK_COOKIE;
 | 
								PW_CORE_V0_CHANGE_MASK_COOKIE;
 | 
				
			||||||
 | 
							compat_v2->send_types = false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						b = pw_protocol_native_begin_resource(resource, PW_CORE_V0_EVENT_INFO, &msg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	n_items = info->props ? info->props->n_items : 0;
 | 
						n_items = info->props ? info->props->n_items : 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -711,6 +712,9 @@ static int core_demarshal_update_types_server(void *object, const struct pw_prot
 | 
				
			||||||
			NULL) < 0)
 | 
								NULL) < 0)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (first_id == 0)
 | 
				
			||||||
 | 
							compat_v2->send_types = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	types = alloca(n_types * sizeof(char *));
 | 
						types = alloca(n_types * sizeof(char *));
 | 
				
			||||||
	for (i = 0; i < n_types; i++) {
 | 
						for (i = 0; i < n_types; i++) {
 | 
				
			||||||
		if (spa_pod_parser_get(&prs, "s", &types[i], NULL) < 0)
 | 
							if (spa_pod_parser_get(&prs, "s", &types[i], NULL) < 0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -139,8 +139,8 @@ const struct type_info {
 | 
				
			||||||
	{ "Spa:POD:Object:Param:Format:Video:format", SPA_TYPE_INFO_FORMAT_VIDEO_BASE "format", SPA_FORMAT_VIDEO_format,},
 | 
						{ "Spa:POD:Object:Param:Format:Video:format", SPA_TYPE_INFO_FORMAT_VIDEO_BASE "format", SPA_FORMAT_VIDEO_format,},
 | 
				
			||||||
	{ "Spa:POD:Object:Param:Format:Video:size", SPA_TYPE_INFO_FORMAT_VIDEO_BASE "size", SPA_FORMAT_VIDEO_size,},
 | 
						{ "Spa:POD:Object:Param:Format:Video:size", SPA_TYPE_INFO_FORMAT_VIDEO_BASE "size", SPA_FORMAT_VIDEO_size,},
 | 
				
			||||||
	{ "Spa:POD:Object:Param:Format:Video:framerate", SPA_TYPE_INFO_FORMAT_VIDEO_BASE "framerate", SPA_FORMAT_VIDEO_framerate},
 | 
						{ "Spa:POD:Object:Param:Format:Video:framerate", SPA_TYPE_INFO_FORMAT_VIDEO_BASE "framerate", SPA_FORMAT_VIDEO_framerate},
 | 
				
			||||||
	{ "Spa:POD:Object:Param:Format:Video:max-framerate", },
 | 
						{ "Spa:POD:Object:Param:Format:Video:max-framerate", SPA_TYPE_INFO_FORMAT_VIDEO_BASE "maxFramerate", SPA_FORMAT_VIDEO_maxFramerate},
 | 
				
			||||||
	{ "Spa:POD:Object:Param:Format:Video:views", },
 | 
						{ "Spa:POD:Object:Param:Format:Video:views", SPA_TYPE_INFO_FORMAT_VIDEO_BASE "views", SPA_FORMAT_VIDEO_views},
 | 
				
			||||||
	{ "Spa:POD:Object:Param:Format:Video:interlace-mode", },
 | 
						{ "Spa:POD:Object:Param:Format:Video:interlace-mode", },
 | 
				
			||||||
	{ "Spa:POD:Object:Param:Format:Video:pixel-aspect-ratio", },
 | 
						{ "Spa:POD:Object:Param:Format:Video:pixel-aspect-ratio", },
 | 
				
			||||||
	{ "Spa:POD:Object:Param:Format:Video:multiview-mode", },
 | 
						{ "Spa:POD:Object:Param:Format:Video:multiview-mode", },
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -100,6 +100,7 @@ typedef uint32_t (*pw_permission_func_t) (struct pw_global *global,
 | 
				
			||||||
struct protocol_compat_v2 {
 | 
					struct protocol_compat_v2 {
 | 
				
			||||||
	/* v2 typemap */
 | 
						/* v2 typemap */
 | 
				
			||||||
	struct pw_map types;
 | 
						struct pw_map types;
 | 
				
			||||||
 | 
						unsigned int send_types:1;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_impl_core_emit(s,m,v,...) spa_hook_list_call(&s->listener_list, struct pw_impl_core_events, m, v, ##__VA_ARGS__)
 | 
					#define pw_impl_core_emit(s,m,v,...) spa_hook_list_call(&s->listener_list, struct pw_impl_core_events, m, v, ##__VA_ARGS__)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue