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
1d2a500e
Commit
1d2a500e
authored
Jan 21, 2022
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PulseAudio: Try fixing an error when initializing a device.
Public issue
https://github.com/mackron/miniaudio/issues/412
parent
0072eb8b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
miniaudio.h
miniaudio.h
+19
-0
No files found.
miniaudio.h
View file @
1d2a500e
...
@@ -28923,16 +28923,26 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
...
@@ -28923,16 +28923,26 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
goto on_error2;
goto on_error2;
}
}
/* Internal format. */
/* Internal format. */
pActualSS = ((ma_pa_stream_get_sample_spec_proc)pDevice->pContext->pulse.pa_stream_get_sample_spec)((ma_pa_stream*)pDevice->pulse.pStreamCapture);
pActualSS = ((ma_pa_stream_get_sample_spec_proc)pDevice->pContext->pulse.pa_stream_get_sample_spec)((ma_pa_stream*)pDevice->pulse.pStreamCapture);
if (pActualSS != NULL) {
if (pActualSS != NULL) {
ss = *pActualSS;
ss = *pActualSS;
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] Capture sample spec: format=%s, channels=%d, rate=%d\n", ma_get_format_name(ma_format_from_pulse(ss.format)), ss.channels, ss.rate);
} else {
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] Failed to retrieve capture sample spec.\n");
}
}
pDescriptorCapture->format = ma_format_from_pulse(ss.format);
pDescriptorCapture->format = ma_format_from_pulse(ss.format);
pDescriptorCapture->channels = ss.channels;
pDescriptorCapture->channels = ss.channels;
pDescriptorCapture->sampleRate = ss.rate;
pDescriptorCapture->sampleRate = ss.rate;
if (pDescriptorCapture->format == ma_format_unknown || pDescriptorCapture->channels == 0 || pDescriptorCapture->sampleRate == 0) {
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[PulseAudio] Capture sample spec is invalid. Device unusable by miniaudio. format=%s, channels=%d, sampleRate=%d.\n", ma_get_format_name(pDescriptorCapture->format), pDescriptorCapture->channels, pDescriptorCapture->sampleRate);
result = MA_ERROR;
goto on_error4;
}
/* Internal channel map. */
/* Internal channel map. */
pActualCMap = ((ma_pa_stream_get_channel_map_proc)pDevice->pContext->pulse.pa_stream_get_channel_map)((ma_pa_stream*)pDevice->pulse.pStreamCapture);
pActualCMap = ((ma_pa_stream_get_channel_map_proc)pDevice->pContext->pulse.pa_stream_get_channel_map)((ma_pa_stream*)pDevice->pulse.pStreamCapture);
if (pActualCMap != NULL) {
if (pActualCMap != NULL) {
...
@@ -29038,12 +29048,21 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
...
@@ -29038,12 +29048,21 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
pActualSS = ((ma_pa_stream_get_sample_spec_proc)pDevice->pContext->pulse.pa_stream_get_sample_spec)((ma_pa_stream*)pDevice->pulse.pStreamPlayback);
pActualSS = ((ma_pa_stream_get_sample_spec_proc)pDevice->pContext->pulse.pa_stream_get_sample_spec)((ma_pa_stream*)pDevice->pulse.pStreamPlayback);
if (pActualSS != NULL) {
if (pActualSS != NULL) {
ss = *pActualSS;
ss = *pActualSS;
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] Playback sample spec: format=%s, channels=%d, rate=%d\n", ma_get_format_name(ma_format_from_pulse(ss.format)), ss.channels, ss.rate);
} else {
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] Failed to retrieve playback sample spec.\n");
}
}
pDescriptorPlayback->format = ma_format_from_pulse(ss.format);
pDescriptorPlayback->format = ma_format_from_pulse(ss.format);
pDescriptorPlayback->channels = ss.channels;
pDescriptorPlayback->channels = ss.channels;
pDescriptorPlayback->sampleRate = ss.rate;
pDescriptorPlayback->sampleRate = ss.rate;
if (pDescriptorPlayback->format == ma_format_unknown || pDescriptorPlayback->channels == 0 || pDescriptorPlayback->sampleRate == 0) {
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[PulseAudio] Playback sample spec is invalid. Device unusable by miniaudio. format=%s, channels=%d, sampleRate=%d.\n", ma_get_format_name(pDescriptorPlayback->format), pDescriptorPlayback->channels, pDescriptorPlayback->sampleRate);
result = MA_ERROR;
goto on_error4;
}
/* Internal channel map. */
/* Internal channel map. */
pActualCMap = ((ma_pa_stream_get_channel_map_proc)pDevice->pContext->pulse.pa_stream_get_channel_map)((ma_pa_stream*)pDevice->pulse.pStreamPlayback);
pActualCMap = ((ma_pa_stream_get_channel_map_proc)pDevice->pContext->pulse.pa_stream_get_channel_map)((ma_pa_stream*)pDevice->pulse.pStreamPlayback);
if (pActualCMap != NULL) {
if (pActualCMap != NULL) {
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