fork/rust-sdks
git clone https://git.julia.blue/fork/rust-sdks
09f7da1
main
1/* 2* Copyright 2023 LiveKit 3* 4* Licensed under the Apache License, Version 2.0 (the “License”); 5* you may not use this file except in compliance with the License. 6* You may obtain a copy of the License at 7* 8* http://www.apache.org/licenses/LICENSE-2.0 9* 10* Unless required by applicable law or agreed to in writing, software 11* distributed under the License is distributed on an “AS IS” BASIS, 12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13* See the License for the specific language governing permissions and 14* limitations under the License. 15*/ 16 17#pragma once 18 19#include "api/peer_connection_interface.h" 20#include "api/scoped_refptr.h" 21#include "api/task_queue/task_queue_factory.h" 22#include "livekit/audio_device.h" 23#include "media_stream.h" 24#include "rtp_parameters.h" 25#include "rust/cxx.h" 26#include "webrtc.h" 27 28namespace livekit { 29class PeerConnectionFactory ; 30class PeerConnectionObserverWrapper ; 31}// namespace livekit 32#include "webrtc-sys/src/peer_connection_factory.rs.h" 33 34namespace livekit { 35 36class PeerConnection ; 37struct RtcConfiguration ; 38 39webrtc ::PeerConnectionInterface ::RTCConfiguration to_native_rtc_configuration ( 40RtcConfiguration config ); 41 42class PeerConnectionFactory { 43public : 44explicit PeerConnectionFactory (std ::shared_ptr < RtcRuntime > rtc_runtime ); 45 ~PeerConnectionFactory (); 46 47std ::shared_ptr < PeerConnection > create_peer_connection ( 48RtcConfiguration config , 49rust ::Box < PeerConnectionObserverWrapper > observer )const ; 50 51std ::shared_ptr < VideoTrack > create_video_track ( 52rust ::String label , 53std ::shared_ptr < VideoTrackSource > source )const ; 54 55std ::shared_ptr < AudioTrack > create_audio_track ( 56rust ::String label , 57std ::shared_ptr < AudioTrackSource > source )const ; 58 59RtpCapabilities rtp_sender_capabilities (MediaType type )const ; 60 61RtpCapabilities rtp_receiver_capabilities (MediaType type )const ; 62 63std ::shared_ptr < RtcRuntime > rtc_runtime ()const {return rtc_runtime_ ; } 64 65private : 66std ::shared_ptr < RtcRuntime > rtc_runtime_ ; 67rtc ::scoped_refptr < AudioDevice > audio_device_ ; 68rtc ::scoped_refptr < webrtc ::PeerConnectionFactoryInterface > peer_factory_ ; 69webrtc ::TaskQueueFactory * task_queue_factory_ ; 70}; 71 72std ::shared_ptr < PeerConnectionFactory > create_peer_connection_factory (); 73}// namespace livekit