fork/rust-sdks
git clone https://git.julia.blue/fork/rust-sdks
a5ba08e
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 <memory> 20 21#include "api/peer_connection_interface.h" 22#include "api/rtp_sender_interface.h" 23#include "api/scoped_refptr.h" 24#include "livekit/media_stream.h" 25#include "livekit/rtc_error.h" 26#include "livekit/rtp_parameters.h" 27#include "rust/cxx.h" 28 29namespace livekit { 30class RtpSender ; 31} 32#include "webrtc-sys/src/rtp_sender.rs.h" 33 34namespace livekit { 35 36// TODO(theomonnom): FrameTransformer & FrameEncryptor interface 37class RtpSender { 38public : 39RtpSender ( 40std ::shared_ptr < RtcRuntime > rtc_runtime , 41rtc ::scoped_refptr < webrtc ::RtpSenderInterface > sender , 42rtc ::scoped_refptr < webrtc ::PeerConnectionInterface > peer_connection ); 43 44bool set_track (std ::shared_ptr < MediaStreamTrack > track )const ; 45 46std ::shared_ptr < MediaStreamTrack > track ()const ; 47 48uint32_t ssrc ()const ; 49 50void get_stats ( 51rust ::Box < SenderContext > ctx , 52rust ::Fn < void (rust ::Box < SenderContext > ,rust ::String )> on_stats )const ; 53 54MediaType media_type ()const ; 55 56rust ::String id ()const ; 57 58rust ::Vec < rust ::String > stream_ids ()const ; 59 60void set_streams (const rust ::Vec < rust ::String >& stream_ids )const ; 61 62rust ::Vec < RtpEncodingParameters > init_send_encodings ()const ; 63 64RtpParameters get_parameters ()const ; 65 66void set_parameters (RtpParameters params )const ; 67 68rtc ::scoped_refptr < webrtc ::RtpSenderInterface > rtc_sender ()const { 69return sender_ ; 70 } 71 72private : 73std ::shared_ptr < RtcRuntime > rtc_runtime_ ; 74rtc ::scoped_refptr < webrtc ::RtpSenderInterface > sender_ ; 75rtc ::scoped_refptr < webrtc ::PeerConnectionInterface > peer_connection_ ; 76}; 77 78static std ::shared_ptr < RtpSender > _shared_rtp_sender () { 79return nullptr ;// Ignore 80} 81}// namespace livekit