Improve video analytics by correctly sending ice state#1724
Improve video analytics by correctly sending ice state#1724rahul-lohra wants to merge 5 commits into
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
WalkthroughIntroduces a ChangesVideoAnalyticsIceState Analytics Refactor
Sequence Diagram(s)sequenceDiagram
participant PeerConnectionAnalytics
participant observeConnection
participant IceStateFlow
participant ClientEventReporter
participant ClientEventFactory
PeerConnectionAnalytics->>observeConnection: emit PeerConnectionState (CONNECTING/CONNECTED/FAILED)
observeConnection->>observeConnection: filter allowed states, deduplicate via distinctUntilChanged
alt PeerConnectionState == CONNECTED
observeConnection->>IceStateFlow: withTimeoutOrNull(ICE_CONNECTED_GRACE_MILLIS) first(CONNECTED/COMPLETED)
IceStateFlow-->>observeConnection: ICE CONNECTED within grace → VideoAnalyticsIceState.CONNECTED
IceStateFlow-->>observeConnection: grace elapsed → VideoAnalyticsIceState (current)
else CONNECTING or FAILED
observeConnection->>observeConnection: toVideoAnalyticsIceState() immediately
end
observeConnection->>ClientEventReporter: onPeerConnectionStateChanged(VideoAnalyticsIceState, PeerConnectionState)
ClientEventReporter->>ClientEventFactory: buildRequest(iceState: VideoAnalyticsIceState?)
ClientEventFactory-->>ClientEventReporter: ClientEvent with iceState.text
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/analytics/reporting/ClientEventReporter.kt`:
- Around line 291-294: The unconditional Log.d call with tag "Noob" in the
onPeerConnectionStateChanged method will produce noisy logs on every peer
connection state transition in production. Either remove this debug log
statement entirely or wrap it in a conditional check using
StreamVideoImpl.developmentMode to ensure the verbose logging only occurs during
development, following the coding guideline that requires monitoring logging
verbosity and relying on developmentMode for guardrails.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 0f06c4ff-7006-4f6a-af60-fdd08b2ad968
📒 Files selected for processing (7)
stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/analytics/call/CallAnalytics.ktstream-video-android-core/src/main/kotlin/io/getstream/video/android/core/analytics/call/observer/PeerConnectionAnalytics.ktstream-video-android-core/src/main/kotlin/io/getstream/video/android/core/analytics/reporting/ClientEventFactory.ktstream-video-android-core/src/main/kotlin/io/getstream/video/android/core/analytics/reporting/ClientEventReporter.ktstream-video-android-core/src/test/kotlin/io/getstream/video/android/core/analytics/call/CallAnalyticsTest.ktstream-video-android-core/src/test/kotlin/io/getstream/video/android/core/analytics/call/observer/PeerConnectionAnalyticsTest.ktstream-video-android-core/src/test/kotlin/io/getstream/video/android/core/analytics/reporting/ClientEventReporterTest.kt
|



Goal
Closes AND-1241
Correctly map raw ice state to
VideoAnalyticsIceStateImplementation
Introduce a new
VideoAnalyticsIceStatewhich will be mapped from Raw ICE state🎨 UI Changes
None
Testing
Run 1-1 calls/group calls. Verify the local logs or kibana
Summary by CodeRabbit
Bug Fixes
Improvements