Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1774)

Unified Diff: webrtc/modules/audio_device/win/audio_device_core_win.cc

Issue 2727273002: Fix memory leaks in Windows core audio (Closed)
Patch Set: Replace WEBRTC_TRACE with LOG macro Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_device/win/audio_device_core_win.cc
diff --git a/webrtc/modules/audio_device/win/audio_device_core_win.cc b/webrtc/modules/audio_device/win/audio_device_core_win.cc
index 111457b9dd00343269c82b2e6d394d0cb1e49207..8b38b94f6227872bfa98e3fa5a9925ea83a7ee0a 100644
--- a/webrtc/modules/audio_device/win/audio_device_core_win.cc
+++ b/webrtc/modules/audio_device/win/audio_device_core_win.cc
@@ -878,6 +878,7 @@ int32_t AudioDeviceWindowsCore::InitMicrophone()
return -1;
}
+ SAFE_RELEASE(_ptrCaptureVolume);
ret = _ptrDeviceIn->Activate(__uuidof(IAudioEndpointVolume),
CLSCTX_ALL,
NULL,
@@ -2258,8 +2259,22 @@ int32_t AudioDeviceWindowsCore::InitPlayout()
}
else
{
- WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "nChannels=%d, nSamplesPerSec=%d is not supported",
- Wfx.nChannels, Wfx.nSamplesPerSec);
+ if (pWfxClosestMatch)
+ {
+ LOG(INFO) << "nChannels=" << Wfx.nChannels <<
+ ", nSamplesPerSec=" << Wfx.nSamplesPerSec <<
+ " is not supported. Closest match: " <<
+ "nChannels=" << pWfxClosestMatch->nChannels <<
+ ", nSamplesPerSec=" << pWfxClosestMatch->nSamplesPerSec;
+ CoTaskMemFree(pWfxClosestMatch);
+ pWfxClosestMatch = NULL;
+ }
+ else
+ {
+ LOG(INFO) << "nChannels=" << Wfx.nChannels <<
+ ", nSamplesPerSec=" << Wfx.nSamplesPerSec <<
+ " is not supported. No closest match.";
+ }
}
}
if (hr == S_OK)
@@ -2330,15 +2345,6 @@ int32_t AudioDeviceWindowsCore::InitPlayout()
if (FAILED(hr))
{
WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, "IAudioClient::Initialize() failed:");
- if (pWfxClosestMatch != NULL)
- {
- WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, "closest mix format: #channels=%d, samples/sec=%d, bits/sample=%d",
- pWfxClosestMatch->nChannels, pWfxClosestMatch->nSamplesPerSec, pWfxClosestMatch->wBitsPerSample);
- }
- else
- {
- WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, "no format suggested");
- }
}
EXIT_ON_ERROR(hr);
@@ -2600,8 +2606,22 @@ int32_t AudioDeviceWindowsCore::InitRecording()
}
else
{
- WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "nChannels=%d, nSamplesPerSec=%d is not supported",
- Wfx.Format.nChannels, Wfx.Format.nSamplesPerSec);
+ if (pWfxClosestMatch)
+ {
+ LOG(INFO) << "nChannels=" << Wfx.Format.nChannels <<
+ ", nSamplesPerSec=" << Wfx.Format.nSamplesPerSec <<
+ " is not supported. Closest match: " <<
+ "nChannels=" << pWfxClosestMatch->nChannels <<
+ ", nSamplesPerSec=" << pWfxClosestMatch->nSamplesPerSec;
+ CoTaskMemFree(pWfxClosestMatch);
+ pWfxClosestMatch = NULL;
+ }
+ else
+ {
+ LOG(INFO) << "nChannels=" << Wfx.Format.nChannels <<
+ ", nSamplesPerSec=" << Wfx.Format.nSamplesPerSec <<
+ " is not supported. No closest match.";
+ }
}
}
if (hr == S_OK)
@@ -2644,15 +2664,6 @@ int32_t AudioDeviceWindowsCore::InitRecording()
if (hr != S_OK)
{
WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, "IAudioClient::Initialize() failed:");
- if (pWfxClosestMatch != NULL)
- {
- WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, "closest mix format: #channels=%d, samples/sec=%d, bits/sample=%d",
- pWfxClosestMatch->nChannels, pWfxClosestMatch->nSamplesPerSec, pWfxClosestMatch->wBitsPerSample);
- }
- else
- {
- WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, "no format suggested");
- }
}
EXIT_ON_ERROR(hr);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698