output_control: close earlier on format mismatch
To prevent a race condition, close the output thread before assigning the new audio format.
This commit is contained in:
		| @@ -79,13 +79,13 @@ audio_output_open(struct audio_output *ao, | |||||||
| 	ao->chunk = NULL; | 	ao->chunk = NULL; | ||||||
|  |  | ||||||
| 	if (!ao->config_audio_format) { | 	if (!ao->config_audio_format) { | ||||||
|  | 		if (ao->open) | ||||||
|  | 			audio_output_close(ao); | ||||||
|  |  | ||||||
| 		/* no audio format is configured: copy in->out, let | 		/* no audio format is configured: copy in->out, let | ||||||
| 		   the output's open() method determine the effective | 		   the output's open() method determine the effective | ||||||
| 		   out_audio_format */ | 		   out_audio_format */ | ||||||
| 		ao->out_audio_format = ao->in_audio_format; | 		ao->out_audio_format = ao->in_audio_format; | ||||||
|  |  | ||||||
| 		if (ao->open) |  | ||||||
| 			audio_output_close(ao); |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	ao->pipe = mp; | 	ao->pipe = mp; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Max Kellermann
					Max Kellermann