mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	bluez5: aac: work around devices setting multiple bits in caps
Airpods don't follow the specification and set multiple bits in AAC object type, including the ELD bit, but actually want AAC-LC. So check the AOT in the right order.
This commit is contained in:
		
							parent
							
								
									8ee1b4b614
								
							
						
					
					
						commit
						1b3b577b8f
					
				
					 1 changed files with 9 additions and 6 deletions
				
			
		| 
						 | 
					@ -364,7 +364,15 @@ static void *codec_init(const struct media_codec *codec, uint32_t flags,
 | 
				
			||||||
	if (res != AACENC_OK)
 | 
						if (res != AACENC_OK)
 | 
				
			||||||
		goto error;
 | 
							goto error;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (conf->object_type & AAC_OBJECT_TYPE_MPEG4_AAC_ELD) {
 | 
						/* If object type has multiple bits set (invalid per spec, see above),
 | 
				
			||||||
 | 
						 * assume the device usually means AAC-LC.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						if (conf->object_type & (AAC_OBJECT_TYPE_MPEG2_AAC_LC |
 | 
				
			||||||
 | 
											AAC_OBJECT_TYPE_MPEG4_AAC_LC)) {
 | 
				
			||||||
 | 
							res = aacEncoder_SetParam(this->aacenc, AACENC_AOT, AOT_AAC_LC);
 | 
				
			||||||
 | 
							if (res != AACENC_OK)
 | 
				
			||||||
 | 
								goto error;
 | 
				
			||||||
 | 
						} else if (conf->object_type & AAC_OBJECT_TYPE_MPEG4_AAC_ELD) {
 | 
				
			||||||
		res = aacEncoder_SetParam(this->aacenc, AACENC_AOT, AOT_ER_AAC_ELD);
 | 
							res = aacEncoder_SetParam(this->aacenc, AACENC_AOT, AOT_ER_AAC_ELD);
 | 
				
			||||||
		if (res != AACENC_OK)
 | 
							if (res != AACENC_OK)
 | 
				
			||||||
			goto error;
 | 
								goto error;
 | 
				
			||||||
| 
						 | 
					@ -372,11 +380,6 @@ static void *codec_init(const struct media_codec *codec, uint32_t flags,
 | 
				
			||||||
		res = aacEncoder_SetParam(this->aacenc,  AACENC_SBR_MODE, 1);
 | 
							res = aacEncoder_SetParam(this->aacenc,  AACENC_SBR_MODE, 1);
 | 
				
			||||||
		if (res != AACENC_OK)
 | 
							if (res != AACENC_OK)
 | 
				
			||||||
			goto error;
 | 
								goto error;
 | 
				
			||||||
	} else if (conf->object_type & (AAC_OBJECT_TYPE_MPEG2_AAC_LC |
 | 
					 | 
				
			||||||
						AAC_OBJECT_TYPE_MPEG4_AAC_LC)) {
 | 
					 | 
				
			||||||
		res = aacEncoder_SetParam(this->aacenc, AACENC_AOT, AOT_AAC_LC);
 | 
					 | 
				
			||||||
		if (res != AACENC_OK)
 | 
					 | 
				
			||||||
			goto error;
 | 
					 | 
				
			||||||
	} else {		
 | 
						} else {		
 | 
				
			||||||
		res = -EINVAL;
 | 
							res = -EINVAL;
 | 
				
			||||||
		goto error;
 | 
							goto error;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue