Skip to content

Updated protobuf codegen#1065

Merged
martinmitrevski merged 2 commits intodevelopfrom
protobuf-codegen-feb26
Feb 25, 2026
Merged

Updated protobuf codegen#1065
martinmitrevski merged 2 commits intodevelopfrom
protobuf-codegen-feb26

Conversation

@martinmitrevski
Copy link
Contributor

@martinmitrevski martinmitrevski commented Feb 25, 2026

🔗 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.

Before After
img img

🧪 Manual Testing Notes

Explain how this change can be tested manually, if applicable.

☑️ Contributor Checklist

  • I have signed the Stream CLA (required)
  • This change follows zero ⚠️ policy (required)
  • This change should receive manual QA
  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • Comparison screenshots added for visual changes
  • Affected documentation updated (tutorial, CMS)

🎁 Meme

Provide a funny gif or image that relates to your work on this pull request. (Optional)

Summary by CodeRabbit

  • New Features
    • Enhanced call quality monitoring with improved diagnostic capabilities
    • Extended platform compatibility with support for additional SDK client types
    • Improved real-time metrics collection for detailed audio and video quality tracking
    • Better call performance visibility for monitoring and troubleshooting

@martinmitrevski martinmitrevski requested a review from a team as a code owner February 25, 2026 15:37
@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

📝 Walkthrough

Walkthrough

These 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

Cohort / File(s) Summary
ClientCapability Enum Extension
Sources/StreamVideo/Models/ClientCapability.swift
Added new coordinatorStats case to ClientCapability enum with graceful nil mapping in failable initializer.
Protobuf RTP Models
Sources/StreamVideo/protobuf/sfu/models/models.pb.swift
Added five new public RTP-related struct types (RtpBase, InboundRtp, OutboundRtp, RemoteInboundRtp, RemoteOutboundRtp) with comprehensive serialization/deserialization support, Sendable conformance, and field mappings. Extended SdkType enum with python and visionAgents cases. Extended ClientCapability with coordinatorStats case. Added webrtcVersion field to ClientDetails with full protobuf integration.
Protobuf Metrics Messages
Sources/StreamVideo/protobuf/sfu/signal_rpc/signal.pb.swift
Introduced SendMetricsRequest and SendMetricsResponse message types with full SwiftProtobuf conformance. SendMetricsRequest carries session identifiers and arrays of RTP statistics; SendMetricsResponse is minimal response type. Added Sendable extensions and complete serialization/deserialization logic.

Sequence Diagram

sequenceDiagram
    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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 A metrics trail through the air so bright,
RTP stats dancing left and right,
Protobuf messages, serialized with care,
Sending data structures everywhere!
From client to server, the numbers take flight,
Statistics bundled up just right! 📊✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.13% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Updated protobuf codegen' is vague and generic, using non-descriptive language that doesn't convey meaningful information about what specifically was updated or why. Consider using a more specific title that indicates the main changes, such as 'Add RTP metrics support and new SDK capabilities to protobuf models' or 'Add coordinatorStats capability and RTP data structures to generated protobuf code'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch protobuf-codegen-feb26

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

2 Warnings
⚠️ Please be sure to complete the Contributor Checklist in the Pull Request description
⚠️ Big PR

Generated by 🚫 Danger

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between d4cfe9e and 2251170.

📒 Files selected for processing (3)
  • Sources/StreamVideo/Models/ClientCapability.swift
  • Sources/StreamVideo/protobuf/sfu/models/models.pb.swift
  • Sources/StreamVideo/protobuf/sfu/signal_rpc/signal.pb.swift

Comment on lines +32 to +33
case .coordinatorStats:
return nil
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

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.

Comment on lines +1349 to +1350
var webrtcVersion: String = String()

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 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.swift

Repository: 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 -100

Repository: 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.swift

Repository: 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.

@martinmitrevski martinmitrevski enabled auto-merge (squash) February 25, 2026 15:50
@Stream-SDK-Bot
Copy link
Collaborator

SDK Size

title develop branch diff status
StreamVideo 10.01 MB 10.06 MB +51 KB 🟢
StreamVideoSwiftUI 2.45 MB 2.45 MB 0 KB 🟢
StreamVideoUIKit 2.58 MB 2.58 MB 0 KB 🟢
StreamWebRTC 11.07 MB 11.07 MB 0 KB 🟢

@sonarqubecloud
Copy link

@Stream-SDK-Bot
Copy link
Collaborator

StreamVideo XCSize

Object Diff (bytes)
models.pb.o +23078
GeofenceSettings.o +8192
signal.pb.o +6907
CallKitAlwaysAvailabilityPolicy.o +2653
events.pb.o -1128
Show 7 more objects
Object Diff (bytes)
WebRTCCoordinator+Joining.o -600
Errors.o -140
SwiftProtobuf.o -80
UserRequest.o +68
Encodable+Retroactive.o +64
SystemEnvironment+XStreamClient.o -56
SignalServerEvent.o -48

@github-actions
Copy link

Public Interface

🚀 No changes affecting the public interface.

@martinmitrevski martinmitrevski merged commit e3d302d into develop Feb 25, 2026
13 checks passed
@martinmitrevski martinmitrevski deleted the protobuf-codegen-feb26 branch February 25, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants