From 7438fb27e0ebc607fdda46a4482bec1f3f2e5070 Mon Sep 17 00:00:00 2001 From: Littlegnal <8847263+littleGnAl@users.noreply.github.com> Date: Tue, 12 Sep 2023 11:21:51 +0800 Subject: [PATCH] fix: [windows] Fix can not get `irisRtcRenderingHandle` in 32-bit (#1311) --- windows/video_view_controller.cc | 37 ++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/windows/video_view_controller.cc b/windows/video_view_controller.cc index d5702302f..e4b70a0cf 100644 --- a/windows/video_view_controller.cc +++ b/windows/video_view_controller.cc @@ -58,25 +58,34 @@ void VideoViewController::HandleMethodCall( return; } - intptr_t irisRtcRenderingHandle; - if (!GetValueFromEncodableMap(arguments, "irisRtcRenderingHandle", irisRtcRenderingHandle)) + int64_t irisRtcRenderingHandle; { - result->Error("Invalid arguments", "No irisRtcRenderingHandle provided."); - return; + auto iter = arguments->find(flutter::EncodableValue(flutter::EncodableValue("irisRtcRenderingHandle"))); + if (iter != arguments->end() && !iter->second.IsNull()) + { + // The `irisRtcRenderingHandle` maybe in 32-bit on some devices, we need call `LongValue` explictly + irisRtcRenderingHandle = iter->second.LongValue(); + } + else + { + result->Error("Invalid arguments", "No irisRtcRenderingHandle provided."); + return; + } } int64_t uid; - - auto iter = arguments->find(flutter::EncodableValue(flutter::EncodableValue("uid"))); - if (iter != arguments->end() && !iter->second.IsNull()) { - // The uid may between 32-bit and 64-bit value, we need call `LongValue` explictly - uid = iter->second.LongValue(); - } - else - { - result->Error("Invalid arguments", "No uid provided."); - return; + auto iter = arguments->find(flutter::EncodableValue(flutter::EncodableValue("uid"))); + if (iter != arguments->end() && !iter->second.IsNull()) + { + // The uid may between 32-bit and 64-bit value, we need call `LongValue` explictly + uid = iter->second.LongValue(); + } + else + { + result->Error("Invalid arguments", "No uid provided."); + return; + } } std::string channelId;