Showing the changes to interface/src/scripting/ScreenshareScriptingInterface.cpp (1 of 3 files). Show all
Unified · Split
| @@ -39,6 +39,7 @@ ScreenshareScriptingInterface::ScreenshareScriptingInterface() { · 38 unmodified lines | ||
| 39 | 39 | _requestScreenshareInfoRetryTimer->setInterval(SCREENSHARE_INFO_REQUEST_RETRY_TIMEOUT_MS); |
| 40 | 40 | connect(_requestScreenshareInfoRetryTimer, &QTimer::timeout, this, &ScreenshareScriptingInterface::requestScreenshareInfo); |
| 41 | 41 | |
| 42 | + // This packet listener handles the packet containing information about the latest zone ID in which we are allowed to share. | |
| 42 | 43 | auto nodeList = DependencyManager::get<NodeList>(); |
| 43 | 44 | PacketReceiver& packetReceiver = nodeList->getPacketReceiver(); |
| 44 | 45 | packetReceiver.registerListener(PacketType::AvatarZonePresence, this, "processAvatarZonePresencePacketOnClient"); |
| @@ -56,8 +57,11 @@ void ScreenshareScriptingInterface::processAvatarZonePresencePacketOnClient(QSha · 11 unmodified lines | ||
| 56 | 57 | return; |
| 57 | 58 | } |
| 58 | 59 | |
| 60 | + // Set the last known authorized screenshare zone ID to the zone that the Domain Server just told us about. | |
| 59 | 61 | _lastAuthorizedZoneID = zone; |
| 60 | 62 | |
| 63 | + // If we had previously started the screenshare process but knew that we weren't going to be authorized to screenshare, | |
| 64 | + // let's continue the screenshare process here. | |
| 61 | 65 | if (_waitingForAuthorization) { |
| 62 | 66 | requestScreenshareInfo(); |
| 63 | 67 | } |
| @@ -65,6 +69,9 @@ void ScreenshareScriptingInterface::processAvatarZonePresencePacketOnClient(QSha · 1 unmodified line | ||
| 65 | 69 | |
| 66 | 70 | static const int MAX_NUM_SCREENSHARE_INFO_REQUEST_RETRIES = 5; |
| 67 | 71 | void ScreenshareScriptingInterface::requestScreenshareInfo() { |
| 72 | + // If the screenshare zone that we're currently in (i.e. `startScreenshare()` was called) is different from | |
| 73 | + // the zone in which we are authorized to screenshare... | |
| 74 | + // ...return early here and wait for the DS to send us a packet containing this zone's ID. | |
| 68 | 75 | if (_screenshareZoneID != _lastAuthorizedZoneID) { |
| 69 | 76 | qDebug() << "Client not yet authorized to screenshare. Waiting for authorization message from domain server..."; |
| 70 | 77 | _waitingForAuthorization = true; |