diff --git a/modules/audio_device/win/audio_device_core_win.cc b/modules/audio_device/win/audio_device_core_win.cc index 0d5ceff000..f95e1f08d2 100644 --- a/modules/audio_device/win/audio_device_core_win.cc +++ b/modules/audio_device/win/audio_device_core_win.cc @@ -4177,25 +4177,7 @@ void AudioDeviceWindowsCore::_TraceCOMError(HRESULT hr) const { RTC_LOG(LS_ERROR) << "Core Audio method failed (hr=" << hr << ")"; StringCchPrintfW(buf, MAXERRORLENGTH, L"Error details: "); StringCchCatW(buf, MAXERRORLENGTH, errorText); - RTC_LOG(LS_ERROR) << WideToUTF8(buf); -} - -// ---------------------------------------------------------------------------- -// WideToUTF8 -// ---------------------------------------------------------------------------- - -char* AudioDeviceWindowsCore::WideToUTF8(const wchar_t* src) const { - const size_t kStrLen = sizeof(_str); - memset(_str, 0, kStrLen); - // Get required size (in bytes) to be able to complete the conversion. - unsigned int required_size = - (unsigned int)WideCharToMultiByte(CP_UTF8, 0, src, -1, _str, 0, 0, 0); - if (required_size <= kStrLen) { - // Process the entire input string, including the terminating null char. - if (WideCharToMultiByte(CP_UTF8, 0, src, -1, _str, kStrLen, 0, 0) == 0) - memset(_str, 0, kStrLen); - } - return _str; + RTC_LOG(LS_ERROR) << rtc::ToUtf8(buf); } bool AudioDeviceWindowsCore::KeyPressed() const { diff --git a/modules/audio_device/win/audio_device_core_win.h b/modules/audio_device/win/audio_device_core_win.h index 6ae5988db4..81db3d8bc4 100644 --- a/modules/audio_device/win/audio_device_core_win.h +++ b/modules/audio_device/win/audio_device_core_win.h @@ -233,10 +233,6 @@ class AudioDeviceWindowsCore : public AudioDeviceGeneric { int32_t _GetDefaultDevice(EDataFlow dir, ERole role, IMMDevice** ppDevice); int32_t _GetListDevice(EDataFlow dir, int index, IMMDevice** ppDevice); - // Converts from wide-char to UTF-8 if UNICODE is defined. - // Does nothing if UNICODE is undefined. - char* WideToUTF8(const wchar_t* src) const; - int32_t InitRecordingDMO(); ScopedCOMInitializer _comInit; @@ -310,8 +306,6 @@ class AudioDeviceWindowsCore : public AudioDeviceGeneric { AudioDeviceModule::WindowsDeviceType _outputDevice; uint16_t _inputDeviceIndex; uint16_t _outputDeviceIndex; - - mutable char _str[512]; }; #endif // #if (_MSC_VER >= 1400)