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_receiver_interface.h" 23#include "api/scoped_refptr.h" 24#include "livekit/helper.h" 25#include "livekit/media_stream.h" 26#include "livekit/rtp_parameters.h" 27#include "livekit/webrtc.h" 28#include "rust/cxx.h" 29 30namespace livekit { 31class RtpReceiver ; 32} 33#include "webrtc-sys/src/rtp_receiver.rs.h" 34namespace livekit { 35 36// TODO(theomonnom): Implement RtpReceiverObserverInterface? 37// TODO(theomonnom): RtpSource 38// TODO(theomonnom): FrameTransformer & FrameDecryptor interface 39class RtpReceiver { 40public : 41RtpReceiver ( 42std ::shared_ptr < RtcRuntime > rtc_runtime , 43rtc ::scoped_refptr < webrtc ::RtpReceiverInterface > receiver , 44rtc ::scoped_refptr < webrtc ::PeerConnectionInterface > peer_connection ); 45 46std ::shared_ptr < MediaStreamTrack > track ()const ; 47 48void get_stats ( 49rust ::Box < ReceiverContext > ctx , 50rust ::Fn < void (rust ::Box < ReceiverContext > ,rust ::String )> on_stats )const ; 51 52rust ::Vec < rust ::String > stream_ids ()const ; 53rust ::Vec < MediaStreamPtr > streams ()const ; 54 55MediaType media_type ()const ; 56rust ::String id ()const ; 57 58RtpParameters get_parameters ()const ; 59 60// bool set_parameters(RtpParameters parameters) const; // Seems unsupported 61 62void set_jitter_buffer_minimum_delay (bool is_some , 63double delay_seconds )const ; 64 65rtc ::scoped_refptr < webrtc ::RtpReceiverInterface > rtc_receiver ()const { 66return receiver_ ; 67 } 68 69private : 70std ::shared_ptr < RtcRuntime > rtc_runtime_ ; 71rtc ::scoped_refptr < webrtc ::RtpReceiverInterface > receiver_ ; 72rtc ::scoped_refptr < webrtc ::PeerConnectionInterface > peer_connection_ ; 73}; 74 75static std ::shared_ptr < RtpReceiver > _shared_rtp_receiver () { 76return nullptr ; 77} 78 79}// namespace livekit