Commit ee286147 authored by Ghislain MARY's avatar Ghislain MARY

Restore echo calibration code.

parent 4a51078b
......@@ -83,6 +83,7 @@ target_compile_options(linphone_native PRIVATE "/doc")
set_target_properties(linphone_native PROPERTIES LIBRARY_OUTPUT_NAME "BelledonneCommunications.Linphone.Native")
set_target_properties(linphone_native PROPERTIES LINK_FLAGS "/WINMDFILE:BelledonneCommunications.Linphone.Native.winmd")
set_target_properties(linphone_native PROPERTIES VS_WINRT_COMPONENT TRUE)
set_target_properties(linphone_native PROPERTIES VS_MOBILE_EXTENSIONS_VERSION ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}) # Include mobile extensions
target_link_libraries(linphone_native ${LIBS})
install(TARGETS linphone_native
......
......@@ -42,6 +42,7 @@ using namespace Platform::Collections;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::ApplicationModel::Calls;
using namespace Windows::Phone::Media::Devices;
......@@ -1288,8 +1289,7 @@ void Core::UploadLogCollection()
linphone_core_upload_log_collection(this->lc);
}
#if 0
static void EchoCalibrationCallback(LinphoneCore *lc, LinphoneEcCalibratorStatus status, int delay_ms, void *data)
static void EchoCalibrationCallback(::LinphoneCore *lc, LinphoneEcCalibratorStatus status, int delay_ms, void *data)
{
Utils::EchoCalibrationCallback(lc, status, delay_ms, data);
}
......@@ -1300,12 +1300,11 @@ static void EchoCalibrationAudioInit(void *data)
if (ecData != nullptr) {
ecData->endpoint = AudioRoutingManager::GetDefault()->GetAudioEndpoint();
// Need to create a dummy VoipPhoneCall to be able to capture audio!
VoipCallCoordinator::GetDefault()->RequestNewOutgoingCall(
ecData->call = VoipCallCoordinator::GetDefault()->RequestNewOutgoingCall(
"ECCalibrator",
"ECCalibrator",
"ECCalibrator",
VoipCallMedia::Audio,
&ecData->call);
VoipPhoneCallMedia::Audio);
ecData->call->NotifyCallActive();
}
AudioRoutingManager::GetDefault()->SetAudioEndpoint(AudioRoutingEndpoint::Speakerphone);
......@@ -1323,16 +1322,11 @@ static void EchoCalibrationAudioUninit(void *data)
void Core::StartEchoCalibration()
{
API_LOCK;
EchoCalibrationData *data = new EchoCalibrationData();
linphone_core_start_echo_calibration(this->lc, EchoCalibrationCallback, EchoCalibrationAudioInit, EchoCalibrationAudioUninit, data);
}
int Core::NativeVideoWindowId::get()
{
API_LOCK;
return Globals::Instance->VideoRenderer->GetNativeWindowId();
if (Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent("Windows.Phone.PhoneContract", 1)) {
EchoCalibrationData *data = new EchoCalibrationData();
linphone_core_start_echo_calibration(this->lc, EchoCalibrationCallback, EchoCalibrationAudioInit, EchoCalibrationAudioUninit, data);
}
}
#endif
void global_state_changed(::LinphoneCore *lc, ::LinphoneGlobalState gstate, const char *msg)
{
......
......@@ -1054,13 +1054,11 @@ namespace BelledonneCommunications
/// </summary>
void UploadLogCollection();
#if 0
/// <summary>
/// Starts an echo calibration of the sound devices, in order to find adequate settings for the echo canceller automatically.
/// Status is notified to CoreListener::EcCalibrationStatus.
/// </summary>
void StartEchoCalibration();
#endif
private:
friend ref class Address;
......
......@@ -73,6 +73,13 @@ namespace BelledonneCommunications
/// <param name="dtmf">The DTMF that has been received</param>
void DtmfReceived(Call^ call, char16 dtmf);
/// <summary>
/// Callback method called when the echo canceller calibration finishes.
/// </summary>
/// <param name="status">The status of the echo canceller calibration</param>
/// <param name="delayMs">The echo delay in milliseconds if the status is EcCalibratorStatus::Done</param>
void EcCalibrationStatus(EcCalibratorStatus status, int delayMs);
/// <summary>
/// Callback method called when the application state has changed.
/// </summary>
......
......@@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "CallStats.h"
#include "ChatMessage.h"
#include "ChatRoom.h"
#include "Core.h"
#include "LpConfig.h"
#include "PayloadType.h"
#include "ProxyConfig.h"
......@@ -249,7 +250,6 @@ void Utils::SetLogLevel(int loglevel)
linphone_core_set_log_level(static_cast<OrtpLogLevel>(loglevel));
}
#if 0
void Utils::EchoCalibrationCallback(void *lc, int status, int delay_ms, void *data)
{
API_LOCK;
......@@ -257,9 +257,10 @@ void Utils::EchoCalibrationCallback(void *lc, int status, int delay_ms, void *da
if (ecData != nullptr) {
delete ecData;
}
RefToPtrProxy<LinphoneCore^> *proxy = reinterpret_cast< RefToPtrProxy<LinphoneCore^> *>(linphone_core_get_user_data(static_cast<::LinphoneCore *>(lc)));
LinphoneCore^ lCore = (proxy) ? proxy->Ref() : nullptr;
RefToPtrProxy<Core^> *proxy = reinterpret_cast< RefToPtrProxy<Core^> *>(linphone_core_get_user_data(static_cast<::LinphoneCore *>(lc)));
Core^ lCore = (proxy) ? proxy->Ref() : nullptr;
EcCalibratorStatus ecStatus = (EcCalibratorStatus) status;
lCore->listener->EcCalibrationStatus(ecStatus, delay_ms);
if (lCore) {
lCore->listener->EcCalibrationStatus(ecStatus, delay_ms);
}
}
#endif
......@@ -166,7 +166,6 @@ namespace BelledonneCommunications
/// <param name="loglevel">A bitmask of the log levels to set.</param>
static void SetLogLevel(int loglevel);
#if 0
/// <summary>
/// A callback called when the echo canceller calibration finishes.
/// </summary>
......@@ -175,19 +174,16 @@ namespace BelledonneCommunications
/// <param name="delay_ms">The echo delay if the status is "done", 0 otherwise</param>
/// <param name="data">Some user data given when starting the echo canceller calibration process</param>
static void EchoCalibrationCallback(void *lc, int status, int delay_ms, void *data);
#endif
private:
static std::wstring UTF8ToUTF16(const char *utf8);
static std::string UTF16ToUTF8(const wchar_t *utf16);
};
#if 0
struct EchoCalibrationData {
Windows::Phone::Media::Devices::AudioRoutingEndpoint endpoint;
Windows::Phone::Networking::Voip::VoipPhoneCall^ call;
Windows::ApplicationModel::Calls::VoipPhoneCall^ call;
};
#endif
template <class T>
class RefToPtrProxy
......
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