mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 20:25:34 +08:00
[fix] remove SDL3 input audio stream recording
This commit is contained in:
@@ -512,23 +512,11 @@ int Render::CreateConnectionPeer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Render::AudioDeviceInit() {
|
int Render::AudioDeviceInit() {
|
||||||
SDL_AudioSpec desired_in{};
|
|
||||||
desired_in.freq = 48000;
|
|
||||||
desired_in.format = SDL_AUDIO_S16;
|
|
||||||
desired_in.channels = 1;
|
|
||||||
|
|
||||||
SDL_AudioSpec desired_out{};
|
SDL_AudioSpec desired_out{};
|
||||||
desired_out.freq = 48000;
|
desired_out.freq = 48000;
|
||||||
desired_out.format = SDL_AUDIO_S16;
|
desired_out.format = SDL_AUDIO_S16;
|
||||||
desired_out.channels = 1;
|
desired_out.channels = 1;
|
||||||
|
|
||||||
input_stream_ = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_RECORDING,
|
|
||||||
&desired_in, nullptr, nullptr);
|
|
||||||
if (!input_stream_) {
|
|
||||||
LOG_ERROR("Failed to open input stream: {}", SDL_GetError());
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
output_stream_ = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK,
|
output_stream_ = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK,
|
||||||
&desired_out, nullptr, nullptr);
|
&desired_out, nullptr, nullptr);
|
||||||
if (!output_stream_) {
|
if (!output_stream_) {
|
||||||
@@ -536,18 +524,12 @@ int Render::AudioDeviceInit() {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(input_stream_));
|
|
||||||
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(output_stream_));
|
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(output_stream_));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Render::AudioDeviceDestroy() {
|
int Render::AudioDeviceDestroy() {
|
||||||
if (input_stream_) {
|
|
||||||
SDL_CloseAudioDevice(SDL_GetAudioStreamDevice(input_stream_));
|
|
||||||
SDL_DestroyAudioStream(input_stream_);
|
|
||||||
input_stream_ = nullptr;
|
|
||||||
}
|
|
||||||
if (output_stream_) {
|
if (output_stream_) {
|
||||||
SDL_CloseAudioDevice(SDL_GetAudioStreamDevice(output_stream_));
|
SDL_CloseAudioDevice(SDL_GetAudioStreamDevice(output_stream_));
|
||||||
SDL_DestroyAudioStream(output_stream_);
|
SDL_DestroyAudioStream(output_stream_);
|
||||||
|
|||||||
@@ -348,7 +348,6 @@ class Render {
|
|||||||
std::string focused_remote_id_ = "";
|
std::string focused_remote_id_ = "";
|
||||||
bool need_to_send_host_info_ = false;
|
bool need_to_send_host_info_ = false;
|
||||||
SDL_Event last_mouse_event;
|
SDL_Event last_mouse_event;
|
||||||
SDL_AudioStream *input_stream_;
|
|
||||||
SDL_AudioStream *output_stream_;
|
SDL_AudioStream *output_stream_;
|
||||||
uint32_t STREAM_REFRESH_EVENT = 0;
|
uint32_t STREAM_REFRESH_EVENT = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user