collab: Make unsupported for MinGW toolchain (#23518)

Closes #23451

reverts #23117 for MinGW. collab can't be compiled for MinGW because
webrtc itself doesn't support MinGW compilers

Release Notes:

- N/A
This commit is contained in:
Maksim Bondarenkov 2025-01-26 12:01:20 +03:00 committed by GitHub
parent 5d005a7621
commit 64a5153bb5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 199 additions and 26 deletions

View file

@ -1,5 +1,11 @@
#![cfg_attr(all(target_os = "windows", target_env = "gnu"), allow(unused))]
mod remote_video_track_view;
#[cfg(any(test, feature = "test-support"))]
#[cfg(any(
test,
feature = "test-support",
all(target_os = "windows", target_env = "gnu")
))]
pub mod test;
use anyhow::{anyhow, Context as _, Result};
@ -11,6 +17,7 @@ use gpui::{
use parking_lot::Mutex;
use std::{borrow::Cow, collections::VecDeque, future::Future, pin::Pin, sync::Arc, thread};
use util::{debug_panic, ResultExt as _};
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
use webrtc::{
audio_frame::AudioFrame,
audio_source::{native::NativeAudioSource, AudioSourceOptions, RtcAudioSource},
@ -20,13 +27,27 @@ use webrtc::{
video_stream::native::NativeVideoStream,
};
#[cfg(not(any(test, feature = "test-support")))]
#[cfg(all(
not(any(test, feature = "test-support")),
not(all(target_os = "windows", target_env = "gnu"))
))]
use livekit::track::RemoteAudioTrack;
#[cfg(not(any(test, feature = "test-support")))]
#[cfg(all(
not(any(test, feature = "test-support")),
not(all(target_os = "windows", target_env = "gnu"))
))]
pub use livekit::*;
#[cfg(any(test, feature = "test-support"))]
#[cfg(any(
test,
feature = "test-support",
all(target_os = "windows", target_env = "gnu")
))]
use test::track::RemoteAudioTrack;
#[cfg(any(test, feature = "test-support"))]
#[cfg(any(
test,
feature = "test-support",
all(target_os = "windows", target_env = "gnu")
))]
pub use test::*;
pub use remote_video_track_view::{RemoteVideoTrackView, RemoteVideoTrackViewEvent};
@ -43,6 +64,7 @@ pub enum AudioStream {
struct Dispatcher(Arc<dyn gpui::PlatformDispatcher>);
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
impl livekit::dispatcher::Dispatcher for Dispatcher {
fn dispatch(&self, runnable: livekit::dispatcher::Runnable) {
self.0.dispatch(runnable, None);
@ -64,6 +86,7 @@ fn http_2_status(status: http_client::http::StatusCode) -> http_2::StatusCode {
.expect("valid status code to status code conversion")
}
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
impl livekit::dispatcher::HttpClient for HttpClientAdapter {
fn get(
&self,
@ -118,6 +141,14 @@ impl livekit::dispatcher::HttpClient for HttpClientAdapter {
}
}
#[cfg(all(target_os = "windows", target_env = "gnu"))]
pub fn init(
dispatcher: Arc<dyn gpui::PlatformDispatcher>,
http_client: Arc<dyn http_client::HttpClient>,
) {
}
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
pub fn init(
dispatcher: Arc<dyn gpui::PlatformDispatcher>,
http_client: Arc<dyn http_client::HttpClient>,
@ -126,6 +157,7 @@ pub fn init(
livekit::dispatcher::set_http_client(HttpClientAdapter(http_client));
}
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
pub async fn capture_local_video_track(
capture_source: &dyn ScreenCaptureSource,
) -> Result<(track::LocalVideoTrack, Box<dyn ScreenCaptureStream>)> {
@ -159,6 +191,7 @@ pub async fn capture_local_video_track(
))
}
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
pub fn capture_local_audio_track(
background_executor: &BackgroundExecutor,
) -> Result<Task<(track::LocalAudioTrack, AudioStream)>> {
@ -250,6 +283,7 @@ pub fn capture_local_audio_track(
}))
}
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
pub fn play_remote_audio_track(
track: &RemoteAudioTrack,
background_executor: &BackgroundExecutor,
@ -320,6 +354,7 @@ fn default_device(input: bool) -> anyhow::Result<(cpal::Device, cpal::SupportedS
Ok((device, config))
}
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
fn get_default_output() -> anyhow::Result<(cpal::Device, cpal::SupportedStreamConfig)> {
let host = cpal::default_host();
let output_device = host
@ -329,6 +364,7 @@ fn get_default_output() -> anyhow::Result<(cpal::Device, cpal::SupportedStreamCo
Ok((output_device, output_config))
}
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
fn start_output_stream(
output_config: cpal::SupportedStreamConfig,
output_device: cpal::Device,
@ -413,6 +449,14 @@ fn start_output_stream(
(receive_task, thread)
}
#[cfg(all(target_os = "windows", target_env = "gnu"))]
pub fn play_remote_video_track(
track: &track::RemoteVideoTrack,
) -> impl Stream<Item = RemoteVideoFrame> {
futures::stream::empty()
}
#[cfg(not(all(target_os = "windows", target_env = "gnu")))]
pub fn play_remote_video_track(
track: &track::RemoteVideoTrack,
) -> impl Stream<Item = RemoteVideoFrame> {
@ -440,7 +484,7 @@ fn video_frame_buffer_from_webrtc(buffer: Box<dyn VideoBuffer>) -> Option<Remote
#[cfg(not(target_os = "macos"))]
pub type RemoteVideoFrame = Arc<gpui::RenderImage>;
#[cfg(not(target_os = "macos"))]
#[cfg(not(any(target_os = "macos", all(target_os = "windows", target_env = "gnu"))))]
fn video_frame_buffer_from_webrtc(buffer: Box<dyn VideoBuffer>) -> Option<RemoteVideoFrame> {
use gpui::RenderImage;
use image::{Frame, RgbaImage};
@ -491,7 +535,7 @@ fn video_frame_buffer_to_webrtc(frame: ScreenCaptureFrame) -> Option<impl AsRef<
}
}
#[cfg(not(target_os = "macos"))]
#[cfg(not(any(target_os = "macos", all(target_os = "windows", target_env = "gnu"))))]
fn video_frame_buffer_to_webrtc(_frame: ScreenCaptureFrame) -> Option<impl AsRef<dyn VideoBuffer>> {
None as Option<Box<dyn VideoBuffer>>
}