@@ -76,6 +76,7 @@ Config::Config()
7676 IF_NULL_SET (settings_[" gif" ][" framerate" ], 6 );
7777 // clang-format on
7878
79+ // cameras
7980 if ((settings_[" devices" ][" cameras" ].is_null () ||
8081 settings_[" devices" ][" cameras" ].get <std::string>().empty ()) &&
8182 !av::cameras ().empty ()) {
@@ -86,20 +87,15 @@ Config::Config()
8687#endif
8788 }
8889
89- if (settings_[" devices" ][" microphones" ].is_null ()) {
90- auto asrc = av::default_audio_source ();
91- if (asrc.has_value ()) {
92- settings_[" devices" ][" microphones" ] = asrc.value ().id ;
93- }
94- }
90+ // microphones: default or null
91+ auto asrc = av::default_audio_source ();
92+ settings_[" devices" ][" microphones" ] = asrc.value_or (av::device_t {}).id ;
9593
96- if (settings_[" devices" ][" speakers" ].is_null ()) {
97- auto asink = av::default_audio_sink ();
98- if (asink.has_value ()) {
99- settings_[" devices" ][" speakers" ] = asink.value ().id ;
100- }
101- }
94+ // speakers: default or null
95+ auto asink = av::default_audio_sink ();
96+ settings_[" devices" ][" speakers" ] = asink.value_or (av::device_t {}).id ;
10297
98+ //
10399 connect (this , &Config::changed, this , &Config::save);
104100 connect (this , &Config::SYSTEM_THEME_CHANGED , this , [this ](int theme) {
105101 if (settings_[" theme" ].get <std::string>() == " auto" ) {
0 commit comments