Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
3ea17061
Commit
3ea17061
authored
Jul 18, 2021
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix warnings on the 32-bit build.
parent
5f20002a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
+22
-2
miniaudio.h
miniaudio.h
+22
-2
No files found.
miniaudio.h
View file @
3ea17061
...
@@ -34779,9 +34779,19 @@ static ma_result ma_device__post_init_setup(ma_device* pDevice, ma_device_type d
...
@@ -34779,9 +34779,19 @@ static ma_result ma_device__post_init_setup(ma_device* pDevice, ma_device_type d
/* We need a heap allocated cache. We want to size this based on the period size. */
/* We need a heap allocated cache. We want to size this based on the period size. */
void* pNewInputCache;
void* pNewInputCache;
ma_uint64 newInputCacheCap;
ma_uint64 newInputCacheCap;
ma_uint64 newInputCacheSizeInBytes;
newInputCacheCap = ma_calculate_frame_count_after_resampling(pDevice->playback.internalSampleRate, pDevice->sampleRate, pDevice->playback.internalPeriodSizeInFrames);
newInputCacheCap = ma_calculate_frame_count_after_resampling(pDevice->playback.internalSampleRate, pDevice->sampleRate, pDevice->playback.internalPeriodSizeInFrames);
pNewInputCache = ma_realloc(pDevice->playback.pInputCache, newInputCacheCap * ma_get_bytes_per_frame(pDevice->playback.format, pDevice->playback.channels), &pDevice->pContext->allocationCallbacks);
newInputCacheSizeInBytes = newInputCacheCap * ma_get_bytes_per_frame(pDevice->playback.format, pDevice->playback.channels);
if (newInputCacheSizeInBytes > MA_SIZE_MAX) {
ma_free(pDevice->playback.pInputCache, &pDevice->pContext->allocationCallbacks);
pDevice->playback.pInputCache = NULL;
pDevice->playback.inputCacheCap = 0;
return MA_OUT_OF_MEMORY; /* Allocation too big. Should never hit this, but makes the cast below safer for 32-bit builds. */
}
pNewInputCache = ma_realloc(pDevice->playback.pInputCache, (size_t)newInputCacheSizeInBytes, &pDevice->pContext->allocationCallbacks);
if (pNewInputCache == NULL) {
if (pNewInputCache == NULL) {
ma_free(pDevice->playback.pInputCache, &pDevice->pContext->allocationCallbacks);
ma_free(pDevice->playback.pInputCache, &pDevice->pContext->allocationCallbacks);
pDevice->playback.pInputCache = NULL;
pDevice->playback.pInputCache = NULL;
...
@@ -49724,8 +49734,18 @@ static ma_result ma_decoder__init_data_converter(ma_decoder* pDecoder, const ma_
...
@@ -49724,8 +49734,18 @@ static ma_result ma_decoder__init_data_converter(ma_decoder* pDecoder, const ma_
We were unable to calculate the required input frame count which means we'll need to use
We were unable to calculate the required input frame count which means we'll need to use
a heap-allocated cache.
a heap-allocated cache.
*/
*/
ma_uint64 inputCacheCapSizeInBytes;
pDecoder->inputCacheCap = MA_DATA_CONVERTER_STACK_BUFFER_SIZE / ma_get_bytes_per_frame(internalFormat, internalChannels);
pDecoder->inputCacheCap = MA_DATA_CONVERTER_STACK_BUFFER_SIZE / ma_get_bytes_per_frame(internalFormat, internalChannels);
pDecoder->pInputCache = ma_malloc(pDecoder->inputCacheCap * ma_get_bytes_per_frame(internalFormat, internalChannels), &pDecoder->allocationCallbacks);
/* Not strictly necessary, but keeping here for safety in case we change the default value of pDecoder->inputCacheCap. */
inputCacheCapSizeInBytes = pDecoder->inputCacheCap * ma_get_bytes_per_frame(internalFormat, internalChannels);
if (inputCacheCapSizeInBytes > MA_SIZE_MAX) {
ma_data_converter_uninit(&pDecoder->converter, &pDecoder->allocationCallbacks);
return MA_OUT_OF_MEMORY;
}
pDecoder->pInputCache = ma_malloc((size_t)inputCacheCapSizeInBytes, &pDecoder->allocationCallbacks); /* Safe cast to size_t. */
if (pDecoder->pInputCache == NULL) {
if (pDecoder->pInputCache == NULL) {
ma_data_converter_uninit(&pDecoder->converter, &pDecoder->allocationCallbacks);
ma_data_converter_uninit(&pDecoder->converter, &pDecoder->allocationCallbacks);
return MA_OUT_OF_MEMORY;
return MA_OUT_OF_MEMORY;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment