Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the Flutter Cast Framework, introducing active cast discovery and multicast lock management on Android to prevent discovery failures on certain devices. It also updates dependencies, raises the iOS deployment target to 13.0, and standardizes default receiver IDs across platforms. Feedback on these changes highlights a potential battery drain issue in FlutterCastFrameworkPlugin.kt where a multicast lock is acquired before validating the selector, and notes that ephemeral LLDB files under the example/ios/Flutter/ephemeral/ directory should be removed from version control.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| private fun startActiveDiscovery(context: Context, castContext: CastContext) { | ||
| try { | ||
| acquireMulticastLock(context) | ||
| val mediaRouter = mMediaRouter ?: MediaRouter.getInstance(context).also { mMediaRouter = it } | ||
| val selector = castContext.mergedSelector ?: return | ||
| mediaRouter.addCallback( | ||
| selector, | ||
| mMediaRouterCallback, | ||
| MediaRouter.CALLBACK_FLAG_PERFORM_ACTIVE_SCAN | ||
| ) | ||
| Log.d(TAG, "Active cast discovery started") | ||
| } catch (e: Exception) { | ||
| Log.e(TAG, "Failed to start active cast discovery", e) | ||
| } | ||
| } |
There was a problem hiding this comment.
O acquireMulticastLock(context) é chamado antes da verificação de nulidade de castContext.mergedSelector. Se mergedSelector for nulo, o método retorna antecipadamente, mas o MulticastLock permanece ativo sem que nenhuma descoberta ativa esteja ocorrendo. Isso pode causar um consumo desnecessário de bateria, pois impede que o chip Wi-Fi entre no modo de baixo consumo. Recomenda-se mover a chamada de acquireMulticastLock(context) para depois da verificação de nulidade do selector.
| private fun startActiveDiscovery(context: Context, castContext: CastContext) { | |
| try { | |
| acquireMulticastLock(context) | |
| val mediaRouter = mMediaRouter ?: MediaRouter.getInstance(context).also { mMediaRouter = it } | |
| val selector = castContext.mergedSelector ?: return | |
| mediaRouter.addCallback( | |
| selector, | |
| mMediaRouterCallback, | |
| MediaRouter.CALLBACK_FLAG_PERFORM_ACTIVE_SCAN | |
| ) | |
| Log.d(TAG, "Active cast discovery started") | |
| } catch (e: Exception) { | |
| Log.e(TAG, "Failed to start active cast discovery", e) | |
| } | |
| } | |
| private fun startActiveDiscovery(context: Context, castContext: CastContext) { | |
| try { | |
| val selector = castContext.mergedSelector ?: return | |
| acquireMulticastLock(context) | |
| val mediaRouter = mMediaRouter ?: MediaRouter.getInstance(context).also { mMediaRouter = it } | |
| mediaRouter.addCallback( | |
| selector, | |
| mMediaRouterCallback, | |
| MediaRouter.CALLBACK_FLAG_PERFORM_ACTIVE_SCAN | |
| ) | |
| Log.d(TAG, "Active cast discovery started") | |
| } catch (e: Exception) { | |
| Log.e(TAG, "Failed to start active cast discovery", e) | |
| } | |
| } |
| @@ -0,0 +1,32 @@ | |||
| # | |||
There was a problem hiding this comment.
| @@ -0,0 +1,5 @@ | |||
| # | |||
There was a problem hiding this comment.
Atualiza o fork para permitir build em arquitetura arm64(simulador iOS ).
close https://github.com/StudioSol/PalcoMobile/issues/2937