mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	bluetooth: Add missing can_be_supported check to is_codec_available
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/479>
This commit is contained in:
		
							parent
							
								
									519052e77e
								
							
						
					
					
						commit
						ac33a01f30
					
				
					 3 changed files with 8 additions and 7 deletions
				
			
		| 
						 | 
					@ -89,15 +89,16 @@ void pa_bluetooth_a2dp_codec_gst_init(void) {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool pa_bluetooth_a2dp_codec_is_codec_available(const pa_a2dp_codec_id *id, bool is_a2dp_sink) {
 | 
					bool pa_bluetooth_a2dp_codec_is_available(const pa_a2dp_codec_id *id, bool is_a2dp_sink) {
 | 
				
			||||||
    unsigned int i;
 | 
					    unsigned int i;
 | 
				
			||||||
    unsigned int count = pa_bluetooth_a2dp_codec_count();
 | 
					    unsigned int count = pa_bluetooth_a2dp_codec_count();
 | 
				
			||||||
 | 
					    const pa_a2dp_codec *a2dp_codec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (i = 0; i < count; i++) {
 | 
					    for (i = 0; i < count; i++) {
 | 
				
			||||||
        if (memcmp(id, &pa_a2dp_codecs[i]->id, sizeof(pa_a2dp_codec_id)) == 0) {
 | 
					        a2dp_codec = pa_bluetooth_a2dp_codec_iter(i);
 | 
				
			||||||
            return (is_a2dp_sink && pa_a2dp_codecs[i]->encode_buffer != NULL)
 | 
					        if (memcmp(id, &a2dp_codec->id, sizeof(pa_a2dp_codec_id)) == 0
 | 
				
			||||||
                || (!is_a2dp_sink && pa_a2dp_codecs[i]->decode_buffer != NULL);
 | 
					                && a2dp_codec->can_be_supported(is_a2dp_sink))
 | 
				
			||||||
        }
 | 
					            return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,7 +32,7 @@ const pa_a2dp_codec *pa_bluetooth_a2dp_codec_iter(unsigned int i);
 | 
				
			||||||
const pa_a2dp_codec *pa_bluetooth_get_a2dp_codec(const char *name);
 | 
					const pa_a2dp_codec *pa_bluetooth_get_a2dp_codec(const char *name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Check if the given codec can be supported in A2DP_SINK or A2DP_SOURCE */
 | 
					/* Check if the given codec can be supported in A2DP_SINK or A2DP_SOURCE */
 | 
				
			||||||
bool pa_bluetooth_a2dp_codec_is_codec_available(const pa_a2dp_codec_id *id, bool is_a2dp_sink);
 | 
					bool pa_bluetooth_a2dp_codec_is_available(const pa_a2dp_codec_id *id, bool is_a2dp_sink);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Initialise GStreamer */
 | 
					/* Initialise GStreamer */
 | 
				
			||||||
void pa_bluetooth_a2dp_codec_gst_init(void);
 | 
					void pa_bluetooth_a2dp_codec_gst_init(void);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1335,7 +1335,7 @@ static void parse_remote_endpoint_properties(pa_bluetooth_discovery *y, const ch
 | 
				
			||||||
        a2dp_codec_id->vendor_codec_id = 0;
 | 
					        a2dp_codec_id->vendor_codec_id = 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!pa_bluetooth_a2dp_codec_is_codec_available(a2dp_codec_id, pa_streq(uuid, PA_BLUETOOTH_UUID_A2DP_SINK))) {
 | 
					    if (!pa_bluetooth_a2dp_codec_is_available(a2dp_codec_id, pa_streq(uuid, PA_BLUETOOTH_UUID_A2DP_SINK))) {
 | 
				
			||||||
        pa_xfree(a2dp_codec_id);
 | 
					        pa_xfree(a2dp_codec_id);
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue