Commit 146a8b2b authored by Ghislain MARY's avatar Ghislain MARY

Fix setting DSCP on Windows.

parent 56a8d75f
......@@ -99,6 +99,9 @@ if(ENABLE_SHARED)
# Do not version shared library on Android
set_target_properties(ortp PROPERTIES SOVERSION ${ORTP_SO_VERSION})
endif()
if(WIN32)
target_compile_options(ortp PRIVATE "/DELAYLOAD:Qwave.dll")
endif()
target_compile_definitions(ortp PRIVATE "ORTP_EXPORTS")
target_link_libraries(ortp ${LIBS})
if(MSVC)
......
......@@ -1546,24 +1546,17 @@ void rtp_session_uninit (RtpSession * session)
ortp_message("check OS support for qwave.lib: %i %i %i\n",
ovi.dwMajorVersion, ovi.dwMinorVersion, ovi.dwBuildNumber);
if (ovi.dwMajorVersion > 5) {
if (FAILED(__HrLoadAllImportsForDll("qwave.dll"))) {
ortp_warning("Failed to load qwave.dll: no QoS available\n" );
}
else
{
BOOL QoSResult;
QoSResult = QOSRemoveSocketFromFlow(session->rtp.QoSHandle,
0,
session->rtp.QoSFlowID,
0);
if (QoSResult != TRUE){
ortp_error("QOSRemoveSocketFromFlow failed to end a flow with error %d\n",
GetLastError());
}
session->rtp.QoSFlowID=0;
BOOL QoSResult;
QoSResult = QOSRemoveSocketFromFlow(session->rtp.QoSHandle,
0,
session->rtp.QoSFlowID,
0);
if (QoSResult != TRUE){
ortp_error("QOSRemoveSocketFromFlow failed to end a flow with error %d\n",
GetLastError());
}
session->rtp.QoSFlowID=0;
}
}
......
......@@ -660,53 +660,46 @@ int rtp_session_set_dscp(RtpSession *session, int dscp){
ortp_message("check OS support for qwave.lib: %i %i %i\n",
ovi.dwMajorVersion, ovi.dwMinorVersion, ovi.dwBuildNumber);
if (ovi.dwMajorVersion > 5) {
if (FAILED(__HrLoadAllImportsForDll("qwave.dll"))) {
ortp_warning("Failed to load qwave.dll: no QoS available\n" );
}
if (session->dscp==0)
tos=QOSTrafficTypeBestEffort;
else if (session->dscp==0x8)
tos=QOSTrafficTypeBackground;
else if (session->dscp==0x28)
tos=QOSTrafficTypeAudioVideo;
else if (session->dscp==0x38)
tos=QOSTrafficTypeVoice;
else
{
if (session->dscp==0)
tos=QOSTrafficTypeBestEffort;
else if (session->dscp==0x8)
tos=QOSTrafficTypeBackground;
else if (session->dscp==0x28)
tos=QOSTrafficTypeAudioVideo;
else if (session->dscp==0x38)
tos=QOSTrafficTypeVoice;
else
tos=QOSTrafficTypeExcellentEffort; /* 0x28 */
if (session->rtp.QoSHandle==NULL) {
QOS_VERSION version;
BOOL QoSResult;
version.MajorVersion = 1;
version.MinorVersion = 0;
QoSResult = QOSCreateHandle(&version, &session->rtp.QoSHandle);
if (QoSResult != TRUE){
ortp_error("QOSCreateHandle failed to create handle with error %d\n",
GetLastError());
retval=-1;
}
tos=QOSTrafficTypeExcellentEffort; /* 0x28 */
if (session->rtp.QoSHandle==NULL) {
QOS_VERSION version;
BOOL QoSResult;
version.MajorVersion = 1;
version.MinorVersion = 0;
QoSResult = QOSCreateHandle(&version, &session->rtp.QoSHandle);
if (QoSResult != TRUE){
ortp_error("QOSCreateHandle failed to create handle with error %d\n",
GetLastError());
retval=-1;
}
if (session->rtp.QoSHandle!=NULL) {
BOOL QoSResult;
QoSResult = QOSAddSocketToFlow(
session->rtp.QoSHandle,
session->rtp.gs.socket,
(struct sockaddr*)&session->rtp.gs.rem_addr,
tos,
QOS_NON_ADAPTIVE_FLOW,
&session->rtp.QoSFlowID);
if (QoSResult != TRUE){
ortp_error("QOSAddSocketToFlow failed to add a flow with error %d\n",
GetLastError());
retval=-1;
}
}
if (session->rtp.QoSHandle!=NULL) {
BOOL QoSResult;
QoSResult = QOSAddSocketToFlow(
session->rtp.QoSHandle,
session->rtp.gs.socket,
(struct sockaddr*)&session->rtp.gs.rem_addr,
tos,
QOS_NON_ADAPTIVE_FLOW,
&session->rtp.QoSFlowID);
if (QoSResult != TRUE){
ortp_error("QOSAddSocketToFlow failed to add a flow with error %d\n",
GetLastError());
retval=-1;
}
}
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment