Conversation
📝 WalkthroughWalkthroughThese changes extend the protobuf SDK to support RTP metrics collection and reporting. The changes introduce five new RTP data structure types (RtpBase, InboundRtp, OutboundRtp, RemoteInboundRtp, RemoteOutboundRtp), two new signal message types for sending metrics to the server, and expand SDK type enumeration and ClientDetails with additional fields. Changes
Sequence DiagramsequenceDiagram
participant Client
participant RtpCollector as RTP Data Collector
participant MetricsBuilder as Metrics Builder
participant Server
Client->>RtpCollector: Collect RTP statistics
RtpCollector->>RtpCollector: Generate InboundRtp instances
RtpCollector->>RtpCollector: Generate OutboundRtp instances
RtpCollector->>RtpCollector: Generate RemoteInboundRtp instances
RtpCollector->>RtpCollector: Generate RemoteOutboundRtp instances
RtpCollector->>MetricsBuilder: Provide RTP arrays
MetricsBuilder->>MetricsBuilder: Build SendMetricsRequest<br/>(sessionID, inbounds, outbounds,<br/>remoteInbounds, remoteOutbounds)
MetricsBuilder->>MetricsBuilder: Serialize via SwiftProtobuf
MetricsBuilder->>Server: Send SendMetricsRequest
Server->>Server: Deserialize SendMetricsRequest
Server->>Server: Process RTP metrics
Server->>Client: Return SendMetricsResponse
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Generated by 🚫 Danger |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Sources/StreamVideo/Models/ClientCapability.swift`:
- Around line 32-33: Add a dedicated enum case for the coordinatorStats
capability in the ClientCapability enum instead of returning nil; update the
mapping logic that translates between raw/string values and the enum (e.g., the
init?(rawValue:) / rawValue or fromRaw/toRaw switch branches where
.coordinatorStats is currently returning nil) so that the coordinatorStats raw
string maps to the new ClientCapability.coordinatorStats case and vice versa,
ensuring the value is preserved during encoding/decoding/round-trips.
In `@Sources/StreamVideo/protobuf/sfu/models/models.pb.swift`:
- Around line 1349-1350: ClientDetails.webrtcVersion is declared but never
populated when constructing ClientDetails in SystemEnvironment+XStreamClient;
update the ClientDetails initialization there to assign webrtcVersion =
SystemEnvironment.webRTCVersion (so ClientDetails contains the WebRTC version),
and remove or stop duplicating that assignment only on SendStatsRequest in
SFUAdapter.swift (where it's currently set) to avoid inconsistencies.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
Sources/StreamVideo/Models/ClientCapability.swiftSources/StreamVideo/protobuf/sfu/models/models.pb.swiftSources/StreamVideo/protobuf/sfu/signal_rpc/signal.pb.swift
| case .coordinatorStats: | ||
| return nil |
There was a problem hiding this comment.
Map .coordinatorStats instead of dropping it.
On Line 32, returning nil for a known capability silently discards it, so the SDK cannot represent or round-trip this value. Add a dedicated enum case and map it in both directions.
Proposed fix
public enum ClientCapability: Hashable, Sendable, CaseIterable {
@@
case subscriberVideoPause
+ case coordinatorStats
@@
init?(_ source: Stream_Video_Sfu_Models_ClientCapability) {
switch source {
case .subscriberVideoPause:
self = .subscriberVideoPause
+ case .coordinatorStats:
+ self = .coordinatorStats
case .unspecified:
return nil
case .UNRECOGNIZED:
return nil
- case .coordinatorStats:
- return nil
}
}
@@
var rawValue: Stream_Video_Sfu_Models_ClientCapability {
switch self {
case .subscriberVideoPause:
return .subscriberVideoPause
+ case .coordinatorStats:
+ return .coordinatorStats
}
}
}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Sources/StreamVideo/Models/ClientCapability.swift` around lines 32 - 33, Add
a dedicated enum case for the coordinatorStats capability in the
ClientCapability enum instead of returning nil; update the mapping logic that
translates between raw/string values and the enum (e.g., the init?(rawValue:) /
rawValue or fromRaw/toRaw switch branches where .coordinatorStats is currently
returning nil) so that the coordinatorStats raw string maps to the new
ClientCapability.coordinatorStats case and vice versa, ensuring the value is
preserved during encoding/decoding/round-trips.
| var webrtcVersion: String = String() | ||
|
|
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if webrtcVersion is being populated in ClientDetails construction
rg -n --type swift -C5 'webrtcVersion'Repository: GetStream/stream-video-swift
Length of output: 22763
🏁 Script executed:
#!/bin/bash
# Check the name map around line 2792 in models.pb.swift
sed -n '2785,2815p' Sources/StreamVideo/protobuf/sfu/models/models.pb.swiftRepository: GetStream/stream-video-swift
Length of output: 1752
🏁 Script executed:
#!/bin/bash
# Search for ClientDetails construction and initialization
rg -n --type swift 'ClientDetails' -A3 -B3 | head -100Repository: GetStream/stream-video-swift
Length of output: 8414
🏁 Script executed:
#!/bin/bash
# Read the full clientDetails construction in SystemEnvironment
sed -n '15,50p' Sources/StreamVideo/Utils/SystemEnvironment+XStreamClient.swiftRepository: GetStream/stream-video-swift
Length of output: 1329
Field ClientDetails.webrtcVersion is correctly integrated but not being populated.
Field number 5 is consistently implemented across the name map (line 2792), decode (line 2805), traverse (lines 2828–2829), and equality (line 2839). However, the field is never set when constructing ClientDetails in SystemEnvironment+XStreamClient.swift—only the sdk, device, and os properties are initialized. The webrtcVersion is being set on SendStatsRequest instead (SFUAdapter.swift line 367), not on ClientDetails. Populate ClientDetails.webrtcVersion with SystemEnvironment.webRTCVersion during its initialization to ensure the field contains meaningful data.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Sources/StreamVideo/protobuf/sfu/models/models.pb.swift` around lines 1349 -
1350, ClientDetails.webrtcVersion is declared but never populated when
constructing ClientDetails in SystemEnvironment+XStreamClient; update the
ClientDetails initialization there to assign webrtcVersion =
SystemEnvironment.webRTCVersion (so ClientDetails contains the WebRTC version),
and remove or stop duplicating that assignment only on SendStatsRequest in
SFUAdapter.swift (where it's currently set) to avoid inconsistencies.
SDK Size
|
|
StreamVideo XCSize
Show 7 more objects
|
Public Interface🚀 No changes affecting the public interface. |



🔗 Issue Links
Provide all JIRA tickets and/or GitHub issues related to this PR, if applicable.
🎯 Goal
Describe why we are making this change.
📝 Summary
Provide bullet points with the most important changes in the codebase.
🛠 Implementation
Provide a detailed description of the implementation and explain your decisions if you find them relevant.
🎨 Showcase
Add relevant screenshots and/or videos/gifs to easily see what this PR changes, if applicable.
imgimg🧪 Manual Testing Notes
Explain how this change can be tested manually, if applicable.
☑️ Contributor Checklist
🎁 Meme
Provide a funny gif or image that relates to your work on this pull request. (Optional)
Summary by CodeRabbit