| 1 | // Copyright 2025 LiveKit, Inc. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | #[cfg(target_os = "android")] |
| 16 | pub mod android; |
| 17 | pub mod apm; |
| 18 | pub mod audio_mixer; |
| 19 | pub mod audio_resampler; |
| 20 | pub mod audio_source; |
| 21 | pub mod audio_stream; |
| 22 | pub mod audio_track; |
| 23 | pub mod data_channel; |
| 24 | #[cfg(any(target_os = "macos", target_os = "windows", target_os = "linux"))] |
| 25 | pub mod desktop_capturer; |
| 26 | pub mod frame_cryptor; |
| 27 | pub mod ice_candidate; |
| 28 | pub mod media_stream; |
| 29 | pub mod media_stream_track; |
| 30 | pub mod packet_trailer; |
| 31 | pub mod peer_connection; |
| 32 | pub mod peer_connection_factory; |
| 33 | pub mod rtp_parameters; |
| 34 | pub mod rtp_receiver; |
| 35 | pub mod rtp_sender; |
| 36 | pub mod rtp_transceiver; |
| 37 | pub mod session_description; |
| 38 | pub mod video_frame; |
| 39 | pub mod video_source; |
| 40 | pub mod video_stream; |
| 41 | pub mod video_track; |
| 42 | pub mod yuv_helper; |
| 43 | |
| 44 | use webrtc_sys::{rtc_error as sys_err, webrtc as sys_rtc}; |
| 45 | |
| 46 | use crate::{MediaType, RtcError, RtcErrorType}; |
| 47 | |
| 48 | impl From<sys_err::ffi::RtcErrorType> for RtcErrorType { |
| 49 | fn from(value: sys_err::ffi::RtcErrorType) -> Self { |
| 50 | match value { |
| 51 | sys_err::ffi::RtcErrorType::InvalidState => Self::InvalidState, |
| 52 | _ => Self::Internal, |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | impl From<sys_err::ffi::RtcError> for RtcError { |
| 58 | fn from(value: sys_err::ffi::RtcError) -> Self { |
| 59 | Self { error_type: value.error_type.into(), message: value.message } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | impl From<MediaType> for sys_rtc::ffi::MediaType { |
| 64 | fn from(value: MediaType) -> Self { |
| 65 | match value { |
| 66 | MediaType::Audio => Self::Audio, |
| 67 | MediaType::Video => Self::Video, |
| 68 | MediaType::Data => Self::Data, |
| 69 | MediaType::Unsupported => Self::Unsupported, |
| 70 | } |
| 71 | } |
| 72 | } |