mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	pcm: Insert linear-to-float conversion when rate or channel count is incorrect
This fixes a bug where snd_pcm_plug_insert_plugins fails when both client and slave use format float, but the rate or channel count does not match. I also removed some redundant code. Signed-off-by: Maarten Baert <maarten-baert@hotmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
		
							parent
							
								
									b669b50de2
								
							
						
					
					
						commit
						2da7b0c2c1
					
				
					 1 changed files with 6 additions and 8 deletions
				
			
		| 
						 | 
					@ -522,15 +522,13 @@ static int snd_pcm_plug_change_format(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_p
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
#ifdef BUILD_PCM_PLUGIN_LFLOAT
 | 
					#ifdef BUILD_PCM_PLUGIN_LFLOAT
 | 
				
			||||||
	} else if (snd_pcm_format_float(slv->format)) {
 | 
						} else if (snd_pcm_format_float(slv->format)) {
 | 
				
			||||||
		/* Conversion is done in another plugin */
 | 
							if (snd_pcm_format_linear(clt->format)) {
 | 
				
			||||||
		if (clt->format == slv->format &&
 | 
								cfmt = clt->format;
 | 
				
			||||||
		    clt->rate == slv->rate &&
 | 
					 | 
				
			||||||
		    clt->channels == slv->channels)
 | 
					 | 
				
			||||||
			return 0;
 | 
					 | 
				
			||||||
		cfmt = clt->format;
 | 
					 | 
				
			||||||
		if (snd_pcm_format_linear(clt->format))
 | 
					 | 
				
			||||||
			f = snd_pcm_lfloat_open;
 | 
								f = snd_pcm_lfloat_open;
 | 
				
			||||||
		else
 | 
							} else if (clt->rate != slv->rate || clt->channels != slv->channels) {
 | 
				
			||||||
 | 
								cfmt = SND_PCM_FORMAT_S16;
 | 
				
			||||||
 | 
								f = snd_pcm_lfloat_open;
 | 
				
			||||||
 | 
							} else
 | 
				
			||||||
			return -EINVAL;
 | 
								return -EINVAL;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef BUILD_PCM_NONLINEAR
 | 
					#ifdef BUILD_PCM_NONLINEAR
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue