Skip to content

Commit e9968b5

Browse files
committed
more changes.
1 parent 93dd288 commit e9968b5

File tree

9 files changed

+700
-29
lines changed

9 files changed

+700
-29
lines changed

webrtc-sys/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ static = []
1414
[dependencies]
1515
livekit-runtime = { workspace = true }
1616
log = "0.4"
17+
parking_lot = "0.12.5"
1718
serde = "1.0.228"
19+
serde_derive = "1.0.228"
1820
thiserror = "2.0.17"
1921
tokio = { version = "1", features = ["full"] }
22+
tokio-stream = "0.1.17"
2023

2124
[build-dependencies]
2225
webrtc-sys-build = { workspace = true }

webrtc-sys/libwebrtc/src/livekit_rtc/BUILD.gn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ lk_sources = [
3232
"media_stream_track.cc",
3333
"rtc_error.cc",
3434
"audio_resampler.cc",
35+
#"rtp_sender.cc",
3536
#"desktop_capturer.cc",
3637
"yuv_helper.cc",
38+
"rtp_parameters.cc",
3739
]
3840

3941
if (is_mac) {

webrtc-sys/libwebrtc/src/livekit_rtc/desktop_capturer.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ class DesktopCapturerOptions;
2727
class Source;
2828
} // namespace livekit
2929

30-
3130
namespace livekit {
3231

33-
class DesktopCapturer : public webrtc::DesktopCapturer::Callback, public webrtc::RefCountInterface {
32+
class DesktopCapturer : public webrtc::DesktopCapturer::Callback,
33+
public webrtc::RefCountInterface {
3434
public:
3535
explicit DesktopCapturer(std::unique_ptr<webrtc::DesktopCapturer> capturer)
3636
: capturer(std::move(capturer)), callback(std::nullopt) {}
@@ -48,9 +48,10 @@ class DesktopCapturer : public webrtc::DesktopCapturer::Callback, public webrtc:
4848
std::optional<rust::Box<DesktopCapturerCallbackWrapper>> callback;
4949
};
5050

51-
class DesktopFrame {
51+
class DesktopFrame : public webrtc::RefCountInterface {
5252
public:
53-
DesktopFrame(std::unique_ptr<webrtc::DesktopFrame> frame) : frame(std::move(frame)) {}
53+
DesktopFrame(std::unique_ptr<webrtc::DesktopFrame> frame)
54+
: frame(std::move(frame)) {}
5455
int32_t width() const { return frame->size().width(); }
5556

5657
int32_t height() const { return frame->size().height(); }
@@ -67,5 +68,6 @@ class DesktopFrame {
6768
std::unique_ptr<webrtc::DesktopFrame> frame;
6869
};
6970

70-
webrtc::scoped_refptr<DesktopCapturer> new_desktop_capturer(DesktopCapturerOptions options);
71+
webrtc::scoped_refptr<DesktopCapturer> new_desktop_capturer(
72+
DesktopCapturerOptions options);
7173
} // namespace livekit

webrtc-sys/libwebrtc/src/livekit_rtc/peer.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ webrtc::scoped_refptr<Peer> PeerFactory::CreatePeer(
228228
return nullptr;
229229
}
230230

231-
return webrtc::make_ref_counted<Peer>(res.value(), obs);
231+
return webrtc::make_ref_counted<Peer>(
232+
webrtc::scoped_refptr<PeerFactory>(this), res.value(), obs);
232233
}
233234

234235
lkRtcVideoTrack* PeerFactory::CreateVideoTrack(const char* id,

webrtc-sys/libwebrtc/src/livekit_rtc/peer.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
namespace livekit {
1212

13+
class PeerFactory;
14+
1315
webrtc::PeerConnectionInterface::RTCConfiguration toNativeConfig(
1416
const lkRtcConfiguration& config);
1517

@@ -48,9 +50,10 @@ class PeerObserver : public webrtc::PeerConnectionObserver,
4850

4951
class Peer : public webrtc::RefCountInterface {
5052
public:
51-
Peer(webrtc::scoped_refptr<webrtc::PeerConnectionInterface> pc,
53+
Peer(webrtc::scoped_refptr<PeerFactory> pc_factory,
54+
webrtc::scoped_refptr<webrtc::PeerConnectionInterface> pc,
5255
webrtc::scoped_refptr<PeerObserver> observer)
53-
: observer_(observer), peer_connection_(pc) {}
56+
: pc_factory_(pc_factory), observer_(observer), peer_connection_(pc) {}
5457

5558
webrtc::scoped_refptr<DataChannel> CreateDataChannel(
5659
const char* label, const lkDataChannelInit* init);
@@ -80,9 +83,9 @@ class Peer : public webrtc::RefCountInterface {
8083
void RestartIce();
8184

8285
lkRtpSender* AddTrack(lkMediaStreamTrack* track,
83-
lkString** streamIds,
84-
int streamIdCount,
85-
lkRtcError** error);
86+
lkString** streamIds,
87+
int streamIdCount,
88+
lkRtcError** error);
8689

8790
lkPeerState GetPeerState() const {
8891
return static_cast<lkPeerState>(peer_connection_->peer_connection_state());
@@ -108,6 +111,7 @@ class Peer : public webrtc::RefCountInterface {
108111
bool Close();
109112

110113
private:
114+
webrtc::scoped_refptr<PeerFactory> pc_factory_;
111115
webrtc::scoped_refptr<PeerObserver> observer_;
112116
webrtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
113117
};

0 commit comments

Comments
 (0)