mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 01:00:44 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into hdr
This commit is contained in:
commit
64c2488155
8 changed files with 275 additions and 79 deletions
|
@ -44,13 +44,25 @@ macro(PACKAGE_LIBRARIES_FOR_DEPLOYMENT)
|
||||||
|
|
||||||
set(QTAUDIO_PATH $<TARGET_FILE_DIR:${TARGET_NAME}>/audio)
|
set(QTAUDIO_PATH $<TARGET_FILE_DIR:${TARGET_NAME}>/audio)
|
||||||
|
|
||||||
# if present, replace qtaudio_windows.dll with qtaudio_wasapi.dll
|
if (DEPLOY_PACKAGE)
|
||||||
add_custom_command(
|
# copy qtaudio_wasapi.dll alongside qtaudio_windows.dll, and let the installer resolve
|
||||||
TARGET ${TARGET_NAME}
|
add_custom_command(
|
||||||
POST_BUILD
|
TARGET ${TARGET_NAME}
|
||||||
COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windows.dll ( ${CMAKE_COMMAND} -E remove ${QTAUDIO_PATH}/qtaudio_windows.dll && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.dll ${QTAUDIO_PATH} && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.pdb ${QTAUDIO_PATH} )
|
POST_BUILD
|
||||||
COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windowsd.dll ( ${CMAKE_COMMAND} -E remove ${QTAUDIO_PATH}/qtaudio_windowsd.dll && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapid.dll ${QTAUDIO_PATH} && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapid.pdb ${QTAUDIO_PATH} )
|
COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windows.dll ( ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.dll ${QTAUDIO_PATH} && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.pdb ${QTAUDIO_PATH} )
|
||||||
)
|
COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windowsd.dll ( ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapid.dll ${QTAUDIO_PATH} && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapid.pdb ${QTAUDIO_PATH} )
|
||||||
|
)
|
||||||
|
elseif (${CMAKE_SYSTEM_VERSION} VERSION_LESS 6.2)
|
||||||
|
# continue using qtaudio_windows.dll on Windows 7
|
||||||
|
else ()
|
||||||
|
# replace qtaudio_windows.dll with qtaudio_wasapi.dll on Windows 8/8.1/10
|
||||||
|
add_custom_command(
|
||||||
|
TARGET ${TARGET_NAME}
|
||||||
|
POST_BUILD
|
||||||
|
COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windows.dll ( ${CMAKE_COMMAND} -E remove ${QTAUDIO_PATH}/qtaudio_windows.dll && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.dll ${QTAUDIO_PATH} && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.pdb ${QTAUDIO_PATH} )
|
||||||
|
COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windowsd.dll ( ${CMAKE_COMMAND} -E remove ${QTAUDIO_PATH}/qtaudio_windowsd.dll && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapid.dll ${QTAUDIO_PATH} && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapid.pdb ${QTAUDIO_PATH} )
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
endif ()
|
endif ()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
|
@ -23,6 +23,11 @@
|
||||||
;Default installation folder
|
;Default installation folder
|
||||||
InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
|
InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
|
||||||
|
|
||||||
|
;--------------------------------
|
||||||
|
;Include WinVer to get Windows version
|
||||||
|
|
||||||
|
!include "WinVer.nsh"
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
;General
|
;General
|
||||||
; leverage the UAC NSIS plugin to promote uninstaller to elevated privileges
|
; leverage the UAC NSIS plugin to promote uninstaller to elevated privileges
|
||||||
|
@ -600,8 +605,16 @@ Section "-Core installation"
|
||||||
Delete "$INSTDIR\version"
|
Delete "$INSTDIR\version"
|
||||||
Delete "$INSTDIR\xinput1_3.dll"
|
Delete "$INSTDIR\xinput1_3.dll"
|
||||||
|
|
||||||
;Delete old Qt files
|
; The installer includes two different Qt audio plugins.
|
||||||
Delete "$INSTDIR\audio\qtaudio_windows.dll"
|
; On Windows 8 and above, only qtaudio_wasapi.dll should be installed.
|
||||||
|
; On Windows 7 and below, only qtaudio_windows.dll should be installed.
|
||||||
|
${If} ${AtLeastWin8}
|
||||||
|
Delete "$INSTDIR\audio\qtaudio_windows.dll"
|
||||||
|
Delete "$INSTDIR\audio\qtaudio_windows.pdb"
|
||||||
|
${Else}
|
||||||
|
Delete "$INSTDIR\audio\qtaudio_wasapi.dll"
|
||||||
|
Delete "$INSTDIR\audio\qtaudio_wasapi.pdb"
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
; Delete old desktop shortcuts before they were renamed during Sandbox rename
|
; Delete old desktop shortcuts before they were renamed during Sandbox rename
|
||||||
Delete "$DESKTOP\@PRE_SANDBOX_INTERFACE_SHORTCUT_NAME@.lnk"
|
Delete "$DESKTOP\@PRE_SANDBOX_INTERFACE_SHORTCUT_NAME@.lnk"
|
||||||
|
|
|
@ -815,7 +815,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
|
||||||
{ "gl_version", glContextData["version"] },
|
{ "gl_version", glContextData["version"] },
|
||||||
{ "gl_vender", glContextData["vendor"] },
|
{ "gl_vender", glContextData["vendor"] },
|
||||||
{ "gl_sl_version", glContextData["slVersion"] },
|
{ "gl_sl_version", glContextData["slVersion"] },
|
||||||
{ "gl_renderer", glContextData["renderer"] }
|
{ "gl_renderer", glContextData["renderer"] },
|
||||||
|
{ "ideal_thread_count", QThread::idealThreadCount() }
|
||||||
};
|
};
|
||||||
auto macVersion = QSysInfo::macVersion();
|
auto macVersion = QSysInfo::macVersion();
|
||||||
if (macVersion != QSysInfo::MV_None) {
|
if (macVersion != QSysInfo::MV_None) {
|
||||||
|
@ -825,6 +826,16 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
|
||||||
if (windowsVersion != QSysInfo::WV_None) {
|
if (windowsVersion != QSysInfo::WV_None) {
|
||||||
properties["os_win_version"] = QSysInfo::windowsVersion();
|
properties["os_win_version"] = QSysInfo::windowsVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProcessorInfo procInfo;
|
||||||
|
if (getProcessorInfo(procInfo)) {
|
||||||
|
properties["processor_core_count"] = procInfo.numProcessorCores;
|
||||||
|
properties["logical_processor_count"] = procInfo.numLogicalProcessors;
|
||||||
|
properties["processor_l1_cache_count"] = procInfo.numProcessorCachesL1;
|
||||||
|
properties["processor_l2_cache_count"] = procInfo.numProcessorCachesL2;
|
||||||
|
properties["processor_l3_cache_count"] = procInfo.numProcessorCachesL3;
|
||||||
|
}
|
||||||
|
|
||||||
UserActivityLogger::getInstance().logAction("launch", properties);
|
UserActivityLogger::getInstance().logAction("launch", properties);
|
||||||
|
|
||||||
_connectionMonitor.init();
|
_connectionMonitor.init();
|
||||||
|
@ -1123,6 +1134,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
|
||||||
auto displayPlugin = qApp->getActiveDisplayPlugin();
|
auto displayPlugin = qApp->getActiveDisplayPlugin();
|
||||||
|
|
||||||
properties["fps"] = _frameCounter.rate();
|
properties["fps"] = _frameCounter.rate();
|
||||||
|
properties["target_frame_rate"] = getTargetFrameRate();
|
||||||
properties["present_rate"] = displayPlugin->presentRate();
|
properties["present_rate"] = displayPlugin->presentRate();
|
||||||
properties["new_frame_present_rate"] = displayPlugin->newFramePresentRate();
|
properties["new_frame_present_rate"] = displayPlugin->newFramePresentRate();
|
||||||
properties["dropped_frame_rate"] = displayPlugin->droppedFrameRate();
|
properties["dropped_frame_rate"] = displayPlugin->droppedFrameRate();
|
||||||
|
@ -1164,6 +1176,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
|
||||||
properties["deleted_entity_cnt"] = entityActivityTracking.deletedEntityCount;
|
properties["deleted_entity_cnt"] = entityActivityTracking.deletedEntityCount;
|
||||||
properties["edited_entity_cnt"] = entityActivityTracking.editedEntityCount;
|
properties["edited_entity_cnt"] = entityActivityTracking.editedEntityCount;
|
||||||
|
|
||||||
|
properties["active_display_plugin"] = getActiveDisplayPlugin()->getName();
|
||||||
|
properties["using_hmd"] = isHMDMode();
|
||||||
|
|
||||||
auto hmdHeadPose = getHMDSensorPose();
|
auto hmdHeadPose = getHMDSensorPose();
|
||||||
properties["hmd_head_pose_changed"] = isHMDMode() && (hmdHeadPose != lastHMDHeadPose);
|
properties["hmd_head_pose_changed"] = isHMDMode() && (hmdHeadPose != lastHMDHeadPose);
|
||||||
lastHMDHeadPose = hmdHeadPose;
|
lastHMDHeadPose = hmdHeadPose;
|
||||||
|
|
|
@ -817,6 +817,13 @@ void AudioClient::handleLocalEchoAndReverb(QByteArray& inputByteArray) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: we assume the inputFormat and the outputFormat are the same, since on any modern
|
||||||
|
// multimedia OS they should be. If there is a device that this is not true for, we can
|
||||||
|
// add back support to do resampling.
|
||||||
|
if (_inputFormat.sampleRate() != _outputFormat.sampleRate()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// if this person wants local loopback add that to the locally injected audio
|
// if this person wants local loopback add that to the locally injected audio
|
||||||
// if there is reverb apply it to local audio and substract the origin samples
|
// if there is reverb apply it to local audio and substract the origin samples
|
||||||
|
|
||||||
|
@ -833,11 +840,6 @@ void AudioClient::handleLocalEchoAndReverb(QByteArray& inputByteArray) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: we assume the inputFormat and the outputFormat are the same, since on any modern
|
|
||||||
// multimedia OS they should be. If there is a device that this is not true for, we can
|
|
||||||
// add back support to do resampling.
|
|
||||||
Q_ASSERT(_inputFormat.sampleRate() == _outputFormat.sampleRate());
|
|
||||||
|
|
||||||
static QByteArray loopBackByteArray;
|
static QByteArray loopBackByteArray;
|
||||||
|
|
||||||
int numInputSamples = inputByteArray.size() / AudioConstants::SAMPLE_SIZE;
|
int numInputSamples = inputByteArray.size() / AudioConstants::SAMPLE_SIZE;
|
||||||
|
@ -1362,7 +1364,7 @@ int AudioClient::setOutputBufferSize(int numFrames, bool persist) {
|
||||||
// proportional to the accelerator ratio.
|
// proportional to the accelerator ratio.
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
const float AudioClient::CALLBACK_ACCELERATOR_RATIO = 1.0f;
|
const float AudioClient::CALLBACK_ACCELERATOR_RATIO = IsWindows8OrGreater() ? 1.0f : 0.25f;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
|
|
|
@ -45,6 +45,20 @@ Connection::Connection(Socket* parentSocket, HifiSockAddr destination, std::uniq
|
||||||
// set the initial RTT and flow window size on congestion control object
|
// set the initial RTT and flow window size on congestion control object
|
||||||
_congestionControl->setRTT(_rtt);
|
_congestionControl->setRTT(_rtt);
|
||||||
_congestionControl->setMaxCongestionWindowSize(_flowWindowSize);
|
_congestionControl->setMaxCongestionWindowSize(_flowWindowSize);
|
||||||
|
|
||||||
|
// Setup packets
|
||||||
|
static const int ACK_PACKET_PAYLOAD_BYTES = sizeof(_lastSentACK) + sizeof(_currentACKSubSequenceNumber)
|
||||||
|
+ sizeof(_rtt) + sizeof(int32_t) + sizeof(int32_t) + sizeof(int32_t);
|
||||||
|
static const int LIGHT_ACK_PACKET_PAYLOAD_BYTES = sizeof(SequenceNumber);
|
||||||
|
static const int ACK2_PAYLOAD_BYTES = sizeof(SequenceNumber);
|
||||||
|
static const int NAK_PACKET_PAYLOAD_BYTES = 2 * sizeof(SequenceNumber);
|
||||||
|
static const int HANDSHAKE_ACK_PAYLOAD_BYTES = sizeof(SequenceNumber);
|
||||||
|
|
||||||
|
_ackPacket = ControlPacket::create(ControlPacket::ACK, ACK_PACKET_PAYLOAD_BYTES);
|
||||||
|
_lightACKPacket = ControlPacket::create(ControlPacket::LightACK, LIGHT_ACK_PACKET_PAYLOAD_BYTES);
|
||||||
|
_ack2Packet = ControlPacket::create(ControlPacket::ACK2, ACK2_PAYLOAD_BYTES);
|
||||||
|
_lossReport = ControlPacket::create(ControlPacket::NAK, NAK_PACKET_PAYLOAD_BYTES);
|
||||||
|
_handshakeACK = ControlPacket::create(ControlPacket::HandshakeACK, HANDSHAKE_ACK_PAYLOAD_BYTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
Connection::~Connection() {
|
Connection::~Connection() {
|
||||||
|
@ -279,25 +293,22 @@ void Connection::sendACK(bool wasCausedBySyncTimeout) {
|
||||||
|
|
||||||
// update the last sent ACK
|
// update the last sent ACK
|
||||||
_lastSentACK = nextACKNumber;
|
_lastSentACK = nextACKNumber;
|
||||||
|
|
||||||
// setup the ACK packet, make it static so we can re-use it
|
|
||||||
static const int ACK_PACKET_PAYLOAD_BYTES = sizeof(_lastSentACK) + sizeof(_currentACKSubSequenceNumber)
|
_ackPacket->reset(); // We need to reset it every time.
|
||||||
+ sizeof(_rtt) + sizeof(int32_t) + sizeof(int32_t) + sizeof(int32_t);
|
|
||||||
static auto ackPacket = ControlPacket::create(ControlPacket::ACK, ACK_PACKET_PAYLOAD_BYTES);
|
|
||||||
ackPacket->reset(); // We need to reset it every time.
|
|
||||||
|
|
||||||
// pack in the ACK sub-sequence number
|
// pack in the ACK sub-sequence number
|
||||||
ackPacket->writePrimitive(++_currentACKSubSequenceNumber);
|
_ackPacket->writePrimitive(++_currentACKSubSequenceNumber);
|
||||||
|
|
||||||
// pack in the ACK number
|
// pack in the ACK number
|
||||||
ackPacket->writePrimitive(nextACKNumber);
|
_ackPacket->writePrimitive(nextACKNumber);
|
||||||
|
|
||||||
// pack in the RTT and variance
|
// pack in the RTT and variance
|
||||||
ackPacket->writePrimitive(_rtt);
|
_ackPacket->writePrimitive(_rtt);
|
||||||
|
|
||||||
// pack the available buffer size, in packets
|
// pack the available buffer size, in packets
|
||||||
// in our implementation we have no hard limit on receive buffer size, send the default value
|
// in our implementation we have no hard limit on receive buffer size, send the default value
|
||||||
ackPacket->writePrimitive((int32_t) udt::CONNECTION_RECEIVE_BUFFER_SIZE_PACKETS);
|
_ackPacket->writePrimitive((int32_t) udt::CONNECTION_RECEIVE_BUFFER_SIZE_PACKETS);
|
||||||
|
|
||||||
if (wasCausedBySyncTimeout) {
|
if (wasCausedBySyncTimeout) {
|
||||||
// grab the up to date packet receive speed and estimated bandwidth
|
// grab the up to date packet receive speed and estimated bandwidth
|
||||||
|
@ -309,15 +320,15 @@ void Connection::sendACK(bool wasCausedBySyncTimeout) {
|
||||||
_stats.recordEstimatedBandwidth(estimatedBandwidth);
|
_stats.recordEstimatedBandwidth(estimatedBandwidth);
|
||||||
|
|
||||||
// pack in the receive speed and estimatedBandwidth
|
// pack in the receive speed and estimatedBandwidth
|
||||||
ackPacket->writePrimitive(packetReceiveSpeed);
|
_ackPacket->writePrimitive(packetReceiveSpeed);
|
||||||
ackPacket->writePrimitive(estimatedBandwidth);
|
_ackPacket->writePrimitive(estimatedBandwidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
// record this as the last ACK send time
|
// record this as the last ACK send time
|
||||||
lastACKSendTime = p_high_resolution_clock::now();
|
lastACKSendTime = p_high_resolution_clock::now();
|
||||||
|
|
||||||
// have the socket send off our packet
|
// have the socket send off our packet
|
||||||
_parentSocket->writeBasePacket(*ackPacket, _destination);
|
_parentSocket->writeBasePacket(*_ackPacket, _destination);
|
||||||
|
|
||||||
Q_ASSERT_X(_sentACKs.empty() || _sentACKs.back().first + 1 == _currentACKSubSequenceNumber,
|
Q_ASSERT_X(_sentACKs.empty() || _sentACKs.back().first + 1 == _currentACKSubSequenceNumber,
|
||||||
"Connection::sendACK", "Adding an invalid ACK to _sentACKs");
|
"Connection::sendACK", "Adding an invalid ACK to _sentACKs");
|
||||||
|
@ -339,35 +350,27 @@ void Connection::sendLightACK() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the light ACK packet, make it static so we can re-use it
|
|
||||||
static const int LIGHT_ACK_PACKET_PAYLOAD_BYTES = sizeof(SequenceNumber);
|
|
||||||
static auto lightACKPacket = ControlPacket::create(ControlPacket::LightACK, LIGHT_ACK_PACKET_PAYLOAD_BYTES);
|
|
||||||
|
|
||||||
// reset the lightACKPacket before we go to write the ACK to it
|
// reset the lightACKPacket before we go to write the ACK to it
|
||||||
lightACKPacket->reset();
|
_lightACKPacket->reset();
|
||||||
|
|
||||||
// pack in the ACK
|
// pack in the ACK
|
||||||
lightACKPacket->writePrimitive(nextACKNumber);
|
_lightACKPacket->writePrimitive(nextACKNumber);
|
||||||
|
|
||||||
// have the socket send off our packet immediately
|
// have the socket send off our packet immediately
|
||||||
_parentSocket->writeBasePacket(*lightACKPacket, _destination);
|
_parentSocket->writeBasePacket(*_lightACKPacket, _destination);
|
||||||
|
|
||||||
_stats.record(ConnectionStats::Stats::SentLightACK);
|
_stats.record(ConnectionStats::Stats::SentLightACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::sendACK2(SequenceNumber currentACKSubSequenceNumber) {
|
void Connection::sendACK2(SequenceNumber currentACKSubSequenceNumber) {
|
||||||
// setup a static ACK2 packet we will re-use
|
|
||||||
static const int ACK2_PAYLOAD_BYTES = sizeof(SequenceNumber);
|
|
||||||
static auto ack2Packet = ControlPacket::create(ControlPacket::ACK2, ACK2_PAYLOAD_BYTES);
|
|
||||||
|
|
||||||
// reset the ACK2 Packet before writing the sub-sequence number to it
|
// reset the ACK2 Packet before writing the sub-sequence number to it
|
||||||
ack2Packet->reset();
|
_ack2Packet->reset();
|
||||||
|
|
||||||
// write the sub sequence number for this ACK2
|
// write the sub sequence number for this ACK2
|
||||||
ack2Packet->writePrimitive(currentACKSubSequenceNumber);
|
_ack2Packet->writePrimitive(currentACKSubSequenceNumber);
|
||||||
|
|
||||||
// send the ACK2 packet
|
// send the ACK2 packet
|
||||||
_parentSocket->writeBasePacket(*ack2Packet, _destination);
|
_parentSocket->writeBasePacket(*_ack2Packet, _destination);
|
||||||
|
|
||||||
// update the last sent ACK2 and the last ACK2 send time
|
// update the last sent ACK2 and the last ACK2 send time
|
||||||
_lastSentACK2 = currentACKSubSequenceNumber;
|
_lastSentACK2 = currentACKSubSequenceNumber;
|
||||||
|
@ -376,19 +379,16 @@ void Connection::sendACK2(SequenceNumber currentACKSubSequenceNumber) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::sendNAK(SequenceNumber sequenceNumberRecieved) {
|
void Connection::sendNAK(SequenceNumber sequenceNumberRecieved) {
|
||||||
// create the loss report packet, make it static so we can re-use it
|
_lossReport->reset(); // We need to reset it every time.
|
||||||
static const int NAK_PACKET_PAYLOAD_BYTES = 2 * sizeof(SequenceNumber);
|
|
||||||
static auto lossReport = ControlPacket::create(ControlPacket::NAK, NAK_PACKET_PAYLOAD_BYTES);
|
|
||||||
lossReport->reset(); // We need to reset it every time.
|
|
||||||
|
|
||||||
// pack in the loss report
|
// pack in the loss report
|
||||||
lossReport->writePrimitive(_lastReceivedSequenceNumber + 1);
|
_lossReport->writePrimitive(_lastReceivedSequenceNumber + 1);
|
||||||
if (_lastReceivedSequenceNumber + 1 != sequenceNumberRecieved - 1) {
|
if (_lastReceivedSequenceNumber + 1 != sequenceNumberRecieved - 1) {
|
||||||
lossReport->writePrimitive(sequenceNumberRecieved - 1);
|
_lossReport->writePrimitive(sequenceNumberRecieved - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// have the parent socket send off our packet immediately
|
// have the parent socket send off our packet immediately
|
||||||
_parentSocket->writeBasePacket(*lossReport, _destination);
|
_parentSocket->writeBasePacket(*_lossReport, _destination);
|
||||||
|
|
||||||
// record our last NAK time
|
// record our last NAK time
|
||||||
_lastNAKTime = p_high_resolution_clock::now();
|
_lastNAKTime = p_high_resolution_clock::now();
|
||||||
|
@ -519,7 +519,7 @@ bool Connection::processReceivedSequenceNumber(SequenceNumber sequenceNumber, in
|
||||||
return !wasDuplicate;
|
return !wasDuplicate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::processControl(std::unique_ptr<ControlPacket> controlPacket) {
|
void Connection::processControl(ControlPacketPointer controlPacket) {
|
||||||
|
|
||||||
// Simple dispatch to control packets processing methods based on their type.
|
// Simple dispatch to control packets processing methods based on their type.
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ void Connection::processControl(std::unique_ptr<ControlPacket> controlPacket) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::processACK(std::unique_ptr<ControlPacket> controlPacket) {
|
void Connection::processACK(ControlPacketPointer controlPacket) {
|
||||||
// read the ACK sub-sequence number
|
// read the ACK sub-sequence number
|
||||||
SequenceNumber currentACKSubSequenceNumber;
|
SequenceNumber currentACKSubSequenceNumber;
|
||||||
controlPacket->readPrimitive(¤tACKSubSequenceNumber);
|
controlPacket->readPrimitive(¤tACKSubSequenceNumber);
|
||||||
|
@ -678,7 +678,7 @@ void Connection::processACK(std::unique_ptr<ControlPacket> controlPacket) {
|
||||||
_stats.record(ConnectionStats::Stats::ProcessedACK);
|
_stats.record(ConnectionStats::Stats::ProcessedACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::processLightACK(std::unique_ptr<ControlPacket> controlPacket) {
|
void Connection::processLightACK(ControlPacketPointer controlPacket) {
|
||||||
// read the ACKed sequence number
|
// read the ACKed sequence number
|
||||||
SequenceNumber ack;
|
SequenceNumber ack;
|
||||||
controlPacket->readPrimitive(&ack);
|
controlPacket->readPrimitive(&ack);
|
||||||
|
@ -702,7 +702,7 @@ void Connection::processLightACK(std::unique_ptr<ControlPacket> controlPacket) {
|
||||||
_stats.record(ConnectionStats::Stats::ReceivedLightACK);
|
_stats.record(ConnectionStats::Stats::ReceivedLightACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::processACK2(std::unique_ptr<ControlPacket> controlPacket) {
|
void Connection::processACK2(ControlPacketPointer controlPacket) {
|
||||||
// pull the sub sequence number from the packet
|
// pull the sub sequence number from the packet
|
||||||
SequenceNumber subSequenceNumber;
|
SequenceNumber subSequenceNumber;
|
||||||
controlPacket->readPrimitive(&subSequenceNumber);
|
controlPacket->readPrimitive(&subSequenceNumber);
|
||||||
|
@ -742,7 +742,7 @@ void Connection::processACK2(std::unique_ptr<ControlPacket> controlPacket) {
|
||||||
_stats.record(ConnectionStats::Stats::ReceivedACK2);
|
_stats.record(ConnectionStats::Stats::ReceivedACK2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::processNAK(std::unique_ptr<ControlPacket> controlPacket) {
|
void Connection::processNAK(ControlPacketPointer controlPacket) {
|
||||||
// read the loss report
|
// read the loss report
|
||||||
SequenceNumber start, end;
|
SequenceNumber start, end;
|
||||||
controlPacket->readPrimitive(&start);
|
controlPacket->readPrimitive(&start);
|
||||||
|
@ -764,7 +764,7 @@ void Connection::processNAK(std::unique_ptr<ControlPacket> controlPacket) {
|
||||||
_stats.record(ConnectionStats::Stats::ReceivedNAK);
|
_stats.record(ConnectionStats::Stats::ReceivedNAK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::processHandshake(std::unique_ptr<ControlPacket> controlPacket) {
|
void Connection::processHandshake(ControlPacketPointer controlPacket) {
|
||||||
SequenceNumber initialSequenceNumber;
|
SequenceNumber initialSequenceNumber;
|
||||||
controlPacket->readPrimitive(&initialSequenceNumber);
|
controlPacket->readPrimitive(&initialSequenceNumber);
|
||||||
|
|
||||||
|
@ -782,18 +782,16 @@ void Connection::processHandshake(std::unique_ptr<ControlPacket> controlPacket)
|
||||||
_lastReceivedSequenceNumber = initialSequenceNumber - 1;
|
_lastReceivedSequenceNumber = initialSequenceNumber - 1;
|
||||||
_lastSentACK = initialSequenceNumber - 1;
|
_lastSentACK = initialSequenceNumber - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// immediately respond with a handshake ACK
|
_handshakeACK->reset();
|
||||||
static auto handshakeACK = ControlPacket::create(ControlPacket::HandshakeACK, sizeof(SequenceNumber));
|
_handshakeACK->writePrimitive(initialSequenceNumber);
|
||||||
handshakeACK->seek(0);
|
_parentSocket->writeBasePacket(*_handshakeACK, _destination);
|
||||||
handshakeACK->writePrimitive(initialSequenceNumber);
|
|
||||||
_parentSocket->writeBasePacket(*handshakeACK, _destination);
|
|
||||||
|
|
||||||
// indicate that handshake has been received
|
// indicate that handshake has been received
|
||||||
_hasReceivedHandshake = true;
|
_hasReceivedHandshake = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::processHandshakeACK(std::unique_ptr<ControlPacket> controlPacket) {
|
void Connection::processHandshakeACK(ControlPacketPointer controlPacket) {
|
||||||
// if we've decided to clean up the send queue then this handshake ACK should be ignored, it's useless
|
// if we've decided to clean up the send queue then this handshake ACK should be ignored, it's useless
|
||||||
if (_sendQueue) {
|
if (_sendQueue) {
|
||||||
SequenceNumber initialSequenceNumber;
|
SequenceNumber initialSequenceNumber;
|
||||||
|
@ -807,7 +805,7 @@ void Connection::processHandshakeACK(std::unique_ptr<ControlPacket> controlPacke
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::processTimeoutNAK(std::unique_ptr<ControlPacket> controlPacket) {
|
void Connection::processTimeoutNAK(ControlPacketPointer controlPacket) {
|
||||||
// Override SendQueue's LossList with the timeout NAK list
|
// Override SendQueue's LossList with the timeout NAK list
|
||||||
getSendQueue().overrideNAKListFromPacket(*controlPacket);
|
getSendQueue().overrideNAKListFromPacket(*controlPacket);
|
||||||
|
|
||||||
|
@ -817,7 +815,7 @@ void Connection::processTimeoutNAK(std::unique_ptr<ControlPacket> controlPacket)
|
||||||
_stats.record(ConnectionStats::Stats::ReceivedTimeoutNAK);
|
_stats.record(ConnectionStats::Stats::ReceivedTimeoutNAK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::processProbeTail(std::unique_ptr<ControlPacket> controlPacket) {
|
void Connection::processProbeTail(ControlPacketPointer controlPacket) {
|
||||||
if (((uint32_t) _lastReceivedSequenceNumber & 0xF) == 0) {
|
if (((uint32_t) _lastReceivedSequenceNumber & 0xF) == 0) {
|
||||||
// this is the second packet in a probe set so we can estimate bandwidth
|
// this is the second packet in a probe set so we can estimate bandwidth
|
||||||
// the sender sent this to us in lieu of sending new data (because they didn't have any)
|
// the sender sent this to us in lieu of sending new data (because they didn't have any)
|
||||||
|
|
|
@ -55,6 +55,7 @@ public:
|
||||||
using SequenceNumberTimePair = std::pair<SequenceNumber, p_high_resolution_clock::time_point>;
|
using SequenceNumberTimePair = std::pair<SequenceNumber, p_high_resolution_clock::time_point>;
|
||||||
using ACKListPair = std::pair<SequenceNumber, SequenceNumberTimePair>;
|
using ACKListPair = std::pair<SequenceNumber, SequenceNumberTimePair>;
|
||||||
using SentACKList = std::list<ACKListPair>;
|
using SentACKList = std::list<ACKListPair>;
|
||||||
|
using ControlPacketPointer = std::unique_ptr<ControlPacket>;
|
||||||
|
|
||||||
Connection(Socket* parentSocket, HifiSockAddr destination, std::unique_ptr<CongestionControl> congestionControl);
|
Connection(Socket* parentSocket, HifiSockAddr destination, std::unique_ptr<CongestionControl> congestionControl);
|
||||||
~Connection();
|
~Connection();
|
||||||
|
@ -66,7 +67,7 @@ public:
|
||||||
|
|
||||||
// return indicates if this packet should be processed
|
// return indicates if this packet should be processed
|
||||||
bool processReceivedSequenceNumber(SequenceNumber sequenceNumber, int packetSize, int payloadSize);
|
bool processReceivedSequenceNumber(SequenceNumber sequenceNumber, int packetSize, int payloadSize);
|
||||||
void processControl(std::unique_ptr<ControlPacket> controlPacket);
|
void processControl(ControlPacketPointer controlPacket);
|
||||||
|
|
||||||
void queueReceivedMessagePacket(std::unique_ptr<Packet> packet);
|
void queueReceivedMessagePacket(std::unique_ptr<Packet> packet);
|
||||||
|
|
||||||
|
@ -96,14 +97,14 @@ private:
|
||||||
void sendNAK(SequenceNumber sequenceNumberRecieved);
|
void sendNAK(SequenceNumber sequenceNumberRecieved);
|
||||||
void sendTimeoutNAK();
|
void sendTimeoutNAK();
|
||||||
|
|
||||||
void processACK(std::unique_ptr<ControlPacket> controlPacket);
|
void processACK(ControlPacketPointer controlPacket);
|
||||||
void processLightACK(std::unique_ptr<ControlPacket> controlPacket);
|
void processLightACK(ControlPacketPointer controlPacket);
|
||||||
void processACK2(std::unique_ptr<ControlPacket> controlPacket);
|
void processACK2(ControlPacketPointer controlPacket);
|
||||||
void processNAK(std::unique_ptr<ControlPacket> controlPacket);
|
void processNAK(ControlPacketPointer controlPacket);
|
||||||
void processTimeoutNAK(std::unique_ptr<ControlPacket> controlPacket);
|
void processTimeoutNAK(ControlPacketPointer controlPacket);
|
||||||
void processHandshake(std::unique_ptr<ControlPacket> controlPacket);
|
void processHandshake(ControlPacketPointer controlPacket);
|
||||||
void processHandshakeACK(std::unique_ptr<ControlPacket> controlPacket);
|
void processHandshakeACK(ControlPacketPointer controlPacket);
|
||||||
void processProbeTail(std::unique_ptr<ControlPacket> controlPacket);
|
void processProbeTail(ControlPacketPointer controlPacket);
|
||||||
|
|
||||||
void resetReceiveState();
|
void resetReceiveState();
|
||||||
void resetRTT();
|
void resetRTT();
|
||||||
|
@ -171,7 +172,14 @@ private:
|
||||||
std::map<MessageNumber, PendingReceivedMessage> _pendingReceivedMessages;
|
std::map<MessageNumber, PendingReceivedMessage> _pendingReceivedMessages;
|
||||||
|
|
||||||
int _packetsSinceACK { 0 }; // The number of packets that have been received during the current ACK interval
|
int _packetsSinceACK { 0 }; // The number of packets that have been received during the current ACK interval
|
||||||
|
|
||||||
|
// Re-used control packets
|
||||||
|
ControlPacketPointer _ackPacket;
|
||||||
|
ControlPacketPointer _lightACKPacket;
|
||||||
|
ControlPacketPointer _ack2Packet;
|
||||||
|
ControlPacketPointer _lossReport;
|
||||||
|
ControlPacketPointer _handshakeACK;
|
||||||
|
|
||||||
ConnectionStats _stats;
|
ConnectionStats _stats;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,8 @@
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
#include <windows.h>
|
||||||
#include "CPUIdent.h"
|
#include "CPUIdent.h"
|
||||||
#include <Psapi.h>
|
#include <Psapi.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -877,3 +874,143 @@ bool getMemoryInfo(MemoryInfo& info) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Largely taken from: https://msdn.microsoft.com/en-us/library/windows/desktop/ms683194(v=vs.85).aspx
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
using LPFN_GLPI = BOOL(WINAPI*)(
|
||||||
|
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION,
|
||||||
|
PDWORD);
|
||||||
|
|
||||||
|
DWORD CountSetBits(ULONG_PTR bitMask)
|
||||||
|
{
|
||||||
|
DWORD LSHIFT = sizeof(ULONG_PTR) * 8 - 1;
|
||||||
|
DWORD bitSetCount = 0;
|
||||||
|
ULONG_PTR bitTest = (ULONG_PTR)1 << LSHIFT;
|
||||||
|
DWORD i;
|
||||||
|
|
||||||
|
for (i = 0; i <= LSHIFT; ++i) {
|
||||||
|
bitSetCount += ((bitMask & bitTest) ? 1 : 0);
|
||||||
|
bitTest /= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bitSetCount;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool getProcessorInfo(ProcessorInfo& info) {
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
LPFN_GLPI glpi;
|
||||||
|
bool done = false;
|
||||||
|
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION buffer = NULL;
|
||||||
|
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION ptr = NULL;
|
||||||
|
DWORD returnLength = 0;
|
||||||
|
DWORD logicalProcessorCount = 0;
|
||||||
|
DWORD numaNodeCount = 0;
|
||||||
|
DWORD processorCoreCount = 0;
|
||||||
|
DWORD processorL1CacheCount = 0;
|
||||||
|
DWORD processorL2CacheCount = 0;
|
||||||
|
DWORD processorL3CacheCount = 0;
|
||||||
|
DWORD processorPackageCount = 0;
|
||||||
|
DWORD byteOffset = 0;
|
||||||
|
PCACHE_DESCRIPTOR Cache;
|
||||||
|
|
||||||
|
glpi = (LPFN_GLPI)GetProcAddress(
|
||||||
|
GetModuleHandle(TEXT("kernel32")),
|
||||||
|
"GetLogicalProcessorInformation");
|
||||||
|
if (nullptr == glpi) {
|
||||||
|
qDebug() << "GetLogicalProcessorInformation is not supported.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!done) {
|
||||||
|
DWORD rc = glpi(buffer, &returnLength);
|
||||||
|
|
||||||
|
if (FALSE == rc) {
|
||||||
|
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
|
||||||
|
if (buffer) {
|
||||||
|
free(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer = (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION)malloc(
|
||||||
|
returnLength);
|
||||||
|
|
||||||
|
if (NULL == buffer) {
|
||||||
|
qDebug() << "Error: Allocation failure";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
qDebug() << "Error " << GetLastError();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ptr = buffer;
|
||||||
|
|
||||||
|
while (byteOffset + sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION) <= returnLength) {
|
||||||
|
switch (ptr->Relationship) {
|
||||||
|
case RelationNumaNode:
|
||||||
|
// Non-NUMA systems report a single record of this type.
|
||||||
|
numaNodeCount++;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RelationProcessorCore:
|
||||||
|
processorCoreCount++;
|
||||||
|
|
||||||
|
// A hyperthreaded core supplies more than one logical processor.
|
||||||
|
logicalProcessorCount += CountSetBits(ptr->ProcessorMask);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RelationCache:
|
||||||
|
// Cache data is in ptr->Cache, one CACHE_DESCRIPTOR structure for each cache.
|
||||||
|
Cache = &ptr->Cache;
|
||||||
|
if (Cache->Level == 1) {
|
||||||
|
processorL1CacheCount++;
|
||||||
|
} else if (Cache->Level == 2) {
|
||||||
|
processorL2CacheCount++;
|
||||||
|
} else if (Cache->Level == 3) {
|
||||||
|
processorL3CacheCount++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RelationProcessorPackage:
|
||||||
|
// Logical processors share a physical package.
|
||||||
|
processorPackageCount++;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
qDebug() << "\nError: Unsupported LOGICAL_PROCESSOR_RELATIONSHIP value.\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
byteOffset += sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION);
|
||||||
|
ptr++;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << "GetLogicalProcessorInformation results:";
|
||||||
|
qDebug() << "Number of NUMA nodes:" << numaNodeCount;
|
||||||
|
qDebug() << "Number of physical processor packages:" << processorPackageCount;
|
||||||
|
qDebug() << "Number of processor cores:" << processorCoreCount;
|
||||||
|
qDebug() << "Number of logical processors:" << logicalProcessorCount;
|
||||||
|
qDebug() << "Number of processor L1/L2/L3 caches:"
|
||||||
|
<< processorL1CacheCount
|
||||||
|
<< "/" << processorL2CacheCount
|
||||||
|
<< "/" << processorL3CacheCount;
|
||||||
|
|
||||||
|
info.numPhysicalProcessorPackages = processorPackageCount;
|
||||||
|
info.numProcessorCores = processorCoreCount;
|
||||||
|
info.numLogicalProcessors = logicalProcessorCount;
|
||||||
|
info.numProcessorCachesL1 = processorL1CacheCount;
|
||||||
|
info.numProcessorCachesL2 = processorL2CacheCount;
|
||||||
|
info.numProcessorCachesL3 = processorL3CacheCount;
|
||||||
|
|
||||||
|
free(buffer);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -214,4 +214,15 @@ struct MemoryInfo {
|
||||||
|
|
||||||
bool getMemoryInfo(MemoryInfo& info);
|
bool getMemoryInfo(MemoryInfo& info);
|
||||||
|
|
||||||
|
struct ProcessorInfo {
|
||||||
|
int32_t numPhysicalProcessorPackages;
|
||||||
|
int32_t numProcessorCores;
|
||||||
|
int32_t numLogicalProcessors;
|
||||||
|
int32_t numProcessorCachesL1;
|
||||||
|
int32_t numProcessorCachesL2;
|
||||||
|
int32_t numProcessorCachesL3;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool getProcessorInfo(ProcessorInfo& info);
|
||||||
|
|
||||||
#endif // hifi_SharedUtil_h
|
#endif // hifi_SharedUtil_h
|
||||||
|
|
Loading…
Reference in a new issue