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

Fix setting DSCP on Windows.

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