From 9ac66ca6eb7331c8b8f6482759f5847759857f4d Mon Sep 17 00:00:00 2001 From: littleGnAl Date: Mon, 11 Sep 2023 16:03:49 +0800 Subject: [PATCH] fix: [windows] Fix can not get `irisRtcRenderingHandle` in 32-bit --- 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;