fork/rust-sdks

git clone https://git.julia.blue/fork/rust-sdks

Théo Monnomcleanup: webrtc-sys & fix RtcRuntime disposing crashes (#81)55bda13

main
1.5 KiB60 linesraw
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/media_stream_interface.h"
22#include "livekit/helper.h"
23#include "livekit/webrtc.h"
24#include "rust/cxx.h"
25
26namespace livekit {
27class MediaStreamTrack;
28}  // namespace livekit
29#include "webrtc-sys/src/media_stream_track.rs.h"
30
31namespace livekit {
32
33class MediaStreamTrack {
34 protected:
35  MediaStreamTrack(std::shared_ptr<RtcRuntime>,
36                   rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> track);
37
38 public:
39  rust::String kind() const;
40  rust::String id() const;
41
42  bool enabled() const;
43  bool set_enabled(bool enable) const;
44
45  TrackState state() const;
46
47  rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> rtc_track() const {
48    return track_;
49  }
50
51 protected:
52  std::shared_ptr<RtcRuntime> rtc_runtime_;
53  rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> track_;
54};
55
56static std::shared_ptr<MediaStreamTrack> _shared_media_stream_track() {
57  return nullptr;  // Ignore
58}
59
60}  // namespace livekit