mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	a2dp: automatic delay estimation
This commit is contained in:
		
							parent
							
								
									7bdcfb6383
								
							
						
					
					
						commit
						af38edea82
					
				
					 3 changed files with 15 additions and 1 deletions
				
			
		| 
						 | 
					@ -616,9 +616,11 @@ static void a2dp_on_timeout(struct spa_source *source)
 | 
				
			||||||
		this->clock->nsec = now_time;
 | 
							this->clock->nsec = now_time;
 | 
				
			||||||
		this->clock->position += duration;
 | 
							this->clock->position += duration;
 | 
				
			||||||
		this->clock->duration = duration;
 | 
							this->clock->duration = duration;
 | 
				
			||||||
		this->clock->delay = 0;
 | 
					 | 
				
			||||||
		this->clock->rate_diff = 1.0f;
 | 
							this->clock->rate_diff = 1.0f;
 | 
				
			||||||
		this->clock->next_nsec = this->next_time;
 | 
							this->clock->next_nsec = this->next_time;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// The bluetooth AVDTP delay value is measured in units of 100us
 | 
				
			||||||
 | 
							this->clock->delay = (100 * this->transport->delay * (int64_t) this->clock->rate.denom) / SPA_USEC_PER_SEC;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_log_debug(this->log, NAME" %p: timeout %"PRIu64" %"PRIu64"", this,
 | 
						spa_log_debug(this->log, NAME" %p: timeout %"PRIu64" %"PRIu64"", this,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -814,6 +814,17 @@ static int transport_update_props(struct spa_bt_transport *transport,
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else if (strcmp(key, "Volume") == 0) {
 | 
							else if (strcmp(key, "Volume") == 0) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							else if (strcmp(key, "Delay") == 0) {
 | 
				
			||||||
 | 
								uint16_t value;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (type != DBUS_TYPE_UINT16)
 | 
				
			||||||
 | 
									goto next;
 | 
				
			||||||
 | 
								dbus_message_iter_get_basic(&it[1], &value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								spa_log_debug(monitor->log, "transport %p: %s=%02x", transport, key, value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								transport->delay = value;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	      next:
 | 
						      next:
 | 
				
			||||||
		dbus_message_iter_next(props_iter);
 | 
							dbus_message_iter_next(props_iter);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -288,6 +288,7 @@ struct spa_bt_transport {
 | 
				
			||||||
	int fd;
 | 
						int fd;
 | 
				
			||||||
	uint16_t read_mtu;
 | 
						uint16_t read_mtu;
 | 
				
			||||||
	uint16_t write_mtu;
 | 
						uint16_t write_mtu;
 | 
				
			||||||
 | 
						uint16_t delay;
 | 
				
			||||||
	void *user_data;
 | 
						void *user_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct spa_hook_list listener_list;
 | 
						struct spa_hook_list listener_list;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue