summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.cpp4
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp42
2 files changed, 44 insertions, 2 deletions
diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp
index 8f6b51d4c2..d9f1fe1212 100644
--- a/drivers/gles2/rasterizer_scene_gles2.cpp
+++ b/drivers/gles2/rasterizer_scene_gles2.cpp
@@ -2620,11 +2620,11 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
storage->frame.clear_request = false;
} else if (!env || env->bg_mode == VS::ENV_BG_CLEAR_COLOR || env->bg_mode == VS::ENV_BG_SKY) {
if (storage->frame.clear_request) {
- clear_color = storage->frame.clear_request_color.to_linear();
+ clear_color = storage->frame.clear_request_color;
storage->frame.clear_request = false;
}
} else if (env->bg_mode == VS::ENV_BG_CANVAS || env->bg_mode == VS::ENV_BG_COLOR || env->bg_mode == VS::ENV_BG_COLOR_SKY) {
- clear_color = env->bg_color.to_linear();
+ clear_color = env->bg_color;
storage->frame.clear_request = false;
} else {
storage->frame.clear_request = false;
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index c01fc71a43..0d98b7fbc0 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -316,6 +316,7 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) {
AudioDriverPulseAudio *ad = (AudioDriverPulseAudio *)p_udata;
unsigned int write_ofs = 0;
size_t avail_bytes = 0;
+ uint32_t default_device_msec = OS::get_singleton()->get_ticks_msec();
while (!ad->exit_thread) {
@@ -406,6 +407,47 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) {
write_ofs = 0;
}
+ // If we're using the default device check that the current device is still the default
+ if (ad->device_name == "Default") {
+
+ uint32_t msec = OS::get_singleton()->get_ticks_msec();
+ if (msec > (default_device_msec + 1000)) {
+ String old_default_device = ad->default_device;
+
+ default_device_msec = msec;
+
+ ad->pa_status = 0;
+ pa_operation *pa_op = pa_context_get_server_info(ad->pa_ctx, &AudioDriverPulseAudio::pa_server_info_cb, (void *)ad);
+ if (pa_op) {
+ while (ad->pa_status == 0) {
+ int ret = pa_mainloop_iterate(ad->pa_ml, 1, NULL);
+ if (ret < 0) {
+ ERR_PRINT("pa_mainloop_iterate error");
+ }
+ }
+
+ pa_operation_unref(pa_op);
+ } else {
+ ERR_PRINT("pa_context_get_server_info error");
+ }
+
+ if (old_default_device != ad->default_device) {
+ ad->finish_device();
+
+ Error err = ad->init_device();
+ if (err != OK) {
+ ERR_PRINT("PulseAudio: init_device error");
+ ad->active = false;
+ ad->exit_thread = true;
+ break;
+ }
+
+ avail_bytes = 0;
+ write_ofs = 0;
+ }
+ }
+ }
+
if (ad->pa_rec_str && pa_stream_get_state(ad->pa_rec_str) == PA_STREAM_READY) {
size_t bytes = pa_stream_readable_size(ad->pa_rec_str);
if (bytes > 0) {