feat(stream): 优化连接中→首帧过渡 + RTSP 瞬态错误自动重试#28
Conversation
- ConnectingOverlay 推迟到首帧解码后才退场,并以 320ms 淡出+轻微放大与首帧出现对齐 - 遮罩使用应用海报作模糊背景,不再纯黑等待 - 等待期随机展示一条小课堂提示 - RTSP ANNOUNCE 阶段瞬态 socket 错误(errno 4/32/104/110)自动重试一次 - bump version to 1.0.0.771
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough此 PR 改进连接流程:为连接遮罩新增海报背景与随机提示,从列表页面传递 poster,延迟至首帧到达再标记 CONNECTED,并在 RTSP ANNOUNCE 阶段对若干瞬态错误进行一次自动重试,同时更新版本与变更日志。 变更总览本 PR 优化了应用启动时的连接体验和弱网场景下的连接弹性:引入 RTSP 握手瞬态错误自动重试、将连接状态转移延迟至首帧到达、用应用海报与随机小课堂提示重新设计连接遮罩UI,并提升版本号至 1.0.0.771。 变更详解连接体验与弱网弹性
审查工作量评估🎯 4 (复杂) | ⏱️ ~45 分钟 可能相关的 PR
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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: 2
🧹 Nitpick comments (1)
entry/src/main/ets/viewmodel/StreamViewModel.ets (1)
839-846: ⚡ Quick win建议在
dispose()中添加定时器清理虽然正常流程下
stopStreaming()已清理firstFrameTimer,但dispose()作为最后的兜底清理方法,应显式调用stopFirstFrameWatcher()以防御异常路径下的定时器泄漏。🛡️ 建议的防御性修复
dispose(): void { this.resetRotationState(); + this.stopFirstFrameWatcher(); if (this.streamingSession) {🤖 Prompt for 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. In `@entry/src/main/ets/viewmodel/StreamViewModel.ets` around lines 839 - 846, The dispose() method currently resets rotation and stops the streamingSession but doesn't explicitly clear the first-frame timer; add a defensive call to stopFirstFrameWatcher() inside dispose() (before or after resetting state) so any leftover firstFrameTimer is cleaned up even if stopStreaming() wasn't reached; reference the existing methods dispose(), resetRotationState(), stopFirstFrameWatcher(), stopStreaming() and the firstFrameTimer/streamingSession fields when making the change.
🤖 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 `@entry/src/main/ets/service/streaming/StreamingSession.ets`:
- Around line 1291-1304: The retry branch can resurrect a user-cancelled
session: before calling the retry path and again after the 1.5s wait check the
cancellation flag and bail if set; specifically, after callStart() returns a
transient code from TRANSIENT_ERRORS, check this.userInitiatedStop and return
immediately if true, call this.nativeModule.stopConnection only when not
cancelled, then after the await new Promise(...) check this.userInitiatedStop
again before invoking callStart() a second time so stop()/quitApp() cannot
re-launch the session.
In `@entry/src/main/resources/rawfile/CHANGELOG.md`:
- Line 32: Replace the nonstandard symbol "≡" in the CHANGELOG sentence
containing "黑底 ≡ 现在推迟到" with a clearer connector (e.g., ",现在推迟到" or "→ 现在推迟到")
so the line describing the mask transition ("连接中 → 首帧动画过渡:... 黑底 ≡ 现在推迟到...")
uses a standard punctuation/arrow; update only that connector to improve
readability while keeping the rest of the phrasing intact.
---
Nitpick comments:
In `@entry/src/main/ets/viewmodel/StreamViewModel.ets`:
- Around line 839-846: The dispose() method currently resets rotation and stops
the streamingSession but doesn't explicitly clear the first-frame timer; add a
defensive call to stopFirstFrameWatcher() inside dispose() (before or after
resetting state) so any leftover firstFrameTimer is cleaned up even if
stopStreaming() wasn't reached; reference the existing methods dispose(),
resetRotationState(), stopFirstFrameWatcher(), stopStreaming() and the
firstFrameTimer/streamingSession fields when making the change.
🪄 Autofix (Beta)
✅ Autofix completed
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b575af13-0b52-420a-8221-f42e58be5208
📒 Files selected for processing (7)
AppScope/app.json5entry/src/main/ets/components/StreamConnectingTips.etsentry/src/main/ets/pages/AppListPageV2.etsentry/src/main/ets/pages/StreamPage.etsentry/src/main/ets/service/streaming/StreamingSession.etsentry/src/main/ets/viewmodel/StreamViewModel.etsentry/src/main/resources/rawfile/CHANGELOG.md
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Fixes Applied SuccessfullyFixed 2 file(s) based on 2 unresolved review comments. Files modified:
Commit: The changes have been pushed to the Time taken: |
Fixed 2 file(s) based on 2 unresolved review comments. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
背景
用户反馈两个问题:
drStart(MediaCodec 启动完成)瞬间就消失,但首帧真正上屏还要再等 ~150-300ms(IDR 到达 + 解码 + 渲染),中间会露出尚未填充画面的 XComponent → 黑屏闪烁。改动
视觉过渡
drStart后改为轮询framesDecoded,等到首帧实际解码完成才切CONNECTED(1500ms 兜底),让遮罩淡出与首帧出现严丝合缝。#CC000000改为应用海报模糊 + 渐变暗化,消除等待期的纯黑感。TransitionEffect.asymmetric,进入 IDENTITY、离开 320ms 淡出 + 轻微放大(×1.04),与首帧浮现自然交错。自动重试
startConnection包一层重试:返回值为 4 / 32 / 104 / 110(EINTR / EPIPE / ECONNRESET / ETIMEDOUT)时认定为传输层瞬态错误,自动stopConnection+ 等待 1.5s + 重试一次。验证
hvigorw assembleHap)文件
StreamPage.ets:ConnectingOverlay 重做(海报背景 + 渐变 + 提示 + 离场动画)StreamViewModel.ets:drStart 后改为首帧轮询,1500ms 兜底StreamingSession.ets:startConnection 瞬态错误重试一次AppListPageV2.ets:透传posterPath给 StreamPageStreamConnectingTips.ets(新增):45 条小课堂提示池bump to v771
Summary by CodeRabbit
新功能
Bug修复
版本更新