input/alsa: use snd_pcm_?w_params_alloca()
This commit is contained in:
parent
6b968beede
commit
68bb738af2
@ -33,7 +33,6 @@
|
|||||||
#include "util/RuntimeError.hxx"
|
#include "util/RuntimeError.hxx"
|
||||||
#include "util/StringCompare.hxx"
|
#include "util/StringCompare.hxx"
|
||||||
#include "util/ReusableArray.hxx"
|
#include "util/ReusableArray.hxx"
|
||||||
#include "util/ScopeExit.hxx"
|
|
||||||
|
|
||||||
#include "Log.hxx"
|
#include "Log.hxx"
|
||||||
#include "event/MultiSocketMonitor.hxx"
|
#include "event/MultiSocketMonitor.hxx"
|
||||||
@ -287,13 +286,7 @@ ConfigureCapture(snd_pcm_t *capture_handle,
|
|||||||
int err;
|
int err;
|
||||||
|
|
||||||
snd_pcm_hw_params_t *hw_params;
|
snd_pcm_hw_params_t *hw_params;
|
||||||
if ((err = snd_pcm_hw_params_malloc(&hw_params)) < 0)
|
snd_pcm_hw_params_alloca(&hw_params);
|
||||||
throw FormatRuntimeError("Cannot allocate hardware parameter structure (%s)",
|
|
||||||
snd_strerror(err));
|
|
||||||
|
|
||||||
AtScopeExit(hw_params) {
|
|
||||||
snd_pcm_hw_params_free(hw_params);
|
|
||||||
};
|
|
||||||
|
|
||||||
if ((err = snd_pcm_hw_params_any(capture_handle, hw_params)) < 0)
|
if ((err = snd_pcm_hw_params_any(capture_handle, hw_params)) < 0)
|
||||||
throw FormatRuntimeError("Cannot initialize hardware parameter structure (%s)",
|
throw FormatRuntimeError("Cannot initialize hardware parameter structure (%s)",
|
||||||
@ -373,14 +366,10 @@ ConfigureCapture(snd_pcm_t *capture_handle,
|
|||||||
(unsigned)alsa_buffer_size, (unsigned)alsa_period_size);
|
(unsigned)alsa_buffer_size, (unsigned)alsa_period_size);
|
||||||
|
|
||||||
snd_pcm_sw_params_t *sw_params;
|
snd_pcm_sw_params_t *sw_params;
|
||||||
|
snd_pcm_sw_params_alloca(&sw_params);
|
||||||
|
|
||||||
snd_pcm_sw_params_malloc(&sw_params);
|
|
||||||
snd_pcm_sw_params_current(capture_handle, sw_params);
|
snd_pcm_sw_params_current(capture_handle, sw_params);
|
||||||
|
|
||||||
AtScopeExit(sw_params) {
|
|
||||||
snd_pcm_sw_params_free(sw_params);
|
|
||||||
};
|
|
||||||
|
|
||||||
if ((err = snd_pcm_sw_params(capture_handle, sw_params)) < 0)
|
if ((err = snd_pcm_sw_params(capture_handle, sw_params)) < 0)
|
||||||
throw FormatRuntimeError("unable to install sw params (%s)",
|
throw FormatRuntimeError("unable to install sw params (%s)",
|
||||||
snd_strerror(err));
|
snd_strerror(err));
|
||||||
|
Loading…
Reference in New Issue
Block a user