src/output: Reopen device on error
This commit is contained in:
		 Shen-Ta Hsieh
					Shen-Ta Hsieh
				
			
				
					committed by
					
						 Max Kellermann
						Max Kellermann
					
				
			
			
				
	
			
			
			 Max Kellermann
						Max Kellermann
					
				
			
						parent
						
							844dbd2ec5
						
					
				
				
					commit
					c46f97454a
				
			| @@ -333,6 +333,15 @@ void WasapiOutput::DoOpen(AudioFormat &audio_format) { | ||||
|  | ||||
| 	client.reset(); | ||||
|  | ||||
| 	DWORD state; | ||||
| 	if (HRESULT result = device->GetState(&state); FAILED(result)) { | ||||
| 		throw FormatHResultError(result, "Unable to get device status"); | ||||
| 	} | ||||
| 	if (state != DEVICE_STATE_ACTIVE) { | ||||
| 		device.reset(); | ||||
| 		OpenDevice(); | ||||
| 	} | ||||
|  | ||||
| 	HRESULT result; | ||||
| 	result = device->Activate(__uuidof(IAudioClient), CLSCTX_ALL, nullptr, | ||||
| 				  client.AddressCast()); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user