зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1286041 - Update cubeb library on commit 2f3b9eb. r=kinetik
MozReview-Commit-ID: EwVDPekHPsg
This commit is contained in:
Родитель
04d69510e8
Коммит
400c40ff87
|
@ -5,4 +5,4 @@ Makefile.in build files for the Mozilla build system.
|
||||||
|
|
||||||
The cubeb git repository is: git://github.com/kinetiknz/cubeb.git
|
The cubeb git repository is: git://github.com/kinetiknz/cubeb.git
|
||||||
|
|
||||||
The git commit ID used was e4074131e4d422bfe260d29ab0a49fc368406ef4.
|
The git commit ID used was 2f3b9eb51dcb11dbbe61df9a00219029f6dea90c.
|
||||||
|
|
|
@ -405,7 +405,7 @@ void cubeb_destroy(cubeb * context);
|
||||||
default output device is used.
|
default output device is used.
|
||||||
@param output_stream_params Parameters for the output side of the stream, or
|
@param output_stream_params Parameters for the output side of the stream, or
|
||||||
NULL if this stream is input only.
|
NULL if this stream is input only.
|
||||||
@param latency Stream latency in frames. Valid range
|
@param latency_frames Stream latency in frames. Valid range
|
||||||
is [1, 96000].
|
is [1, 96000].
|
||||||
@param data_callback Will be called to preroll data before playback is
|
@param data_callback Will be called to preroll data before playback is
|
||||||
started by cubeb_stream_start.
|
started by cubeb_stream_start.
|
||||||
|
|
|
@ -11,6 +11,29 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
#ifndef CLANG_ANALYZER_NORETURN
|
||||||
|
#if __has_feature(attribute_analyzer_noreturn)
|
||||||
|
#define CLANG_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
|
||||||
|
#else
|
||||||
|
#define CLANG_ANALYZER_NORETURN
|
||||||
|
#endif // ifndef CLANG_ANALYZER_NORETURN
|
||||||
|
#endif // __has_feature(attribute_analyzer_noreturn)
|
||||||
|
#else // __clang__
|
||||||
|
#define CLANG_ANALYZER_NORETURN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Crash the caller. */
|
||||||
|
void cubeb_crash() CLANG_ANALYZER_NORETURN;
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
struct cubeb_ops {
|
struct cubeb_ops {
|
||||||
int (* init)(cubeb ** context, char const * context_name);
|
int (* init)(cubeb ** context, char const * context_name);
|
||||||
char const * (* get_backend_id)(cubeb * context);
|
char const * (* get_backend_id)(cubeb * context);
|
||||||
|
@ -55,8 +78,7 @@ struct cubeb_ops {
|
||||||
#define XASSERT(expr) do { \
|
#define XASSERT(expr) do { \
|
||||||
if (!(expr)) { \
|
if (!(expr)) { \
|
||||||
fprintf(stderr, "%s:%d - fatal error: %s\n", __FILE__, __LINE__, #expr); \
|
fprintf(stderr, "%s:%d - fatal error: %s\n", __FILE__, __LINE__, #expr); \
|
||||||
*((volatile int *) NULL) = 0; \
|
cubeb_crash(); \
|
||||||
abort(); \
|
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
|
@ -454,3 +454,10 @@ int cubeb_register_device_collection_changed(cubeb * context,
|
||||||
return context->ops->register_device_collection_changed(context, devtype, callback, user_ptr);
|
return context->ops->register_device_collection_changed(context, devtype, callback, user_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cubeb_crash()
|
||||||
|
{
|
||||||
|
abort();
|
||||||
|
*((volatile int *) NULL) = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "cubeb_ring_array.h"
|
#include "cubeb_ring_array.h"
|
||||||
#include "cubeb_utils.h"
|
#include "cubeb_utils.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
#if !defined(kCFCoreFoundationVersionNumber10_7)
|
#if !defined(kCFCoreFoundationVersionNumber10_7)
|
||||||
/* From CoreFoundation CFBase.h */
|
/* From CoreFoundation CFBase.h */
|
||||||
|
@ -53,6 +54,12 @@ typedef UInt32 AudioFormatFlags;
|
||||||
#define AU_OUT_BUS 0
|
#define AU_OUT_BUS 0
|
||||||
#define AU_IN_BUS 1
|
#define AU_IN_BUS 1
|
||||||
|
|
||||||
|
#if TARGET_OS_IPHONE
|
||||||
|
#define CUBEB_AUDIOUNIT_SUBTYPE kAudioUnitSubType_RemoteIO
|
||||||
|
#else
|
||||||
|
#define CUBEB_AUDIOUNIT_SUBTYPE kAudioUnitSubType_HALOutput
|
||||||
|
#endif
|
||||||
|
|
||||||
//#define LOGGING_ENABLED
|
//#define LOGGING_ENABLED
|
||||||
#ifdef LOGGING_ENABLED
|
#ifdef LOGGING_ENABLED
|
||||||
#define LOG(...) do { \
|
#define LOG(...) do { \
|
||||||
|
@ -180,7 +187,7 @@ struct cubeb_stream {
|
||||||
int draining;
|
int draining;
|
||||||
uint64_t current_latency_frames;
|
uint64_t current_latency_frames;
|
||||||
uint64_t hw_latency_frames;
|
uint64_t hw_latency_frames;
|
||||||
float panning;
|
std::atomic<float> panning;
|
||||||
cubeb_resampler * resampler;
|
cubeb_resampler * resampler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -409,7 +416,8 @@ audiounit_output_callback(void * user_ptr,
|
||||||
stm->frames_queued += outframes;
|
stm->frames_queued += outframes;
|
||||||
|
|
||||||
AudioFormatFlags outaff = stm->output_desc.mFormatFlags;
|
AudioFormatFlags outaff = stm->output_desc.mFormatFlags;
|
||||||
float panning = (stm->output_desc.mChannelsPerFrame == 2) ? stm->panning : 0.0f;
|
float panning = (stm->output_desc.mChannelsPerFrame == 2) ?
|
||||||
|
stm->panning.load(std::memory_order_relaxed) : 0.0f;
|
||||||
|
|
||||||
/* Post process output samples. */
|
/* Post process output samples. */
|
||||||
if (stm->draining) {
|
if (stm->draining) {
|
||||||
|
@ -904,21 +912,7 @@ audiounit_create_unit(AudioUnit * unit,
|
||||||
OSStatus rv;
|
OSStatus rv;
|
||||||
|
|
||||||
desc.componentType = kAudioUnitType_Output;
|
desc.componentType = kAudioUnitType_Output;
|
||||||
#if TARGET_OS_IPHONE
|
desc.componentSubType = CUBEB_AUDIOUNIT_SUBTYPE;
|
||||||
bool use_default_output = false;
|
|
||||||
desc.componentSubType = kAudioUnitSubType_RemoteIO;
|
|
||||||
#else
|
|
||||||
// Use the DefaultOutputUnit for output when no device is specified
|
|
||||||
// so we retain automatic output device switching when the default
|
|
||||||
// changes. Once we have complete support for device notifications
|
|
||||||
// and switching, we can use the AUHAL for everything.
|
|
||||||
bool use_default_output = device == NULL && !is_input;
|
|
||||||
if (use_default_output) {
|
|
||||||
desc.componentSubType = kAudioUnitSubType_DefaultOutput;
|
|
||||||
} else {
|
|
||||||
desc.componentSubType = kAudioUnitSubType_HALOutput;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
|
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
|
||||||
desc.componentFlags = 0;
|
desc.componentFlags = 0;
|
||||||
desc.componentFlagsMask = 0;
|
desc.componentFlagsMask = 0;
|
||||||
|
@ -934,7 +928,6 @@ audiounit_create_unit(AudioUnit * unit,
|
||||||
return CUBEB_ERROR;
|
return CUBEB_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!use_default_output) {
|
|
||||||
enable = 1;
|
enable = 1;
|
||||||
rv = AudioUnitSetProperty(*unit, kAudioOutputUnitProperty_EnableIO,
|
rv = AudioUnitSetProperty(*unit, kAudioOutputUnitProperty_EnableIO,
|
||||||
is_input ? kAudioUnitScope_Input : kAudioUnitScope_Output,
|
is_input ? kAudioUnitScope_Input : kAudioUnitScope_Output,
|
||||||
|
@ -954,8 +947,8 @@ audiounit_create_unit(AudioUnit * unit,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device == NULL) {
|
if (device == NULL) {
|
||||||
assert(is_input);
|
devid = audiounit_get_default_device_id(is_input ? CUBEB_DEVICE_TYPE_INPUT
|
||||||
devid = audiounit_get_default_device_id(CUBEB_DEVICE_TYPE_INPUT);
|
: CUBEB_DEVICE_TYPE_OUTPUT);
|
||||||
} else {
|
} else {
|
||||||
devid = reinterpret_cast<intptr_t>(device);
|
devid = reinterpret_cast<intptr_t>(device);
|
||||||
}
|
}
|
||||||
|
@ -967,7 +960,6 @@ audiounit_create_unit(AudioUnit * unit,
|
||||||
PRINT_ERROR_CODE("AudioUnitSetProperty/kAudioOutputUnitProperty_CurrentDevice", rv);
|
PRINT_ERROR_CODE("AudioUnitSetProperty/kAudioOutputUnitProperty_CurrentDevice", rv);
|
||||||
return CUBEB_ERROR;
|
return CUBEB_ERROR;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return CUBEB_OK;
|
return CUBEB_OK;
|
||||||
}
|
}
|
||||||
|
@ -1613,11 +1605,7 @@ int audiounit_stream_set_panning(cubeb_stream * stm, float panning)
|
||||||
return CUBEB_ERROR_INVALID_PARAMETER;
|
return CUBEB_ERROR_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
stm->panning.store(panning, std::memory_order_relaxed);
|
||||||
auto_lock lock(stm->mutex);
|
|
||||||
stm->panning = panning;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CUBEB_OK;
|
return CUBEB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -283,8 +283,6 @@ cbjack_graph_order_callback(void * arg)
|
||||||
{
|
{
|
||||||
cubeb * ctx = (cubeb *)arg;
|
cubeb * ctx = (cubeb *)arg;
|
||||||
int i;
|
int i;
|
||||||
uint32_t rate;
|
|
||||||
|
|
||||||
jack_latency_range_t latency_range;
|
jack_latency_range_t latency_range;
|
||||||
jack_nframes_t port_latency, max_latency = 0;
|
jack_nframes_t port_latency, max_latency = 0;
|
||||||
|
|
||||||
|
@ -623,13 +621,13 @@ jack_init (cubeb ** context, char const * context_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
static char const *
|
static char const *
|
||||||
cbjack_get_backend_id(cubeb * context)
|
cbjack_get_backend_id(cubeb * /*context*/)
|
||||||
{
|
{
|
||||||
return "jack";
|
return "jack";
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cbjack_get_max_channel_count(cubeb * ctx, uint32_t * max_channels)
|
cbjack_get_max_channel_count(cubeb * /*ctx*/, uint32_t * max_channels)
|
||||||
{
|
{
|
||||||
*max_channels = MAX_CHANNELS;
|
*max_channels = MAX_CHANNELS;
|
||||||
return CUBEB_OK;
|
return CUBEB_OK;
|
||||||
|
@ -643,7 +641,7 @@ cbjack_get_latency(cubeb_stream * stm, unsigned int * latency_ms)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cbjack_get_min_latency(cubeb * ctx, cubeb_stream_params params, uint32_t * latency_ms)
|
cbjack_get_min_latency(cubeb * ctx, cubeb_stream_params /*params*/, uint32_t * latency_ms)
|
||||||
{
|
{
|
||||||
*latency_ms = ctx->jack_latency;
|
*latency_ms = ctx->jack_latency;
|
||||||
return CUBEB_OK;
|
return CUBEB_OK;
|
||||||
|
@ -703,7 +701,7 @@ cbjack_stream_init(cubeb * context, cubeb_stream ** stream, char const * stream_
|
||||||
cubeb_stream_params * input_stream_params,
|
cubeb_stream_params * input_stream_params,
|
||||||
cubeb_devid output_device,
|
cubeb_devid output_device,
|
||||||
cubeb_stream_params * output_stream_params,
|
cubeb_stream_params * output_stream_params,
|
||||||
unsigned int latency_frames,
|
unsigned int /*latency_frames*/,
|
||||||
cubeb_data_callback data_callback,
|
cubeb_data_callback data_callback,
|
||||||
cubeb_state_callback state_callback,
|
cubeb_state_callback state_callback,
|
||||||
void * user_ptr)
|
void * user_ptr)
|
||||||
|
@ -725,6 +723,9 @@ cbjack_stream_init(cubeb * context, cubeb_stream ** stream, char const * stream_
|
||||||
return CUBEB_ERROR_INVALID_FORMAT;
|
return CUBEB_ERROR_INVALID_FORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (input_device || output_device)
|
||||||
|
return CUBEB_ERROR_NOT_SUPPORTED;
|
||||||
|
|
||||||
*stream = NULL;
|
*stream = NULL;
|
||||||
|
|
||||||
// Find a free stream.
|
// Find a free stream.
|
||||||
|
@ -956,7 +957,7 @@ cbjack_stream_get_current_device(cubeb_stream * stm, cubeb_device ** const devic
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cbjack_stream_device_destroy(cubeb_stream * stream,
|
cbjack_stream_device_destroy(cubeb_stream * /*stream*/,
|
||||||
cubeb_device * device)
|
cubeb_device * device)
|
||||||
{
|
{
|
||||||
if (device->input_name)
|
if (device->input_name)
|
||||||
|
|
|
@ -73,12 +73,14 @@
|
||||||
X(pa_stream_set_read_callback) \
|
X(pa_stream_set_read_callback) \
|
||||||
X(pa_stream_connect_record) \
|
X(pa_stream_connect_record) \
|
||||||
X(pa_stream_readable_size) \
|
X(pa_stream_readable_size) \
|
||||||
|
X(pa_stream_writable_size) \
|
||||||
X(pa_stream_peek) \
|
X(pa_stream_peek) \
|
||||||
X(pa_stream_drop) \
|
X(pa_stream_drop) \
|
||||||
X(pa_stream_get_buffer_attr) \
|
X(pa_stream_get_buffer_attr) \
|
||||||
X(pa_stream_get_device_name) \
|
X(pa_stream_get_device_name) \
|
||||||
X(pa_context_set_subscribe_callback) \
|
X(pa_context_set_subscribe_callback) \
|
||||||
X(pa_context_subscribe) \
|
X(pa_context_subscribe) \
|
||||||
|
X(pa_mainloop_api_once) \
|
||||||
|
|
||||||
#define MAKE_TYPEDEF(x) static typeof(x) * cubeb_##x;
|
#define MAKE_TYPEDEF(x) static typeof(x) * cubeb_##x;
|
||||||
LIBPULSE_API_VISIT(MAKE_TYPEDEF);
|
LIBPULSE_API_VISIT(MAKE_TYPEDEF);
|
||||||
|
@ -120,6 +122,7 @@ struct cubeb_stream {
|
||||||
pa_sample_spec input_sample_spec;
|
pa_sample_spec input_sample_spec;
|
||||||
int shutdown;
|
int shutdown;
|
||||||
float volume;
|
float volume;
|
||||||
|
cubeb_state state;
|
||||||
};
|
};
|
||||||
|
|
||||||
const float PULSE_NO_GAIN = -1.0;
|
const float PULSE_NO_GAIN = -1.0;
|
||||||
|
@ -172,14 +175,22 @@ stream_success_callback(pa_stream * s, int success, void * u)
|
||||||
WRAP(pa_threaded_mainloop_signal)(stm->context->mainloop, 0);
|
WRAP(pa_threaded_mainloop_signal)(stm->context->mainloop, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
stream_state_change_callback(cubeb_stream * stm, cubeb_state s)
|
||||||
|
{
|
||||||
|
stm->state = s;
|
||||||
|
stm->state_callback(stm, stm->user_ptr, s);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stream_drain_callback(pa_mainloop_api * a, pa_time_event * e, struct timeval const * tv, void * u)
|
stream_drain_callback(pa_mainloop_api * a, pa_time_event * e, struct timeval const * tv, void * u)
|
||||||
{
|
{
|
||||||
cubeb_stream * stm = u;
|
cubeb_stream * stm = u;
|
||||||
|
stream_state_change_callback(stm, CUBEB_STATE_DRAINED);
|
||||||
/* there's no pa_rttime_free, so use this instead. */
|
/* there's no pa_rttime_free, so use this instead. */
|
||||||
a->time_free(stm->drain_timer);
|
a->time_free(stm->drain_timer);
|
||||||
stm->drain_timer = NULL;
|
stm->drain_timer = NULL;
|
||||||
stm->state_callback(stm, stm->user_ptr, CUBEB_STATE_DRAINED);
|
WRAP(pa_threaded_mainloop_signal)(stm->context->mainloop, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -187,7 +198,7 @@ stream_state_callback(pa_stream * s, void * u)
|
||||||
{
|
{
|
||||||
cubeb_stream * stm = u;
|
cubeb_stream * stm = u;
|
||||||
if (!PA_STREAM_IS_GOOD(WRAP(pa_stream_get_state)(s))) {
|
if (!PA_STREAM_IS_GOOD(WRAP(pa_stream_get_state)(s))) {
|
||||||
stm->state_callback(stm, stm->user_ptr, CUBEB_STATE_ERROR);
|
stream_state_change_callback(stm, CUBEB_STATE_ERROR);
|
||||||
}
|
}
|
||||||
WRAP(pa_threaded_mainloop_signal)(stm->context->mainloop, 0);
|
WRAP(pa_threaded_mainloop_signal)(stm->context->mainloop, 0);
|
||||||
}
|
}
|
||||||
|
@ -286,7 +297,8 @@ stream_write_callback(pa_stream * s, size_t nbytes, void * u)
|
||||||
{
|
{
|
||||||
LOG("Output callback to be written buffer size %zd\n", nbytes);
|
LOG("Output callback to be written buffer size %zd\n", nbytes);
|
||||||
cubeb_stream * stm = u;
|
cubeb_stream * stm = u;
|
||||||
if (stm->shutdown) {
|
if (stm->shutdown ||
|
||||||
|
stm->state != CUBEB_STATE_STARTED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,8 +436,8 @@ stream_cork(cubeb_stream * stm, enum cork_state state)
|
||||||
WRAP(pa_threaded_mainloop_unlock)(stm->context->mainloop);
|
WRAP(pa_threaded_mainloop_unlock)(stm->context->mainloop);
|
||||||
|
|
||||||
if (state & NOTIFY) {
|
if (state & NOTIFY) {
|
||||||
stm->state_callback(stm, stm->user_ptr,
|
stream_state_change_callback(stm, state & CORK ? CUBEB_STATE_STOPPED
|
||||||
state & CORK ? CUBEB_STATE_STOPPED : CUBEB_STATE_STARTED);
|
: CUBEB_STATE_STARTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -719,6 +731,8 @@ pulse_stream_init(cubeb * context,
|
||||||
stm->state_callback = state_callback;
|
stm->state_callback = state_callback;
|
||||||
stm->user_ptr = user_ptr;
|
stm->user_ptr = user_ptr;
|
||||||
stm->volume = PULSE_NO_GAIN;
|
stm->volume = PULSE_NO_GAIN;
|
||||||
|
stm->state = -1;
|
||||||
|
assert(stm->shutdown == 0);
|
||||||
|
|
||||||
WRAP(pa_threaded_mainloop_lock)(stm->context->mainloop);
|
WRAP(pa_threaded_mainloop_lock)(stm->context->mainloop);
|
||||||
if (output_stream_params) {
|
if (output_stream_params) {
|
||||||
|
@ -830,16 +844,44 @@ pulse_stream_destroy(cubeb_stream * stm)
|
||||||
free(stm);
|
free(stm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
pulse_defer_event_cb(pa_mainloop_api * a, void * userdata)
|
||||||
|
{
|
||||||
|
cubeb_stream * stm = userdata;
|
||||||
|
size_t writable_size = WRAP(pa_stream_writable_size)(stm->output_stream);
|
||||||
|
trigger_user_callback(stm->output_stream, NULL, writable_size, stm);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
pulse_stream_start(cubeb_stream * stm)
|
pulse_stream_start(cubeb_stream * stm)
|
||||||
{
|
{
|
||||||
|
stm->shutdown = 0;
|
||||||
stream_cork(stm, UNCORK | NOTIFY);
|
stream_cork(stm, UNCORK | NOTIFY);
|
||||||
|
|
||||||
|
if (stm->output_stream && !stm->input_stream) {
|
||||||
|
/* On output only case need to manually call user cb once in order to make
|
||||||
|
* things roll. This is done via a defer event in order to execute it
|
||||||
|
* from PA server thread. */
|
||||||
|
WRAP(pa_threaded_mainloop_lock)(stm->context->mainloop);
|
||||||
|
WRAP(pa_mainloop_api_once)(WRAP(pa_threaded_mainloop_get_api)(stm->context->mainloop),
|
||||||
|
pulse_defer_event_cb, stm);
|
||||||
|
WRAP(pa_threaded_mainloop_unlock)(stm->context->mainloop);
|
||||||
|
}
|
||||||
|
|
||||||
return CUBEB_OK;
|
return CUBEB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
pulse_stream_stop(cubeb_stream * stm)
|
pulse_stream_stop(cubeb_stream * stm)
|
||||||
{
|
{
|
||||||
|
WRAP(pa_threaded_mainloop_lock)(stm->context->mainloop);
|
||||||
|
stm->shutdown = 1;
|
||||||
|
// If draining is taking place wait to finish
|
||||||
|
while (stm->drain_timer) {
|
||||||
|
WRAP(pa_threaded_mainloop_wait)(stm->context->mainloop);
|
||||||
|
}
|
||||||
|
WRAP(pa_threaded_mainloop_unlock)(stm->context->mainloop);
|
||||||
|
|
||||||
stream_cork(stm, CORK | NOTIFY);
|
stream_cork(stm, CORK | NOTIFY);
|
||||||
return CUBEB_OK;
|
return CUBEB_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ template<typename T, typename InputProcessor, typename OutputProcessor>
|
||||||
long
|
long
|
||||||
cubeb_resampler_speex<T, InputProcessor, OutputProcessor>
|
cubeb_resampler_speex<T, InputProcessor, OutputProcessor>
|
||||||
::fill_internal_input(T * input_buffer, long * input_frames_count,
|
::fill_internal_input(T * input_buffer, long * input_frames_count,
|
||||||
T * output_buffer, long output_frames_needed)
|
T * output_buffer, long /*output_frames_needed*/)
|
||||||
{
|
{
|
||||||
assert(input_buffer && input_frames_count && *input_frames_count &&
|
assert(input_buffer && input_frames_count && *input_frames_count &&
|
||||||
!output_buffer);
|
!output_buffer);
|
||||||
|
|
|
@ -20,7 +20,11 @@ public:
|
||||||
{
|
{
|
||||||
pthread_mutexattr_t attr;
|
pthread_mutexattr_t attr;
|
||||||
pthread_mutexattr_init(&attr);
|
pthread_mutexattr_init(&attr);
|
||||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
#ifdef DEBUG
|
||||||
|
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
|
||||||
|
#else
|
||||||
|
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
int r =
|
int r =
|
||||||
|
|
|
@ -73,7 +73,7 @@ void synth_run_float(synth_state* synth, float* audiobuffer, long nframes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long data_cb_float(cubeb_stream *stream, void *user, const void * inputbuffer, void *outputbuffer, long nframes)
|
long data_cb_float(cubeb_stream * /*stream*/, void * user, const void * /*inputbuffer*/, void * outputbuffer, long nframes)
|
||||||
{
|
{
|
||||||
synth_state *synth = (synth_state *)user;
|
synth_state *synth = (synth_state *)user;
|
||||||
synth_run_float(synth, (float*)outputbuffer, nframes);
|
synth_run_float(synth, (float*)outputbuffer, nframes);
|
||||||
|
@ -92,14 +92,14 @@ void synth_run_16bit(synth_state* synth, short* audiobuffer, long nframes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long data_cb_short(cubeb_stream *stream, void *user, const void * inputbuffer, void *outputbuffer, long nframes)
|
long data_cb_short(cubeb_stream * /*stream*/, void * user, const void * /*inputbuffer*/, void * outputbuffer, long nframes)
|
||||||
{
|
{
|
||||||
synth_state *synth = (synth_state *)user;
|
synth_state *synth = (synth_state *)user;
|
||||||
synth_run_16bit(synth, (short*)outputbuffer, nframes);
|
synth_run_16bit(synth, (short*)outputbuffer, nframes);
|
||||||
return nframes;
|
return nframes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void state_cb(cubeb_stream *stream, void *user, cubeb_state state)
|
void state_cb(cubeb_stream * /*stream*/, void * /*user*/, cubeb_state /*state*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ void run_channel_rate_test()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int /*argc*/, char * /*argv*/[])
|
||||||
{
|
{
|
||||||
#ifdef CUBEB_GECKO_BUILD
|
#ifdef CUBEB_GECKO_BUILD
|
||||||
ScopedXPCOM xpcom("test_audio");
|
ScopedXPCOM xpcom("test_audio");
|
||||||
|
|
|
@ -70,7 +70,7 @@ long data_cb(cubeb_stream *stream, void *user, const void * inputbuffer, void *o
|
||||||
return nframes;
|
return nframes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void state_cb(cubeb_stream *stream, void *user, cubeb_state state)
|
void state_cb(cubeb_stream * stream, void * /*user*/, cubeb_state state)
|
||||||
{
|
{
|
||||||
if (stream == NULL)
|
if (stream == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -89,7 +89,7 @@ void state_cb(cubeb_stream *stream, void *user, cubeb_state state)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int /*argc*/, char * /*argv*/[])
|
||||||
{
|
{
|
||||||
#ifdef CUBEB_GECKO_BUILD
|
#ifdef CUBEB_GECKO_BUILD
|
||||||
ScopedXPCOM xpcom("test_duplex");
|
ScopedXPCOM xpcom("test_duplex");
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#define LOG(msg) fprintf(stderr, "%s\n", msg);
|
#define LOG(msg) fprintf(stderr, "%s\n", msg);
|
||||||
|
|
||||||
int main(int argc, char * argv[])
|
int main(int /*argc*/, char * /*argv*/[])
|
||||||
{
|
{
|
||||||
#ifdef CUBEB_GECKO_BUILD
|
#ifdef CUBEB_GECKO_BUILD
|
||||||
ScopedXPCOM xpcom("test_latency");
|
ScopedXPCOM xpcom("test_latency");
|
||||||
|
|
|
@ -58,7 +58,7 @@ long data_cb(cubeb_stream *stream, void *user, const void * inputbuffer, void *o
|
||||||
return nframes;
|
return nframes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void state_cb(cubeb_stream *stream, void *user, cubeb_state state)
|
void state_cb(cubeb_stream * stream, void * /*user*/, cubeb_state state)
|
||||||
{
|
{
|
||||||
if (stream == NULL)
|
if (stream == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -77,7 +77,7 @@ void state_cb(cubeb_stream *stream, void *user, cubeb_state state)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int /*argc*/, char * /*argv*/[])
|
||||||
{
|
{
|
||||||
#ifdef CUBEB_GECKO_BUILD
|
#ifdef CUBEB_GECKO_BUILD
|
||||||
ScopedXPCOM xpcom("test_record");
|
ScopedXPCOM xpcom("test_record");
|
||||||
|
|
|
@ -283,7 +283,7 @@ uint32_t fill_with_sine(float * buf, uint32_t rate, uint32_t channels,
|
||||||
return initial_phase;
|
return initial_phase;
|
||||||
}
|
}
|
||||||
|
|
||||||
long data_cb(cubeb_stream * stm, void * user_ptr,
|
long data_cb(cubeb_stream * /*stm*/, void * user_ptr,
|
||||||
const void * input_buffer, void * output_buffer, long frame_count)
|
const void * input_buffer, void * output_buffer, long frame_count)
|
||||||
{
|
{
|
||||||
osc_state * state = reinterpret_cast<osc_state*>(user_ptr);
|
osc_state * state = reinterpret_cast<osc_state*>(user_ptr);
|
||||||
|
@ -464,7 +464,7 @@ void test_delay_line()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long test_output_only_noop_data_cb(cubeb_stream * stm, void * user_ptr,
|
long test_output_only_noop_data_cb(cubeb_stream * /*stm*/, void * /*user_ptr*/,
|
||||||
const void * input_buffer,
|
const void * input_buffer,
|
||||||
void * output_buffer, long frame_count)
|
void * output_buffer, long frame_count)
|
||||||
{
|
{
|
||||||
|
@ -500,7 +500,7 @@ void test_output_only_noop()
|
||||||
cubeb_resampler_destroy(resampler);
|
cubeb_resampler_destroy(resampler);
|
||||||
}
|
}
|
||||||
|
|
||||||
long test_drain_data_cb(cubeb_stream * stm, void * user_ptr,
|
long test_drain_data_cb(cubeb_stream * /*stm*/, void * /*user_ptr*/,
|
||||||
const void * input_buffer,
|
const void * input_buffer,
|
||||||
void * output_buffer, long frame_count)
|
void * output_buffer, long frame_count)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,7 +36,7 @@ static uint64_t total_frames_written;
|
||||||
static int delay_callback;
|
static int delay_callback;
|
||||||
|
|
||||||
static long
|
static long
|
||||||
test_data_callback(cubeb_stream * stm, void * user_ptr, const void * inputbuffer, void * outputbuffer, long nframes)
|
test_data_callback(cubeb_stream * stm, void * user_ptr, const void * /*inputbuffer*/, void * outputbuffer, long nframes)
|
||||||
{
|
{
|
||||||
assert(stm && user_ptr == &dummy && outputbuffer && nframes > 0);
|
assert(stm && user_ptr == &dummy && outputbuffer && nframes > 0);
|
||||||
#if (defined(_WIN32) || defined(__WIN32__))
|
#if (defined(_WIN32) || defined(__WIN32__))
|
||||||
|
@ -53,7 +53,7 @@ test_data_callback(cubeb_stream * stm, void * user_ptr, const void * inputbuffer
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_state_callback(cubeb_stream * stm, void * user_ptr, cubeb_state state)
|
test_state_callback(cubeb_stream * /*stm*/, void * /*user_ptr*/, cubeb_state /*state*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,7 +494,7 @@ static int do_drain;
|
||||||
static int got_drain;
|
static int got_drain;
|
||||||
|
|
||||||
static long
|
static long
|
||||||
test_drain_data_callback(cubeb_stream * stm, void * user_ptr, const void * inputbuffer, void * outputbuffer, long nframes)
|
test_drain_data_callback(cubeb_stream * stm, void * user_ptr, const void * /*inputbuffer*/, void * outputbuffer, long nframes)
|
||||||
{
|
{
|
||||||
assert(stm && user_ptr == &dummy && outputbuffer && nframes > 0);
|
assert(stm && user_ptr == &dummy && outputbuffer && nframes > 0);
|
||||||
if (do_drain == 1) {
|
if (do_drain == 1) {
|
||||||
|
@ -513,7 +513,7 @@ test_drain_data_callback(cubeb_stream * stm, void * user_ptr, const void * input
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_drain_state_callback(cubeb_stream * stm, void * user_ptr, cubeb_state state)
|
test_drain_state_callback(cubeb_stream * /*stm*/, void * /*user_ptr*/, cubeb_state state)
|
||||||
{
|
{
|
||||||
if (state == CUBEB_STATE_DRAINED) {
|
if (state == CUBEB_STATE_DRAINED) {
|
||||||
assert(!got_drain);
|
assert(!got_drain);
|
||||||
|
@ -608,7 +608,7 @@ int is_windows_7()
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char * argv[])
|
main(int /*argc*/, char * /*argv*/[])
|
||||||
{
|
{
|
||||||
#ifdef CUBEB_GECKO_BUILD
|
#ifdef CUBEB_GECKO_BUILD
|
||||||
ScopedXPCOM xpcom("test_sanity");
|
ScopedXPCOM xpcom("test_sanity");
|
||||||
|
|
|
@ -34,7 +34,7 @@ struct cb_user_data {
|
||||||
long position;
|
long position;
|
||||||
};
|
};
|
||||||
|
|
||||||
long data_cb(cubeb_stream *stream, void *user, const void* inputbuffer, void *outputbuffer, long nframes)
|
long data_cb(cubeb_stream *stream, void *user, const void* /*inputbuffer*/, void *outputbuffer, long nframes)
|
||||||
{
|
{
|
||||||
struct cb_user_data *u = (struct cb_user_data *)user;
|
struct cb_user_data *u = (struct cb_user_data *)user;
|
||||||
#if (defined(_WIN32) || defined(__WIN32__))
|
#if (defined(_WIN32) || defined(__WIN32__))
|
||||||
|
@ -98,7 +98,7 @@ void state_cb(cubeb_stream *stream, void *user, cubeb_state state)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int /*argc*/, char * /*argv*/[])
|
||||||
{
|
{
|
||||||
#ifdef CUBEB_GECKO_BUILD
|
#ifdef CUBEB_GECKO_BUILD
|
||||||
ScopedXPCOM xpcom("test_tone");
|
ScopedXPCOM xpcom("test_tone");
|
||||||
|
|
Загрузка…
Ссылка в новой задаче