mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-16 21:50:11 +02:00
Print a distinct error when mmap() returns EAGAIN
As mentioned in #119.
This commit is contained in:
@@ -8,6 +8,13 @@ Versioning](https://semver.org/spec/v2.0.0.html).
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added a specific error message when yabridge is not allowed to lock enough
|
||||||
|
shared memory. If you have not yet set up realtime priviliges and memory
|
||||||
|
locking limits for your user, then yabridge may not be able to map enough
|
||||||
|
shared memory for processing audio in plugins with a lot of inputs or outputs.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed crashes or freezes when a plugin uses the Windows drag-and-drop system
|
- Fixed crashes or freezes when a plugin uses the Windows drag-and-drop system
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
#include "audio-shm.h"
|
#include "audio-shm.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
AudioShmBuffer::AudioShmBuffer(const Config& config)
|
AudioShmBuffer::AudioShmBuffer(const Config& config)
|
||||||
: config(config),
|
: config(config),
|
||||||
shm(boost::interprocess::open_or_create,
|
shm(boost::interprocess::open_or_create,
|
||||||
@@ -61,12 +63,29 @@ void AudioShmBuffer::resize(const Config& new_config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AudioShmBuffer::setup_mapping() {
|
void AudioShmBuffer::setup_mapping() {
|
||||||
// Apparently you get a `Resource temporarily unavailable` when calling
|
try {
|
||||||
// `ftruncate()` with a size of 0 on shared memory
|
// Apparently you get a `Resource temporarily unavailable` when calling
|
||||||
if (config.size > 0) {
|
// `ftruncate()` with a size of 0 on shared memory
|
||||||
shm.truncate(config.size);
|
if (config.size > 0) {
|
||||||
buffer = boost::interprocess::mapped_region(
|
shm.truncate(config.size);
|
||||||
shm, boost::interprocess::read_write, 0, config.size, nullptr,
|
buffer = boost::interprocess::mapped_region(
|
||||||
MAP_LOCKED);
|
shm, boost::interprocess::read_write, 0, config.size, nullptr,
|
||||||
|
MAP_LOCKED);
|
||||||
|
}
|
||||||
|
} catch (const boost::interprocess::interprocess_exception& error) {
|
||||||
|
if (error.get_native_error() == EAGAIN) {
|
||||||
|
std::cerr << "ERROR: Could not map shared memory. This means that"
|
||||||
|
<< std::endl;
|
||||||
|
std::cerr << " your user's memory locking limit has been set"
|
||||||
|
<< std::endl;
|
||||||
|
std::cerr << " too low. Check your distro's documentation or"
|
||||||
|
<< std::endl;
|
||||||
|
std::cerr << " wiki for instructions on how to set up"
|
||||||
|
<< std::endl;
|
||||||
|
std::cerr << " realtime privileges and memlock limits."
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user