void DefaultSignalingClient::UpdateRemoteVideoSubscriptions()

in chime-sdk-signaling-cpp/src/signaling/default_signaling_client.cc [139:166]


void DefaultSignalingClient::UpdateRemoteVideoSubscriptions(
    const std::map<std::string, RemoteVideoSourceInfo>& added_updated, const std::vector<std::string>& removed) {
  for (const auto& added : added_updated) {
    auto it = remote_video_sources_.find(added.first);
    auto attendee_to_internal_stream = attendee_id_to_internal_configurations_.find(added.second.attendee.attendee_id);
    if (it == remote_video_sources_.end()) {
      if (attendee_to_internal_stream == attendee_id_to_internal_configurations_.end()) {
        // should not reach this point since builders should call it after OnRemoteVideosAvailable
        CHIME_LOG(LogLevel::kWarning, "UpdateRemoteVideoSubscriptions seems to be called before OnRemoteVideoAvailable")
      } else {
        remote_video_sources_[added.first] = attendee_to_internal_stream->second;
      }
    } else {
      if (attendee_to_internal_stream == attendee_id_to_internal_configurations_.end()) {
        // should not reach this point since builders should call it after OnRemoteVideoAvailable
        CHIME_LOG(LogLevel::kWarning, "UpdateRemoteVideoSubscriptions seems to be called before OnRemoteVideoAvailable")
      } else {
        // just update
        it->second.group_id = attendee_to_internal_stream->second.group_id;
        it->second.max_bitrate_kbps = added.second.max_bitrate_kbps;
      }
    }
  }

  for (const auto& removed_subscription : removed) {
    remote_video_sources_.erase(removed_subscription);
  }
}