Fix video render mode switching - #1135
Merged
Merged
Conversation
Switching renderMode on a live VideoTrackRenderer previously crashed (platformView to texture cast error) or leaked the old texture renderer (texture to platformView). Reset the renderer on mode change, respecting ownership: platform view controllers are disposed by RTCVideoPlatFormView and caller-provided cachedRenderers are never disposed here.
hiroshihorie
requested review from
cloudwebrtc and
xianshijing-lk
as code owners
July 20, 2026 16:39
The renderer was adopted under the old widget's configuration, so checking identity against the incoming widget.cachedRenderer could wrongly dispose a caller-owned renderer when the caller swaps both renderMode and cachedRenderer in the same update.
hiroshihorie
added a commit
that referenced
this pull request
Jul 28, 2026
Changes the default `renderMode` from `texture` to `auto`. For now `auto` resolves to texture rendering on all platforms, so behavior is unchanged. This lets the SDK change how `auto` resolves in a future release without an API break. Platform view support and related fixes from the original diff already landed via #1116 and #1135.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Switching
renderModeon a liveVideoTrackRenderer(texture to platformView or back) previously misbehaved on iOS, and would have on macOS after #1116:_rendererstill held theRTCVideoPlatformViewController, which then failed theas rtc.RTCVideoRenderercast.srcObject, kept consuming decoded frames and held its GPU texture.cachedRenderereven in platform view mode.Fix
didUpdateWidgetnow resets the renderer when the effective render mode changes, with ownership respected:RTCVideoPlatFormView, so disposing them from this widget raced its own dispose (the controller's_disposedguard is set only after two awaits, so both dispose calls could pass it).cachedRendereris never disposed on a mode switch, so it can be re-adopted when switching back.autoDisposeRenderer, matching unmount behavior.Testing
flutter analyzeanddart formatclean.🤖 Generated with Claude Code