BlueGit

ict rusty-teams

Files

rusty-teams / vendor / webrtc-sys / include / livekit / rtp_sender.h

rtp_sender.h

rtp_sender.h 2.3 KiB Download Raw
1/*
2 * Copyright 2025 LiveKit, Inc.
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_ffi {
30class RtpSender;
31}
32#include "webrtc-sys/src/rtp_sender.rs.h"
33
34namespace livekit_ffi {
35
36// TODO(theomonnom): FrameTransformer & FrameEncryptor interface
37class RtpSender {
38 public:
39 RtpSender(
40 std::shared_ptr<RtcRuntime> rtc_runtime,
41 webrtc::scoped_refptr<webrtc::RtpSenderInterface> sender,
42 webrtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection);
43
44 bool set_track(std::shared_ptr<MediaStreamTrack> track) const;
45
46 std::shared_ptr<MediaStreamTrack> track() const;
47
48 uint32_t ssrc() const;
49
50 void get_stats(
51 rust::Box<SenderContext> ctx,
52 rust::Fn<void(rust::Box<SenderContext>, rust::String)> on_stats) const;
53
54 MediaType media_type() const;
55
56 rust::String id() const;
57
58 rust::Vec<rust::String> stream_ids() const;
59
60 void set_streams(const rust::Vec<rust::String>& stream_ids) const;
61
62 rust::Vec<RtpEncodingParameters> init_send_encodings() const;
63
64 RtpParameters get_parameters() const;
65
66 void set_parameters(RtpParameters params) const;
67
68 void set_video_encoder_backend(VideoEncoderBackend backend) const;
69
70 webrtc::scoped_refptr<webrtc::RtpSenderInterface> rtc_sender() const {
71 return sender_;
72 }
73
74 private:
75 std::shared_ptr<RtcRuntime> rtc_runtime_;
76 webrtc::scoped_refptr<webrtc::RtpSenderInterface> sender_;
77 webrtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
78};
79
80static std::shared_ptr<RtpSender> _shared_rtp_sender() {
81 return nullptr; // Ignore
82}
83} // namespace livekit_ffi