mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-08 12:24:09 +00:00
win-dshow: Set audio only active when there is audio
This commit is contained in:
parent
3a53882675
commit
d9bb556c97
|
@ -1026,13 +1026,16 @@ bool DShowInput::UpdateAudioConfig(obs_data_t *settings)
|
|||
|
||||
if (useCustomAudio) {
|
||||
DeviceId id;
|
||||
if (!DecodeDeviceId(id, audio_device_id.c_str()))
|
||||
if (!DecodeDeviceId(id, audio_device_id.c_str())) {
|
||||
obs_source_set_audio_active(source, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
audioConfig.name = id.name;
|
||||
audioConfig.path = id.path;
|
||||
|
||||
} else if (!deviceHasAudio) {
|
||||
obs_source_set_audio_active(source, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1049,8 +1052,12 @@ bool DShowInput::UpdateAudioConfig(obs_data_t *settings)
|
|||
(AudioMode)obs_data_get_int(settings, AUDIO_OUTPUT_MODE);
|
||||
|
||||
bool success = device.SetAudioConfig(&audioConfig);
|
||||
if (!success)
|
||||
if (!success) {
|
||||
obs_source_set_audio_active(source, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
obs_source_set_audio_active(source, true);
|
||||
|
||||
BPtr<char> name_utf8;
|
||||
os_wcs_to_utf8_ptr(audioConfig.name.c_str(), audioConfig.name.size(),
|
||||
|
@ -1135,12 +1142,15 @@ DShowInput::GetColorRange(obs_data_t *settings) const
|
|||
|
||||
inline bool DShowInput::Activate(obs_data_t *settings)
|
||||
{
|
||||
if (!device.ResetGraph())
|
||||
if (!device.ResetGraph()) {
|
||||
obs_source_set_audio_active(source, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!UpdateVideoConfig(settings)) {
|
||||
blog(LOG_WARNING, "%s: Video configuration failed",
|
||||
obs_source_get_name(source));
|
||||
obs_source_set_audio_active(source, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue