Skip to content

Fix carah error of get session stats request #490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions libwebrtc/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub enum RtcStats {
LocalCandidate(LocalCandidateStats),
RemoteCandidate(RemoteCandidateStats),
Certificate(CertificateStats),
Stream(StreamStats),
Track, // Deprecated
}

Expand Down Expand Up @@ -272,6 +273,15 @@ pub struct CertificateStats {
pub certificate: dictionaries::CertificateStats,
}

#[derive(Debug, Default, Clone, Deserialize)]
pub struct StreamStats {
#[serde(flatten)]
pub rtc: dictionaries::RtcStats,

#[serde(flatten)]
pub stream: dictionaries::StreamStats,
}

#[derive(Debug, Default, Clone, Deserialize)]
pub struct TrackStats {}

Expand Down Expand Up @@ -588,4 +598,13 @@ pub mod dictionaries {
pub base64_certificate: String,
pub issuer_certificate_id: String,
}

#[derive(Debug, Default, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(default)]
pub struct StreamStats {
pub id: String,
pub stream_identifier: String,
// pub timestamp: i64,
}
}
14 changes: 13 additions & 1 deletion livekit-ffi/protocol/stats.proto
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ message RtcStats {
required CertificateStats certificate = 2;
}

message Stream {
required RtcStatsData rtc = 1;
required StreamStats stream = 2;
}

message Track {
// Deprecated
}
Expand All @@ -189,7 +194,8 @@ message RtcStats {
LocalCandidate local_candidate = 14;
RemoteCandidate remote_candidate = 15;
Certificate certificate = 16;
Track track = 17;
Stream stream = 17;
Track track = 18;
}
}

Expand Down Expand Up @@ -447,3 +453,9 @@ message CertificateStats {
required string issuer_certificate_id = 4;
}

message StreamStats {
required string id = 1;
required string stream_identifier = 2;
// required int64 timestamp = 3;
}

13 changes: 13 additions & 0 deletions livekit-ffi/src/conversion/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ impl From<rtc::RtcStats> for proto::RtcStats {
rtc::RtcStats::Certificate(certificate) => {
proto::rtc_stats::Stats::Certificate(certificate.into())
}
rtc::RtcStats::Stream(stream) => proto::rtc_stats::Stats::Stream(stream.into()),
rtc::RtcStats::Track {} => {
proto::rtc_stats::Stats::Track(proto::rtc_stats::Track {})
}
Expand Down Expand Up @@ -281,6 +282,12 @@ impl From<rtc::CertificateStats> for proto::rtc_stats::Certificate {
}
}

impl From<rtc::StreamStats> for proto::rtc_stats::Stream {
fn from(value: rtc::StreamStats) -> Self {
Self { rtc: value.rtc.into(), stream: value.stream.into() }
}
}

// Dictionaries

impl From<rtc::dictionaries::RtcStats> for proto::RtcStatsData {
Expand All @@ -289,6 +296,12 @@ impl From<rtc::dictionaries::RtcStats> for proto::RtcStatsData {
}
}

impl From<rtc::dictionaries::StreamStats> for proto::StreamStats {
fn from(value: rtc::dictionaries::StreamStats) -> Self {
Self { id: value.id, stream_identifier: value.stream_identifier }
}
}

impl From<rtc::dictionaries::CodecStats> for proto::CodecStats {
fn from(value: rtc::dictionaries::CodecStats) -> Self {
Self {
Expand Down
Loading