From 356855c3f69d3e41c322e20961573cad3246bc10 Mon Sep 17 00:00:00 2001 From: beveloper Date: Sun, 29 Jun 2003 01:17:52 +0000 Subject: [PATCH] ugly workaround, create a new pool for each input mix buffer, to avoid running out of default pool memory. It would be much better if a pool would grow if more memory is requested than available. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3729 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/media/media-add-ons/mixer/MixerInput.cpp | 9 ++++++++- src/add-ons/media/media-add-ons/mixer/MixerInput.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/add-ons/media/media-add-ons/mixer/MixerInput.cpp b/src/add-ons/media/media-add-ons/mixer/MixerInput.cpp index 142f5e5a60..2c736917f7 100644 --- a/src/add-ons/media/media-add-ons/mixer/MixerInput.cpp +++ b/src/add-ons/media/media-add-ons/mixer/MixerInput.cpp @@ -25,6 +25,7 @@ MixerInput::MixerInput(MixerCore *core, const media_input &input, float mixFrame fMixBufferFrameRate(0), fMixBufferFrameCount(0), fResampler(0), + fRtmPool(0), fUserOverridesChannelDesignations(false) { fix_multiaudio_format(&fInput.format.u.raw_audio); @@ -76,6 +77,8 @@ MixerInput::~MixerInput() { if (fMixBuffer) rtm_free(fMixBuffer); + if (fRtmPool) + rtm_delete_pool(fRtmPool); delete [] fInputChannelInfo; delete [] fMixerChannelInfo; @@ -456,8 +459,12 @@ MixerInput::SetMixBufferFormat(int32 framerate, int32 frames) if (fMixBuffer) rtm_free(fMixBuffer); + if (fRtmPool) + rtm_delete_pool(fRtmPool); int size = sizeof(float) * fInputChannelCount * fMixBufferFrameCount; - fMixBuffer = (float *)rtm_alloc(NULL, size); + if (B_OK != rtm_create_pool(&fRtmPool, size)) + fRtmPool = 0; + fMixBuffer = (float *)rtm_alloc(fRtmPool, size); ASSERT(fMixBuffer); memset(fMixBuffer, 0, size); diff --git a/src/add-ons/media/media-add-ons/mixer/MixerInput.h b/src/add-ons/media/media-add-ons/mixer/MixerInput.h index bcc5302d3c..67bb438369 100644 --- a/src/add-ons/media/media-add-ons/mixer/MixerInput.h +++ b/src/add-ons/media/media-add-ons/mixer/MixerInput.h @@ -67,6 +67,7 @@ private: uint32 fMixBufferFrameCount; Resampler **fResampler; // array + rtm_pool *fRtmPool; bool fUserOverridesChannelDesignations;