mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Implement media device tracking on macOS.
This commit is contained in:
parent
736b489eb7
commit
65a80766f4
3 changed files with 9 additions and 4 deletions
|
@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "media/audio/media_audio_track.h"
|
#include "media/audio/media_audio_track.h"
|
||||||
#include "media/media_common.h"
|
#include "media/media_common.h"
|
||||||
#include "media/streaming/media_streaming_utility.h"
|
#include "media/streaming/media_streaming_utility.h"
|
||||||
|
#include "webrtc/webrtc_environment.h"
|
||||||
#include "webrtc/webrtc_media_devices.h"
|
#include "webrtc/webrtc_media_devices.h"
|
||||||
#include "data/data_document.h"
|
#include "data/data_document.h"
|
||||||
#include "data/data_file_origin.h"
|
#include "data/data_file_origin.h"
|
||||||
|
@ -144,8 +145,11 @@ bool CreatePlaybackDevice() {
|
||||||
const auto id = Current().deviceId().toStdString();
|
const auto id = Current().deviceId().toStdString();
|
||||||
AudioDevice = alcOpenDevice(id.c_str());
|
AudioDevice = alcOpenDevice(id.c_str());
|
||||||
if (!AudioDevice) {
|
if (!AudioDevice) {
|
||||||
LOG(("Audio Error: Could not create default playback device, enumerating.."));
|
LOG(("Audio Error: Could not create default playback device, refreshing.."));
|
||||||
EnumeratePlaybackDevices();
|
crl::on_main([] {
|
||||||
|
const auto type = Webrtc::DeviceType::Playback;
|
||||||
|
Core::App().mediaDevices().forceRefresh(type);
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -555,7 +555,8 @@ void ChooseAudioDeviceBox(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto weak = Ui::MakeWeak(box);
|
const auto weak = Ui::MakeWeak(box);
|
||||||
chosen(state->ids.take(value).value_or(kDefaultDeviceId));
|
const auto i = state->ids.find(value);
|
||||||
|
chosen((i != end(state->ids)) ? i->second : kDefaultDeviceId);
|
||||||
if (weak) {
|
if (weak) {
|
||||||
box->closeBox();
|
box->closeBox();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5a831697880967bbccbd45177fb6cf6b11759a22
|
Subproject commit b78e51ad98cd5bf70e916becae0b13496b9f6aca
|
Loading…
Add table
Reference in a new issue