Commit 566a0986 authored by Julien Wadel's avatar Julien Wadel
Browse files

Add a memory report for wasapi in case of an out of memory error.

parent 922dca44
......@@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <mediastreamer2/mscommon.h>
#include <mediastreamer2/msfilter.h>
#include <mediastreamer2/mssndcard.h>
#include <bctoolbox/utils.hh>
#include <vector>
#include <objbase.h>
......@@ -49,10 +50,11 @@ using namespace Windows::Devices::Enumeration;
using namespace Windows::Media::Devices;
#endif
#define REPORT_ERROR(msg, result) \
if (result != S_OK) { \
ms_error(msg, result); \
if( result == E_OUTOFMEMORY) \
ms_error(("mswasapi: " + bctoolbox::Utils::getMemoryReportAsString()).c_str()); \
goto error; \
}
#define SAFE_RELEASE(obj) \
......
......@@ -28,11 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define REFTIME_250MS 2500000
#define REPORT_ERROR(msg, result) \
if (result != S_OK) { \
ms_error(msg, result); \
goto error; \
}
#define RELEASE_CLIENT(client) \
if (client != NULL) { \
client->Release(); \
......@@ -199,6 +194,7 @@ int MSWASAPIReader::activate()
} else {
REPORT_ERROR("Audio format not supported by the MSWASAPI audio input interface [%x]", result);
}
result = mAudioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, flags, requestedDuration, 0, pUsedWfx, NULL);
if ((result != S_OK) && (result != AUDCLNT_E_ALREADY_INITIALIZED)) {
mAudioClient->Reset();
......
......@@ -27,11 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mswasapi_writer.h"
#define REPORT_ERROR(msg, result) \
if (result != S_OK) { \
ms_error(msg, result); \
goto error; \
}
#define RELEASE_CLIENT(client) \
if (client != NULL) { \
client->Release(); \
......
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