Browse Source

Carla: Fix rtmempool

tags/v0.9.0
falkTX 13 years ago
parent
commit
1dcb38b4f1
5 changed files with 14 additions and 35 deletions
  1. +1
    -5
      c++/carla-backend/lv2.cpp
  2. +10
    -15
      c++/carla-backend/rtmempool/rtmempool.c
  3. +0
    -4
      c++/carla-backend/rtmempool/rtmempool.h
  4. +2
    -10
      c++/carla-includes/lv2/lv2_rtmempool.h
  5. +1
    -1
      src/jacksettings.py

+ 1
- 5
c++/carla-backend/lv2.cpp View File

@@ -404,11 +404,7 @@ public:
delete (LV2_Programs_Host*)features[lv2_feature_id_programs]->data;

if (features[lv2_feature_id_rtmempool] && features[lv2_feature_id_rtmempool]->data)
{
const LV2_RtMemPool_Pool* const rtmempool = (const LV2_RtMemPool_Pool*)features[lv2_feature_id_rtmempool]->data;
rtmempool_allocator_free(rtmempool);
delete rtmempool;
}
delete (LV2_RtMemPool_Pool*)features[lv2_feature_id_rtmempool]->data;

if (features[lv2_feature_id_state_make_path] && features[lv2_feature_id_state_make_path]->data)
delete (LV2_State_Make_Path*)features[lv2_feature_id_state_make_path]->data;


+ 10
- 15
c++/carla-backend/rtmempool/rtmempool.c View File

@@ -59,12 +59,13 @@ struct rtsafe_memory_pool

static
void
rtsafe_memory_pool_sleepy();
rtsafe_memory_pool_sleepy(
LV2_RtMemPool_Handle pool_handle);

static
bool
rtsafe_memory_pool_create(
LV2_RtMemPool_Handle pool_handle,
LV2_RtMemPool_Handle * pool_handle_ptr,
const char * pool_name,
size_t data_size,
size_t min_preallocated,
@@ -86,7 +87,7 @@ rtsafe_memory_pool_create(
(unsigned int)max_preallocated,
enforce_thread_safety ? "true" : "false");

pool_ptr = (struct rtsafe_memory_pool *)pool_handle;
pool_ptr = malloc(sizeof(struct rtsafe_memory_pool));
if (pool_ptr == NULL)
{
return false;
@@ -127,7 +128,8 @@ rtsafe_memory_pool_create(

pool_ptr->used_size = 0;

rtsafe_memory_pool_sleepy();
rtsafe_memory_pool_sleepy((LV2_RtMemPool_Handle)pool_ptr);
*pool_handle_ptr = (LV2_RtMemPool_Handle)pool_ptr;

return true;
}
@@ -186,6 +188,8 @@ rtsafe_memory_pool_destroy(
assert(ret == 0);
}

free(pool_ptr);

// unused variable
(void)ret;
}
@@ -373,31 +377,22 @@ rtsafe_memory_pool_allocate_sleepy(
static
bool
rtsafe_memory_pool_create2(
LV2_RtMemPool_Handle pool_handle,
LV2_RtMemPool_Handle * pool_handle_ptr,
const char * pool_name,
size_t data_size,
size_t min_preallocated,
size_t max_preallocated)
{
return rtsafe_memory_pool_create(pool_handle, pool_name, data_size, min_preallocated, max_preallocated, false);
return rtsafe_memory_pool_create(pool_handle_ptr, pool_name, data_size, min_preallocated, max_preallocated, false);
}

void
rtmempool_allocator_init(
struct _LV2_RtMemPool_Pool * allocator_ptr)
{
allocator_ptr->handle = (LV2_RtMemPool_Handle)malloc(sizeof(struct rtsafe_memory_pool));
allocator_ptr->create = rtsafe_memory_pool_create2;
allocator_ptr->destroy = rtsafe_memory_pool_destroy;
allocator_ptr->allocate_atomic = rtsafe_memory_pool_allocate_atomic;
allocator_ptr->allocate_sleepy = rtsafe_memory_pool_allocate_sleepy;
allocator_ptr->deallocate = rtsafe_memory_pool_deallocate;
}

void
rtmempool_allocator_free(
const struct _LV2_RtMemPool_Pool * allocator_ptr)
{
if (allocator_ptr->handle)
free((struct rtsafe_memory_pool *)allocator_ptr->handle);
}

+ 0
- 4
c++/carla-backend/rtmempool/rtmempool.h View File

@@ -32,10 +32,6 @@ void
rtmempool_allocator_init(
struct _LV2_RtMemPool_Pool * allocator_ptr);

void
rtmempool_allocator_free(
const struct _LV2_RtMemPool_Pool * allocator_ptr);

#ifdef __cplusplus
} /* extern "C" */
#endif


+ 2
- 10
c++/carla-includes/lv2/lv2_rtmempool.h View File

@@ -43,14 +43,6 @@ typedef void* LV2_RtMemPool_Handle;
* LV2_Feature::data must be pointer to LV2_RtMemPool_Pool.
*/
typedef struct _LV2_RtMemPool_Pool {
/**
* Opaque pointer to host data.
*
* This MUST be passed to methods in this struct whenever they are called.
* Otherwise, it must not be interpreted in any way.
*/
LV2_RtMemPool_Handle handle;

/**
* This function is called when plugin wants to create memory pool
*
@@ -61,9 +53,9 @@ typedef struct _LV2_RtMemPool_Pool {
* @param min_preallocated min chunks preallocated
* @param max_preallocated max chunks preallocated
*
* @return Success status
* @return Success status, true if successful
*/
bool (*create)(LV2_RtMemPool_Handle handle,
bool (*create)(LV2_RtMemPool_Handle * handle_ptr,
const char * pool_name,
size_t data_size,
size_t min_preallocated,


+ 1
- 1
src/jacksettings.py View File

@@ -608,7 +608,7 @@ class JackSettingsW(QDialog, ui_settings_jack.Ui_JackSettingsW):
device_index = device_info[0].replace("device ", "")
device_name = device_info[1].split(" [")[0]

if (card_name != "Loopback"):
if card_name != "Loopback":
full_name = "hw:%s,%s [%s]" % (card_name, device_index, device_name)
alsa_dev_list.append(full_name)



Loading…
Cancel
Save