BlueGit

ict rusty-teams

Files

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

rtp_receiver.h

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