Commit 2002913d authored by David Reid's avatar David Reid Committed by GitHub

Merge pull request #372 from orx/dev-0.11

Fixed compilation warnings & errors on iOS
parents 19a3eb69 7d84ec56
/*
Audio playback and capture library. Choice of public domain or MIT-0. See license statements at the end of this file.
miniaudio - v0.10.42 - 2021-08-22
miniaudio - v0.10.42 - 2021-08-22
David Reid - mackron@gmail.com
......@@ -3286,7 +3286,7 @@ extern "C" {
#define MA_VERSION_MAJOR 0
#define MA_VERSION_MINOR 10
#define MA_VERSION_REVISION 42
#define MA_VERSION_REVISION 42
#define MA_VERSION_STRING MA_XSTRINGIFY(MA_VERSION_MAJOR) "." MA_XSTRINGIFY(MA_VERSION_MINOR) "." MA_XSTRINGIFY(MA_VERSION_REVISION)
#if defined(_MSC_VER) && !defined(__clang__)
......@@ -3302,6 +3302,23 @@ extern "C" {
#endif
#endif
#if defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
#include <stdalign.h>
#define MA_ALIGN_TYPE(n) alignas(n)
#define MA_ALIGN_MEMBER(align, type) MA_ALIGN_TYPE(align) type
#else
#if defined(__GNUC__)
#define MA_ALIGN_TYPE(n) __attribute__((aligned(n)))
#define MA_ALIGN_MEMBER(align, type) type MA_ALIGN_TYPE(align)
#elif defined(_MSC_VER)
#define MA_ALIGN_TYPE(n) __declspec(align(n))
#define MA_ALIGN_MEMBER(align, type) MA_ALIGN_TYPE(align) type
#else
#define MA_ALIGN_TYPE(n) /* disabled */
#define MA_ALIGN_MEMBER(align, type) /* disabled */
#endif
#endif
/* Platform/backend detection. */
#ifdef _WIN32
#define MA_WIN32
......@@ -8898,7 +8915,7 @@ typedef struct
} breakup;
ma_uint64 allocation;
} toc; /* 8 bytes. We encode the job code into the slot allocation data to save space. */
ma_uint64 next; /* refcount + slot for the next item. Does not include the job code. */
MA_ATOMIC MA_ALIGN_MEMBER(8, ma_uint64) next; /* refcount + slot for the next item. Does not include the job code. */
ma_uint32 order; /* Execution order. Used to create a data dependency and ensure a job is executed in order. Usage is contextual depending on the job type. */
union
......@@ -9003,7 +9020,7 @@ typedef struct
{
ma_uint32 flags; /* Flags passed in at initialization time. */
ma_uint32 capacity; /* The maximum number of jobs that can fit in the queue at a time. Set by the config. */
MA_ATOMIC ma_uint64 head; /* The first item in the list. Required for removing from the top of the list. */
MA_ATOMIC MA_ALIGN_MEMBER(8, ma_uint64) head; /* The first item in the list. Required for removing from the top of the list. */
MA_ATOMIC ma_uint64 tail; /* The last item in the list. Required for appending to the end of the list. */
#ifndef MA_NO_THREADING
ma_semaphore sem; /* Only used when MA_RESOURCE_MANAGER_JOB_QUEUE_FLAG_NON_BLOCKING is unset. */
......@@ -9133,7 +9150,7 @@ struct ma_resource_manager_data_stream
ma_bool32 isDecoderInitialized; /* Required for determining whether or not the decoder should be uninitialized in MA_RESOURCE_MANAGER_JOB_FREE_DATA_STREAM. */
ma_uint64 totalLengthInPCMFrames; /* This is calculated when first loaded by the MA_RESOURCE_MANAGER_JOB_LOAD_DATA_STREAM. */
ma_uint32 relativeCursor; /* The playback cursor, relative to the current page. Only ever accessed by the public API. Never accessed by the job thread. */
ma_uint64 absoluteCursor; /* The playback cursor, in absolute position starting from the start of the file. */
MA_ATOMIC MA_ALIGN_MEMBER(8, ma_uint64) absoluteCursor; /* The playback cursor, in absolute position starting from the start of the file. */
ma_uint32 currentPageIndex; /* Toggles between 0 and 1. Index 0 is the first half of pPageData. Index 1 is the second half. Only ever accessed by the public API. Never accessed by the job thread. */
MA_ATOMIC ma_uint32 executionCounter; /* For allocating execution orders for jobs. */
MA_ATOMIC ma_uint32 executionPointer; /* For managing the order of execution for asynchronous jobs relating to this object. Incremented as jobs complete processing. */
......@@ -9423,8 +9440,8 @@ struct ma_node_base
/* These variables are read and written between different threads. */
MA_ATOMIC ma_node_state state; /* When set to stopped, nothing will be read, regardless of the times in stateTimes. */
MA_ATOMIC ma_uint64 stateTimes[2]; /* Indexed by ma_node_state. Specifies the time based on the global clock that a node should be considered to be in the relevant state. */
MA_ATOMIC ma_uint64 localTime; /* The node's local clock. This is just a running sum of the number of output frames that have been processed. Can be modified by any thread with `ma_node_set_time()`. */
MA_ATOMIC MA_ALIGN_MEMBER(8, ma_uint64) stateTimes[2]; /* Indexed by ma_node_state. Specifies the time based on the global clock that a node should be considered to be in the relevant state. */
MA_ATOMIC MA_ALIGN_MEMBER(8, ma_uint64) localTime; /* The node's local clock. This is just a running sum of the number of output frames that have been processed. Can be modified by any thread with `ma_node_set_time()`. */
ma_uint32 inputBusCount;
ma_uint32 outputBusCount;
ma_node_input_bus* pInputBuses;
......@@ -16524,11 +16541,11 @@ static ma_result ma_device_audio_thread__default_read_write(ma_device* pDevice)
}
}
/* Make sure we don't get stuck in the inner loop. */
if (capturedDeviceFramesProcessed == 0) {
break;
}
/* Make sure we don't get stuck in the inner loop. */
if (capturedDeviceFramesProcessed == 0) {
break;
}
totalCapturedDeviceFramesProcessed += capturedDeviceFramesProcessed;
}
} break;
......@@ -16552,11 +16569,11 @@ static ma_result ma_device_audio_thread__default_read_write(ma_device* pDevice)
break;
}
/* Make sure we don't get stuck in the inner loop. */
if (framesProcessed == 0) {
break;
}
/* Make sure we don't get stuck in the inner loop. */
if (framesProcessed == 0) {
break;
}
ma_device__send_frames_to_client(pDevice, framesProcessed, capturedDeviceData);
framesReadThisPeriod += framesProcessed;
......@@ -16584,11 +16601,11 @@ static ma_result ma_device_audio_thread__default_read_write(ma_device* pDevice)
break;
}
/* Make sure we don't get stuck in the inner loop. */
if (framesProcessed == 0) {
break;
}
/* Make sure we don't get stuck in the inner loop. */
if (framesProcessed == 0) {
break;
}
framesWrittenThisPeriod += framesProcessed;
}
} break;
......@@ -28589,6 +28606,13 @@ References
#if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH == 1
#define MA_APPLE_WATCH
#endif
#if __has_feature(objc_arc)
#define MA_BRIDGE_TRANSFER __bridge_transfer
#define MA_BRIDGE_RETAINED __bridge_retained
#else
#define MA_BRIDGE_TRANSFER
#define MA_BRIDGE_RETAINED
#endif
#else
#define MA_APPLE_DESKTOP
#endif
......@@ -30164,7 +30188,7 @@ static OSStatus ma_on_output__coreaudio(void* pUserData, AudioUnitRenderActionFl
MA_ASSERT(pDevice != NULL);
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "INFO: Output Callback: busNumber=%d, frameCount=%d, mNumberBuffers=%d\n", busNumber, frameCount, pBufferList->mNumberBuffers);
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "INFO: Output Callback: busNumber=%d, frameCount=%d, mNumberBuffers=%d\n", (int)busNumber, (int)frameCount, (int)pBufferList->mNumberBuffers);
/* We need to check whether or not we are outputting interleaved or non-interleaved samples. The way we do this is slightly different for each type. */
layout = ma_stream_layout_interleaved;
......@@ -30182,7 +30206,7 @@ static OSStatus ma_on_output__coreaudio(void* pUserData, AudioUnitRenderActionFl
ma_device_handle_backend_data_callback(pDevice, pBufferList->mBuffers[iBuffer].mData, NULL, frameCountForThisBuffer);
}
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, " frameCount=%d, mNumberChannels=%d, mDataByteSize=%d\n", frameCount, pBufferList->mBuffers[iBuffer].mNumberChannels, pBufferList->mBuffers[iBuffer].mDataByteSize);
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, " frameCount=%d, mNumberChannels=%d, mDataByteSize=%d\n", (int)frameCount, (int)pBufferList->mBuffers[iBuffer].mNumberChannels, (int)pBufferList->mBuffers[iBuffer].mDataByteSize);
} else {
/*
This case is where the number of channels in the output buffer do not match our internal channels. It could mean that it's
......@@ -30190,7 +30214,7 @@ static OSStatus ma_on_output__coreaudio(void* pUserData, AudioUnitRenderActionFl
output silence here.
*/
MA_ZERO_MEMORY(pBufferList->mBuffers[iBuffer].mData, pBufferList->mBuffers[iBuffer].mDataByteSize);
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, " WARNING: Outputting silence. frameCount=%d, mNumberChannels=%d, mDataByteSize=%d\n", frameCount, pBufferList->mBuffers[iBuffer].mNumberChannels, pBufferList->mBuffers[iBuffer].mDataByteSize);
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, " WARNING: Outputting silence. frameCount=%d, mNumberChannels=%d, mDataByteSize=%d\n", (int)frameCount, (int)pBufferList->mBuffers[iBuffer].mNumberChannels, (int)pBufferList->mBuffers[iBuffer].mDataByteSize);
}
}
} else {
......@@ -30259,7 +30283,7 @@ static OSStatus ma_on_input__coreaudio(void* pUserData, AudioUnitRenderActionFla
layout = ma_stream_layout_deinterleaved;
}
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "INFO: Input Callback: busNumber=%d, frameCount=%d, mNumberBuffers=%d\n", busNumber, frameCount, pRenderedBufferList->mNumberBuffers);
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "INFO: Input Callback: busNumber=%d, frameCount=%d, mNumberBuffers=%d\n", (int)busNumber, (int)frameCount, (int)pRenderedBufferList->mNumberBuffers);
/*
There has been a situation reported where frame count passed into this function is greater than the capacity of
......@@ -30287,7 +30311,7 @@ static OSStatus ma_on_input__coreaudio(void* pUserData, AudioUnitRenderActionFla
status = ((ma_AudioUnitRender_proc)pDevice->pContext->coreaudio.AudioUnitRender)((AudioUnit)pDevice->coreaudio.audioUnitCapture, pActionFlags, pTimeStamp, busNumber, frameCount, pRenderedBufferList);
if (status != noErr) {
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, " ERROR: AudioUnitRender() failed with %d\n", status);
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, " ERROR: AudioUnitRender() failed with %d\n", (int)status);
return status;
}
......@@ -30295,7 +30319,7 @@ static OSStatus ma_on_input__coreaudio(void* pUserData, AudioUnitRenderActionFla
for (iBuffer = 0; iBuffer < pRenderedBufferList->mNumberBuffers; ++iBuffer) {
if (pRenderedBufferList->mBuffers[iBuffer].mNumberChannels == pDevice->capture.internalChannels) {
ma_device_handle_backend_data_callback(pDevice, NULL, pRenderedBufferList->mBuffers[iBuffer].mData, frameCount);
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, " mDataByteSize=%d\n", pRenderedBufferList->mBuffers[iBuffer].mDataByteSize);
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, " mDataByteSize=%d\n", (int)pRenderedBufferList->mBuffers[iBuffer].mDataByteSize);
} else {
/*
This case is where the number of channels in the output buffer do not match our internal channels. It could mean that it's
......@@ -30318,7 +30342,7 @@ static OSStatus ma_on_input__coreaudio(void* pUserData, AudioUnitRenderActionFla
framesRemaining -= framesToSend;
}
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, " WARNING: Outputting silence. frameCount=%d, mNumberChannels=%d, mDataByteSize=%d\n", frameCount, pRenderedBufferList->mBuffers[iBuffer].mNumberChannels, pRenderedBufferList->mBuffers[iBuffer].mDataByteSize);
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, " WARNING: Outputting silence. frameCount=%d, mNumberChannels=%d, mDataByteSize=%d\n", (int)frameCount, (int)pRenderedBufferList->mBuffers[iBuffer].mNumberChannels, (int)pRenderedBufferList->mBuffers[iBuffer].mDataByteSize);
}
}
} else {
......@@ -30672,6 +30696,7 @@ static ma_result ma_device__untrack__coreaudio(ma_device* pDevice)
-(void)dealloc
{
[self remove_handler];
[super dealloc];
}
-(void)remove_handler
......@@ -30766,7 +30791,7 @@ static ma_result ma_device_uninit__coreaudio(ma_device* pDevice)
#endif
#if defined(MA_APPLE_MOBILE)
if (pDevice->coreaudio.pRouteChangeHandler != NULL) {
ma_router_change_handler* pRouteChangeHandler = (__bridge_transfer ma_router_change_handler*)pDevice->coreaudio.pRouteChangeHandler;
ma_router_change_handler* pRouteChangeHandler = (MA_BRIDGE_TRANSFER ma_router_change_handler*)pDevice->coreaudio.pRouteChangeHandler;
[pRouteChangeHandler remove_handler];
}
#endif
......@@ -31087,7 +31112,7 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev
}
#else
/* TODO: Figure out how to get the channel map using AVAudioSession. */
ma_channel_map_init_standard(ma_standard_channel_map_default, pData->channelMap, ma_countof(pData->channelMap), pData->channelsOut);
ma_channel_map_init_standard(ma_standard_channel_map_default, pData->channelMapOut, ma_countof(pData->channelMapOut), pData->channelsOut);
#endif
......@@ -31440,7 +31465,7 @@ static ma_result ma_device_init__coreaudio(ma_device* pDevice, const ma_device_c
differently on non-Desktop Apple platforms.
*/
#if defined(MA_APPLE_MOBILE)
pDevice->coreaudio.pRouteChangeHandler = (__bridge_retained void*)[[ma_router_change_handler alloc] init:pDevice];
pDevice->coreaudio.pRouteChangeHandler = (MA_BRIDGE_RETAINED void*)[[ma_router_change_handler alloc] init:pDevice];
#endif
return MA_SUCCESS;
......@@ -39057,7 +39082,7 @@ MA_API ma_result ma_slot_allocator_free(ma_slot_allocator* pAllocator, ma_uint64
MA_ASSERT(iBit < 32); /* This must be true due to the logic we used to actually calculate it. */
while (c89atomic_load_32(&pAllocator->count) > 0) {
while (c89atomic_load_32(&pAllocator->count) > 0) {
/* CAS */
ma_uint32 oldBitfield;
ma_uint32 newBitfield;
......@@ -55246,7 +55271,7 @@ extern "C" {
#define DRFLAC_XSTRINGIFY(x) DRFLAC_STRINGIFY(x)
#define DRFLAC_VERSION_MAJOR 0
#define DRFLAC_VERSION_MINOR 12
#define DRFLAC_VERSION_REVISION 31
#define DRFLAC_VERSION_REVISION 31
#define DRFLAC_VERSION_STRING DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MAJOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MINOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_REVISION)
#include <stddef.h>
typedef signed char drflac_int8;
......@@ -55607,7 +55632,7 @@ extern "C" {
#define DRMP3_XSTRINGIFY(x) DRMP3_STRINGIFY(x)
#define DRMP3_VERSION_MAJOR 0
#define DRMP3_VERSION_MINOR 6
#define DRMP3_VERSION_REVISION 31
#define DRMP3_VERSION_REVISION 31
#define DRMP3_VERSION_STRING DRMP3_XSTRINGIFY(DRMP3_VERSION_MAJOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_MINOR) "." DRMP3_XSTRINGIFY(DRMP3_VERSION_REVISION)
#include <stddef.h>
typedef signed char drmp3_int8;
......@@ -58534,7 +58559,7 @@ MA_API ma_result ma_stbvorbis_read_pcm_frames(ma_stbvorbis* pVorbis, void* pFram
framesRead = stb_vorbis_get_samples_float_interleaved(pVorbis->stb, channels, (float*)ma_offset_pcm_frames_ptr(pFramesOut, totalFramesRead, format, channels), (int)framesRemaining * channels); /* Safe cast. */
totalFramesRead += framesRead;
if (framesRead < framesRemaining) {
if (framesRead < (int)framesRemaining) {
break; /* Nothing left to read. Get out. */
}
}
......@@ -65813,8 +65838,8 @@ MA_API void ma_debug_fill_pcm_frames_with_sine_wave(float* pFramesOut, ma_uint32
(void)sampleRate;
#if defined(MA_DEBUG_OUTPUT)
{
#if _MSC_VER
#pragma message ("ma_debug_fill_pcm_frames_with_sine_wave() will do nothing because MA_NO_GENERATION is enabled.")
#if _MSC_VER
#pragma message ("ma_debug_fill_pcm_frames_with_sine_wave() will do nothing because MA_NO_GENERATION is enabled.")
#endif
}
#endif
......@@ -84040,7 +84065,7 @@ static type* drflac__full_read_and_close_ ## extension (drflac* pFlac, unsigned
DRFLAC_ZERO_MEMORY(pSampleData + (totalPCMFrameCount*pFlac->channels), (size_t)(sampleDataBufferSize - totalPCMFrameCount*pFlac->channels*sizeof(type))); \
} else { \
drflac_uint64 dataSize = totalPCMFrameCount*pFlac->channels*sizeof(type); \
if (dataSize > (drflac_uint64)DRFLAC_SIZE_MAX) { \
if (dataSize > (drflac_uint64)DRFLAC_SIZE_MAX) { \
goto on_error; \
} \
\
......@@ -84483,29 +84508,29 @@ static __inline__ __attribute__((always_inline)) drmp3_int32 drmp3_clip_int16_ar
#else
#define DRMP3_HAVE_ARMV6 0
#endif
#ifndef DRMP3_ASSERT
#include <assert.h>
#define DRMP3_ASSERT(expression) assert(expression)
#endif
#ifndef DRMP3_COPY_MEMORY
#define DRMP3_COPY_MEMORY(dst, src, sz) memcpy((dst), (src), (sz))
#endif
#ifndef DRMP3_MOVE_MEMORY
#define DRMP3_MOVE_MEMORY(dst, src, sz) memmove((dst), (src), (sz))
#endif
#ifndef DRMP3_ZERO_MEMORY
#define DRMP3_ZERO_MEMORY(p, sz) memset((p), 0, (sz))
#endif
#define DRMP3_ZERO_OBJECT(p) DRMP3_ZERO_MEMORY((p), sizeof(*(p)))
#ifndef DRMP3_MALLOC
#define DRMP3_MALLOC(sz) malloc((sz))
#endif
#ifndef DRMP3_REALLOC
#define DRMP3_REALLOC(p, sz) realloc((p), (sz))
#endif
#ifndef DRMP3_FREE
#define DRMP3_FREE(p) free((p))
#endif
#ifndef DRMP3_ASSERT
#include <assert.h>
#define DRMP3_ASSERT(expression) assert(expression)
#endif
#ifndef DRMP3_COPY_MEMORY
#define DRMP3_COPY_MEMORY(dst, src, sz) memcpy((dst), (src), (sz))
#endif
#ifndef DRMP3_MOVE_MEMORY
#define DRMP3_MOVE_MEMORY(dst, src, sz) memmove((dst), (src), (sz))
#endif
#ifndef DRMP3_ZERO_MEMORY
#define DRMP3_ZERO_MEMORY(p, sz) memset((p), 0, (sz))
#endif
#define DRMP3_ZERO_OBJECT(p) DRMP3_ZERO_MEMORY((p), sizeof(*(p)))
#ifndef DRMP3_MALLOC
#define DRMP3_MALLOC(sz) malloc((sz))
#endif
#ifndef DRMP3_REALLOC
#define DRMP3_REALLOC(p, sz) realloc((p), (sz))
#endif
#ifndef DRMP3_FREE
#define DRMP3_FREE(p) free((p))
#endif
typedef struct
{
const drmp3_uint8 *buf;
......@@ -84745,7 +84770,7 @@ static int drmp3_L12_dequantize_granule(float *grbuf, drmp3_bs *bs, drmp3_L12_sc
static void drmp3_L12_apply_scf_384(drmp3_L12_scale_info *sci, const float *scf, float *dst)
{
int i, k;
DRMP3_COPY_MEMORY(dst + 576 + sci->stereo_bands*18, dst + sci->stereo_bands*18, (sci->total_bands - sci->stereo_bands)*18*sizeof(float));
DRMP3_COPY_MEMORY(dst + 576 + sci->stereo_bands*18, dst + sci->stereo_bands*18, (sci->total_bands - sci->stereo_bands)*18*sizeof(float));
for (i = 0; i < sci->total_bands; i++, dst += 18, scf += 6)
{
for (k = 0; k < 12; k++)
......@@ -84883,14 +84908,14 @@ static void drmp3_L3_read_scalefactors(drmp3_uint8 *scf, drmp3_uint8 *ist_pos, c
int cnt = scf_count[i];
if (scfsi & 8)
{
DRMP3_COPY_MEMORY(scf, ist_pos, cnt);
DRMP3_COPY_MEMORY(scf, ist_pos, cnt);
} else
{
int bits = scf_size[i];
if (!bits)
{
DRMP3_ZERO_MEMORY(scf, cnt);
DRMP3_ZERO_MEMORY(ist_pos, cnt);
DRMP3_ZERO_MEMORY(scf, cnt);
DRMP3_ZERO_MEMORY(ist_pos, cnt);
} else
{
int max_scf = (scfsi < 0) ? (1 << bits) - 1 : -1;
......@@ -85243,7 +85268,7 @@ static void drmp3_L3_reorder(float *grbuf, float *scratch, const drmp3_uint8 *sf
*dst++ = src[2*len];
}
}
DRMP3_COPY_MEMORY(grbuf, scratch, (dst - scratch)*sizeof(float));
DRMP3_COPY_MEMORY(grbuf, scratch, (dst - scratch)*sizeof(float));
}
static void drmp3_L3_antialias(float *grbuf, int nbands)
{
......@@ -85393,8 +85418,8 @@ static void drmp3_L3_imdct_short(float *grbuf, float *overlap, int nbands)
for (;nbands > 0; nbands--, overlap += 9, grbuf += 18)
{
float tmp[18];
DRMP3_COPY_MEMORY(tmp, grbuf, sizeof(tmp));
DRMP3_COPY_MEMORY(grbuf, overlap, 6*sizeof(float));
DRMP3_COPY_MEMORY(tmp, grbuf, sizeof(tmp));
DRMP3_COPY_MEMORY(grbuf, overlap, 6*sizeof(float));
drmp3_L3_imdct12(tmp, grbuf + 6, overlap + 6);
drmp3_L3_imdct12(tmp + 1, grbuf + 12, overlap + 6);
drmp3_L3_imdct12(tmp + 2, overlap, overlap + 6);
......@@ -85435,7 +85460,7 @@ static void drmp3_L3_save_reservoir(drmp3dec *h, drmp3dec_scratch *s)
}
if (remains > 0)
{
DRMP3_MOVE_MEMORY(h->reserv_buf, s->maindata + pos, remains);
DRMP3_MOVE_MEMORY(h->reserv_buf, s->maindata + pos, remains);
}
h->reserv = remains;
}
......@@ -85443,8 +85468,8 @@ static int drmp3_L3_restore_reservoir(drmp3dec *h, drmp3_bs *bs, drmp3dec_scratc
{
int frame_bytes = (bs->limit - bs->pos)/8;
int bytes_have = DRMP3_MIN(h->reserv, main_data_begin);
DRMP3_COPY_MEMORY(s->maindata, h->reserv_buf + DRMP3_MAX(0, h->reserv - main_data_begin), DRMP3_MIN(h->reserv, main_data_begin));
DRMP3_COPY_MEMORY(s->maindata + bytes_have, bs->buf + bs->pos/8, frame_bytes);
DRMP3_COPY_MEMORY(s->maindata, h->reserv_buf + DRMP3_MAX(0, h->reserv - main_data_begin), DRMP3_MIN(h->reserv, main_data_begin));
DRMP3_COPY_MEMORY(s->maindata + bytes_have, bs->buf + bs->pos/8, frame_bytes);
drmp3_bs_init(&s->bs, s->maindata, bytes_have + frame_bytes);
return h->reserv >= main_data_begin;
}
......@@ -85822,7 +85847,7 @@ static void drmp3d_synth_granule(float *qmf_state, float *grbuf, int nbands, int
{
drmp3d_DCT_II(grbuf + 576*i, nbands);
}
DRMP3_COPY_MEMORY(lins, qmf_state, sizeof(float)*15*64);
DRMP3_COPY_MEMORY(lins, qmf_state, sizeof(float)*15*64);
for (i = 0; i < nbands; i += 2)
{
drmp3d_synth(grbuf + i, pcm + 32*nch*i, nch, lins + i*64);
......@@ -85837,7 +85862,7 @@ static void drmp3d_synth_granule(float *qmf_state, float *grbuf, int nbands, int
} else
#endif
{
DRMP3_COPY_MEMORY(qmf_state, lins + nbands*64, sizeof(float)*15*64);
DRMP3_COPY_MEMORY(qmf_state, lins + nbands*64, sizeof(float)*15*64);
}
}
static int drmp3d_match_frame(const drmp3_uint8 *hdr, int mp3_bytes, int frame_bytes)
......@@ -85908,7 +85933,7 @@ DRMP3_API int drmp3dec_decode_frame(drmp3dec *dec, const drmp3_uint8 *mp3, int m
}
if (!frame_size)
{
DRMP3_ZERO_MEMORY(dec, sizeof(drmp3dec));
DRMP3_ZERO_MEMORY(dec, sizeof(drmp3dec));
i = drmp3d_find_frame(mp3, mp3_bytes, &dec->free_format_bytes, &frame_size);
if (!frame_size || i + frame_size > mp3_bytes)
{
......@@ -85917,7 +85942,7 @@ DRMP3_API int drmp3dec_decode_frame(drmp3dec *dec, const drmp3_uint8 *mp3, int m
}
}
hdr = mp3 + i;
DRMP3_COPY_MEMORY(dec->header, hdr, DRMP3_HDR_SIZE);
DRMP3_COPY_MEMORY(dec->header, hdr, DRMP3_HDR_SIZE);
info->frame_bytes = i + frame_size;
info->channels = DRMP3_HDR_IS_MONO(hdr) ? 1 : 2;
info->hz = drmp3_hdr_sample_rate_hz(hdr);
......@@ -85941,7 +85966,7 @@ DRMP3_API int drmp3dec_decode_frame(drmp3dec *dec, const drmp3_uint8 *mp3, int m
{
for (igr = 0; igr < (DRMP3_HDR_TEST_MPEG1(hdr) ? 2 : 1); igr++, pcm = DRMP3_OFFSET_PTR(pcm, sizeof(drmp3d_sample_t)*576*info->channels))
{
DRMP3_ZERO_MEMORY(scratch.grbuf[0], 576*2*sizeof(float));
DRMP3_ZERO_MEMORY(scratch.grbuf[0], 576*2*sizeof(float));
drmp3_L3_decode(dec, &scratch, scratch.gr_info + igr*info->channels, info->channels);
drmp3d_synth_granule(dec->qmf_state, scratch.grbuf[0], 18, info->channels, (drmp3d_sample_t*)pcm, scratch.syn[0]);
}
......@@ -85957,7 +85982,7 @@ DRMP3_API int drmp3dec_decode_frame(drmp3dec *dec, const drmp3_uint8 *mp3, int m
return drmp3_hdr_frame_samples(hdr);
}
drmp3_L12_read_scale_info(hdr, bs_frame, sci);
DRMP3_ZERO_MEMORY(scratch.grbuf[0], 576*2*sizeof(float));
DRMP3_ZERO_MEMORY(scratch.grbuf[0], 576*2*sizeof(float));
for (i = 0, igr = 0; igr < 3; igr++)
{
if (12 == (i += drmp3_L12_dequantize_granule(scratch.grbuf[0] + i, bs_frame, sci, info->layer | 1)))
......@@ -85965,7 +85990,7 @@ DRMP3_API int drmp3dec_decode_frame(drmp3dec *dec, const drmp3_uint8 *mp3, int m
i = 0;
drmp3_L12_apply_scf_384(sci, sci->scf + igr, scratch.grbuf[0]);
drmp3d_synth_granule(dec->qmf_state, scratch.grbuf[0], 12, info->channels, (drmp3d_sample_t*)pcm, scratch.syn[0]);
DRMP3_ZERO_MEMORY(scratch.grbuf[0], 576*2*sizeof(float));
DRMP3_ZERO_MEMORY(scratch.grbuf[0], 576*2*sizeof(float));
pcm = DRMP3_OFFSET_PTR(pcm, sizeof(drmp3d_sample_t)*384*info->channels);
}
if (bs_frame->pos > bs_frame->limit)
......@@ -86219,7 +86244,7 @@ static drmp3_uint32 drmp3_decode_next_frame_ex__callbacks(drmp3* pMP3, drmp3d_sa
if (pMP3->dataSize < DRMP3_MIN_DATA_CHUNK_SIZE) {
size_t bytesRead;
if (pMP3->pData != NULL) {
DRMP3_MOVE_MEMORY(pMP3->pData, pMP3->pData + pMP3->dataConsumed, pMP3->dataSize);
DRMP3_MOVE_MEMORY(pMP3->pData, pMP3->pData + pMP3->dataConsumed, pMP3->dataSize);
}
pMP3->dataConsumed = 0;
if (pMP3->dataCapacity < DRMP3_DATA_CHUNK_SIZE) {
......@@ -86262,7 +86287,7 @@ static drmp3_uint32 drmp3_decode_next_frame_ex__callbacks(drmp3* pMP3, drmp3d_sa
break;
} else if (info.frame_bytes == 0) {
size_t bytesRead;
DRMP3_MOVE_MEMORY(pMP3->pData, pMP3->pData + pMP3->dataConsumed, pMP3->dataSize);
DRMP3_MOVE_MEMORY(pMP3->pData, pMP3->pData + pMP3->dataConsumed, pMP3->dataSize);
pMP3->dataConsumed = 0;
if (pMP3->dataCapacity == pMP3->dataSize) {
drmp3_uint8* pNewData;
......@@ -86294,20 +86319,20 @@ static drmp3_uint32 drmp3_decode_next_frame_ex__memory(drmp3* pMP3, drmp3d_sampl
if (pMP3->atEnd) {
return 0;
}
for (;;) {
pcmFramesRead = drmp3dec_decode_frame(&pMP3->decoder, pMP3->memory.pData + pMP3->memory.currentReadPos, (int)(pMP3->memory.dataSize - pMP3->memory.currentReadPos), pPCMFrames, &info);
if (pcmFramesRead > 0) {
pcmFramesRead = drmp3_hdr_frame_samples(pMP3->decoder.header);
pMP3->pcmFramesConsumedInMP3Frame = 0;
pMP3->pcmFramesRemainingInMP3Frame = pcmFramesRead;
pMP3->mp3FrameChannels = info.channels;
pMP3->mp3FrameSampleRate = info.hz;
break;
} else if (info.frame_bytes > 0) {
pMP3->memory.currentReadPos += (size_t)info.frame_bytes;
} else {
break;
}
for (;;) {
pcmFramesRead = drmp3dec_decode_frame(&pMP3->decoder, pMP3->memory.pData + pMP3->memory.currentReadPos, (int)(pMP3->memory.dataSize - pMP3->memory.currentReadPos), pPCMFrames, &info);
if (pcmFramesRead > 0) {
pcmFramesRead = drmp3_hdr_frame_samples(pMP3->decoder.header);
pMP3->pcmFramesConsumedInMP3Frame = 0;
pMP3->pcmFramesRemainingInMP3Frame = pcmFramesRead;
pMP3->mp3FrameChannels = info.channels;
pMP3->mp3FrameSampleRate = info.hz;
break;
} else if (info.frame_bytes > 0) {
pMP3->memory.currentReadPos += (size_t)info.frame_bytes;
} else {
break;
}
}
pMP3->memory.currentReadPos += (size_t)info.frame_bytes;
return pcmFramesRead;
......@@ -86352,7 +86377,7 @@ static drmp3_bool32 drmp3_init_internal(drmp3* pMP3, drmp3_read_proc onRead, drm
if (pMP3->allocationCallbacks.onFree == NULL || (pMP3->allocationCallbacks.onMalloc == NULL && pMP3->allocationCallbacks.onRealloc == NULL)) {
return DRMP3_FALSE;
}
if (drmp3_decode_next_frame(pMP3) == 0) {
if (drmp3_decode_next_frame(pMP3) == 0) {
drmp3__free_from_callbacks(pMP3->pData, &pMP3->allocationCallbacks);
return DRMP3_FALSE;
}
......@@ -87434,7 +87459,7 @@ static float* drmp3__full_read_and_close_f32(drmp3* pMP3, drmp3_config* pConfig,
}
oldFramesBufferSize = framesCapacity * pMP3->channels * sizeof(float);
newFramesBufferSize = newFramesCap * pMP3->channels * sizeof(float);
if (newFramesBufferSize > (drmp3_uint64)DRMP3_SIZE_MAX) {
if (newFramesBufferSize > (drmp3_uint64)DRMP3_SIZE_MAX) {
break;
}
pNewFrames = (float*)drmp3__realloc_from_callbacks(pFrames, (size_t)newFramesBufferSize, (size_t)oldFramesBufferSize, &pMP3->allocationCallbacks);
......@@ -87485,7 +87510,7 @@ static drmp3_int16* drmp3__full_read_and_close_s16(drmp3* pMP3, drmp3_config* pC
}
oldFramesBufferSize = framesCapacity * pMP3->channels * sizeof(drmp3_int16);
newFramesBufferSize = newFramesCap * pMP3->channels * sizeof(drmp3_int16);
if (newFramesBufferSize > (drmp3_uint64)DRMP3_SIZE_MAX) {
if (newFramesBufferSize > (drmp3_uint64)DRMP3_SIZE_MAX) {
break;
}
pNewFrames = (drmp3_int16*)drmp3__realloc_from_callbacks(pFrames, (size_t)newFramesBufferSize, (size_t)oldFramesBufferSize, &pMP3->allocationCallbacks);
......@@ -87909,9 +87934,9 @@ issues with certain devices and configurations. These can be individually enable
/*
REVISION HISTORY
================
v0.10.42 - 2021-08-22
- Fix a possible deadlock when stopping devices.
v0.10.42 - 2021-08-22
- Fix a possible deadlock when stopping devices.
v0.10.41 - 2021-08-15
- Core Audio: Fix some deadlock errors.
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